From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Sat, 25 Jul 2009 11:56:51 -0500 From: Benn Newman To: 9fans@9fans.net Message-ID: <20090725165651.GA9351@SDF.LONESTAR.ORG> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Subject: Re: [9fans] troff: references Topicbox-Message-UUID: 2cdc51cc-ead5-11e9-9d60-3106f5b1d025 On Thu, 23 Jul 2009 22:13:50 +0200, rudolf.sykora@gmail.com 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' . 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