home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.text:1503 gnu.groff.bug:282
- Path: sparky!uunet!crdgw1!rpi!think.com!mintaka.lcs.mit.edu!ai-lab!prep.ai.mit.edu!gnulists
- From: jaap@alice.att.com (jaap)
- Newsgroups: comp.text,gnu.groff.bug
- Subject: Re: Annoying ?roff-ism
- Message-ID: <24497@alice.att.com>
- Date: 28 Dec 92 16:24:44 GMT
- References: <1992Dec23.150031.5068@spdcc.com>
- Reply-To: jaap@alice.UUCP ()
- Followup-To: comp.text,gnu.groff.bug
- Organization: AT&T, Bell Labs
- Lines: 39
- Approved: info-gnu@prep.ai.mit.edu
- To: uunet!gnu-groff-bug@uunet.uu.net
- Responding-System: alice.att.com
-
- In article <1992Dec23.150031.5068@spdcc.com> rdonahue@spdcc.com (Bob Donahue) writes:
- >
- > [...] I have set up several macros to keep track of
- > figures, tables, etc. for my thesis, e.g.:
- >
- > .\" tX ----- TABLE CAPTION
- > .de tX
- > 'tm T|\\n%|\\n(cC.\\n+(tT|\\$1|
- > ..
- >
- > which pumps out things to stderr, and lets me keep track of the the
- > table/figure number, etc. auto-magically. Cool.
- >
- > However, I also keep my tables and figures in floating keeps.
- >
- > I realized yesterday that the \\%n register records the
- > page groff was on when the keep is FIRST ENCOUNTERED, and not the
- > page where the KEEP is finally executed! Therefore, any contents
- > page I generate from this output is nearly always wrong (usually
- > of by 1, sometimes 2 rarely is it correct).
- >
-
- In general, floating keeps use diversions. When they don't fit, the
- keep is rediverted. Because of this, one should not do the .tm
- directly, but hold off and do the .tm when the diversion is actually
- printed.
-
- Having this in mind, the next macros does what you want: If not in a
- diversion, do the .tm; else, we call ourselves again. Applying this
- method to your original macro one gets something like:
-
- .de Tx
- .ie '\\n(.z'' T|\\n%|(cC.\\n(+(tT|\\$1|
- .el \\!.Tx \\$1
- ..
-
- Enjoy!
-
- jaap
-