On Thu, 23 Jul 2009 22:13:50 +0200, [email protected] wrote:
> Hello,
>
> is there anything ready for troff/eqn that could help me with
> 1) automatic equation numbering with possible setting a label to an
> equation by means of which one could forward/backward reference the
> equation?
> 2) setting a label somewhere in the text, so one can reference it and
> obtain e.g. a page on which the label is?
>
> Thanks
> Ruda
>
Hello
I am not aware of anything specificallyto meet your need, but I can get you
started.
To automatically number equations:
.nr En 0 1 \" En: equation number, 0: starting number, 1:
auto-incrementer
.EQ "" \n+(En
e = m c sup 2
.EN
.am EQ \" This will print the equation number and page number to stderr
.tm eqn: \\$2 \\n%
..
See CSTR 128, `Tools for Printing Indexes' by Jon Bentley and bwk,
particularly section 2., `Typical Use'
<http://www.kohala.com/start/troff/cstr128.ps>.
Then you would have a macro, .En equation-number, that would use the label in
t.out and match it with its page number using a preprocessor.
Then mix this all up to do exactly what you want to do.
--
Benn Newman