[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Groff] Resolving Forward References

From: Ted Harding
Subject: RE: [Groff] Resolving Forward References
Date: Fri, 02 Jan 2004 20:47:35 -0000 (GMT)

On 02-Jan-04 Andrew J. Piziali wrote:
>    As I understand it, groff is a single-pass formatter.  As such, what
> is the recommended way to resolve a forward string or register
> reference?  For example, using the ms macros, I have a footnote:
>     .FS
>     The process of using code coverage is discussed in section
>     \*[useModelSectionNumber], \(lqUse Model.\(rq
>     .FE
> which references a document section number later in the document.  The
> section number is stored in the string register useModelSectionNumber,
> after it is computed by the .NH section header macro.
>    Thank you for your assistance.

Hi Andy,
Single-pass indeed -- but nothing stops you using it twice in a row
under different conditions ...

One way round this problem is to set a "flag" at the beginning of the
file, say

.nr run1 1

and then, at appropriate places, put in a call to a macro which tests
\n[run1] and, if >0, writes out to a file (say xrefs.troff) a line

.ds useModelSectionNumber \\*[SN]

where \*[SN] (or \n[SN], depending) is the section number which,
by then, will have been constructed.

At the end of the run, you then have a file full of such definitions
which you can read in on the second pass.

More precisely, you can start your file with

.nr run1 1
.if !\n[run1] .so xrefs.troff

and then, for the second pass, change the first line to

.nr run1 0

I hope this helps!


E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 167 1972
Date: 02-Jan-04                                       Time: 20:47:35
------------------------------ XFMail ------------------------------

reply via email to

[Prev in Thread] Current Thread [Next in Thread]