groff
[Top][All Lists]
Advanced

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

Re: [Groff] WARNING: tbl with auto-incrementing registers!


From: Ted Harding
Subject: Re: [Groff] WARNING: tbl with auto-incrementing registers!
Date: Wed, 20 Feb 2008 18:50:25 -0000 (GMT)

On 20-Feb-08 17:59:22, Denis M. Wilson wrote:
> I've often used these registers in tables. Re-initialising the
> register inside the table works for me. Ted's example comes out
> right as follows:
> 
> 
> \#.LP
> .nr EQno 0 1
> .TS
> tab(#);
> l l.
> .nr EQno 0 1
> \n+[EQno]#\n+[EQno]
> .TE
> 
> Denis M. Wilson

That's a thought! In real life, auto-incrementing registers
will usually have unknown values at the point where they
are needed. In the case of my example (a table of numbered
equations) there may be preceding (auto-incrementing) numbered
equations, and how many of these there are may depend on the
current state of revision of the document (e.g. today I may
decide to take out some I had in yesterday, or put in some
I did not have). So a more general solution is needed.

A solution along similar lines would probably work in general:
Here's a more realistic example:

.nr EQno 0 1
\n+[EQno] \n+[EQno] \n+[EQno] \"## as many as you like

.nr tblEQno \n[EQno]
.TS
tab(#);
l l r.
.nr EQno \n[tblEQno] 1
Newton:#$F ^=^ g {m sub 1 m sub 2} over {r sup 2}$#[\n+[EQno]]

Einstein:#$E ^=^ m c sup 2$#[\n+[EQno]]

.T&
l c r.
Deep Thought#\fB\s+[10]42\s0\fP#[\n+[EQno]]
.TE


where the equations in the successive lines of the table
come out with numbers [4], [5] and [6], as they should.

Thanks for the suggestion!
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 094 0861
Date: 20-Feb-08                                       Time: 18:50:21
------------------------------ XFMail ------------------------------




reply via email to

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