🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Jim Vaxkiller Wed, 05 Nov 1986 18:26
nroff -ms figure numbering
#1218
Author: Jim Vaxkiller
Date: Wed, 05 Nov 1986 18:26
19 lines
1379 bytes
I've got a little problem here I could use some help on.  I'm writing
a fairly large document (30-50 pages) that will have lots of figures
in it.  I use floating keeps to keep the figures together, but keep
losing track of what number I'm on.  I'm also screwed anytime I add
or delete a figure.  Does someone out there have a nifty little
macro to automatically number my figures for me?  Sure would help
if they did.

My system is nroff (ditroff for the laser printer), the ms macro
package, UN*X 4.2 BSD (may have some 4.3 ms macros, I'm not sure).
Also, it probably makes no difference but my document is spread out
over around 9 files, arranged so I can format the whole thing at once
or just get a title page, the part I'm working on, and a table of
contents.


Jim Harkins 
Loral Instrumentation, San Diego
{ucbvax, ittvax!dcdwest, akgua, decvax, ihnp4}!sdcsvax!sdcc6!loral!jlh
Re: nroff -ms figure numbering
#1223
Author: Avi Naiman
Date: Fri, 07 Nov 1986 21:06
151 lines
4862 bytes
> I use floating keeps to keep the figures together, but keep
> losing track of what number I'm on.  I'm also screwed anytime I add
> or delete a figure.  Does someone out there have a nifty little
> macro to automatically number my figures for me?

Here are some string definitions that use *roff's autoincrement
capability for number registers.  Fr is used for referencing
the figure in your text, and Fn for numbering the figure in a
caption.  [Er and En can be used to reference the same figure
a number of times before autoincrementing to the next number.]

.\"--------------------
.\" Figure Referencing and Numbering
.ds Fr \\n+(Fr
.ds Er \\n(Fr
.ds Fn \\n+(Fn
.ds En \\n(Fn
.\"--------------------

For example:

	See figure \*(Fr.
	This is the figure \*(Fn.


Here are more elaborate versions of the same strings, allowing you
to incorporate a section or chapter number into the figure number.
The section number can be similary autoincremented in a New Section
Macro.

.\"--------------------
.\" Figure Referencing and Numbering
.ds Fr \\n(Cn\.\\n+(Fr
.ds Er \\n(Cn\.\\n(Fr
.ds Fn \\n(Cn\.\\n+(Fn
.ds En \\n(Cn\.\\n(Fn
.\"--------------------

Finally, the two macros Fs (Figure start) and Fe (Figure end) allow
you to use a consistent graphic design for your figures.

Fs takes two arguments: the first specifies the amount of white space
(in inches) to leave for cutting and pasting in a figure (this can be
ommitted if your figure is generated from within *roff, e.g. a pic figure);
the second is the number to use for labeling the figure at the beginning
of the caption.  These macros have been developed for use with the ms
macro package and use floating keeps to push the figure to the next page
if there isn't enough room on the current one.

The graphic design involves rules before and after the figure,
an indented, shortened paragraph for the caption (using a reduced
point size), and appropriate white space between the elements.

.\"--------------------
.\" Figure Start
.de Fs
.KF
.if t .sp 0.25i
.if n .sp 2
.if t \s14\h'|0u'\l'6i\(ul'\s0
.if n \s14\h'|0u'\l'6i\(ul'\s0
.in +0.5i
.ll -0.5i
.nr LL -0.5i
.if t .ps -2
.if t .nr PS -2
.if t .vs -6
.if t .nr VS -6
.if t .sp \\$1i
.if n .sp 6u*\\$1
.if t .IP "Figure \\$2\." 0.75i
.if n .IP "Figure \\$2\." 14n
..

.\"--------------------
.\" Figure End
.de Fe
.br
.RT
.in -0.5i
.ll +0.5i
.nr LL +0.5i
.if t .ps +2
.if t .nr PS +2
.if t .vs +6
.if t .nr VS +6
.if t \s14\h'|0u'\l'6i\(ul'\s0
.if n \s14\h'|0u'\l'6i\(ul'\s0
.if t .sp 0.25i
.if n .sp 2
.KE
..

For example, the following text (with the macros above inserted)
run through nroff -ms produces the result below:

.nr Cn 1
.nr Fr 0 1
.nr Fn 0 1
.PP
This is text.  This is text.  This is text.  This is text.  This is text.
This is text.  This is text.  This is text.  This is text.  This is text.
This is text.  This is text.  This is text.  This is text.  This is text.
This is text.  This is text.  This is text.  This is text.  This is text.
Figure \*(Fr is a figure.
.Fs 2 \*(Fn
This is the figure.
.Fe
.PP
This is text.  This is text.  This is text.  This is text.  This is text.
This is text.  This is text.  This is text.  This is text.  This is text.
This is text.  This is text.  This is text.  This is text.  This is text.
This is text.  This is text.  This is text.  This is text.  This is text.






     This is text.  This is text.  This is  text.   This  is
text.   This is text.  This is text.  This is text.  This is
text.  This is text.  This is text.  This is text.  This  is
text.   This is text.  This is text.  This is text.  This is
text.  This is text.  This is text.  This is text.  This  is
text.  Figure 1.1 is a figure.


____________________________________________________________







     Figure 1.1.   This is the figure.
____________________________________________________________



     This is text.  This is text.  This is  text.   This  is
text.   This is text.  This is text.  This is text.  This is
text.  This is text.  This is text.  This is text.  This  is
text.   This is text.  This is text.  This is text.  This is
text.  This is text.  This is text.  This is text.  This  is
text.


Yours to enjoy,
Avi Naiman
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads