>From ted.hard...@wlandres.net Sun Mar 16 01:01:31 2014 > >Here is a suggestion (it's a technique I use systematically for >the purpose you describe). The following is in the context of ms >macros, though the same (or possibly a slight variant) should work >for other macro sets. > >**I first define an equation numbering and description system: > >.nr EQno 0 1 >.ds EQnxt \Z'\h'0.5m'[\\n+[EQno]\\$1]' >.ds EQnow \Z'\h'0.5m'[\\n[EQno]\\$1]' >.ds EQthing \Z'\h'0.5m'[\\$1]' > >These define an auto-incrementing equation number \n[EQno], >so that, for instance (wsaqy we have already got up to equation [4], > >.EQ \*[EQnxt] >phi ( x ) ~=~ exp( - half x sup 2 ) / sqrt{2 pi} >.EN >.ds EQnormdist \*[EQnow] > >Then the above equation will have its equation number (5) displayed >to the right as " [5]", since the "\n+[EQno]" when "\n[EQnxt]" is >read will first increment \n[EQno] from 4 to 5.
I cannot check with a graphical output right now, but rendered with ascii, I get strange results: $ cat bend.1 .nr EQno 0 1 .ds EQnxt \Z'\h'0.5m'(\\n+[EQno]\\$1)' .ds EQnow \Z'\h'0.5m'(\\n[EQno]\\$1)' .ds EQthing \Z'\h'0.5m'[\\$1]' .NH 1 Some section .PP Eqn. \*[mumu] shows that ... .EQ \*[EQnxt] phi ( x ) ~=~ exp( - half x sup 2 ) / sqrt{2 pi} .EN .ds mumu \*[EQnow] .ds mumua \*[EQnow a] .ds mumub \*[EQnow b] .PP Eqns. \*[mumua], \*[mumub] ... $ /usr/local/bin/groff -e -ms -Tascii bend.1 | head -n 15 bend.1:62: warning: can't find special character `*p' bend.1:69: warning: can't find special character `sqrt' bend.1:98: warning: can't find special character `sqrtex' bend.1:107: warning: can't find special character `*f' 1. Some section Eqn. shows that ... (x)=exp(-_x2)/2 (1) Eqns. ,1(... $ The last line of output is wrong. It should've read "Eqns. (1a), (1b) ...". What am I missing? Also, how exactly do I run groff twice to resolve the first, forward-looking reference? Should I take care myself that some cross-referencing information is saved to files? Or is this done automatically with some command line options with ms? Many thanks Anton