home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / text / 1503 < prev    next >
Encoding:
Internet Message Format  |  1992-12-29  |  1.8 KB

  1. Xref: sparky comp.text:1503 gnu.groff.bug:282
  2. Path: sparky!uunet!crdgw1!rpi!think.com!mintaka.lcs.mit.edu!ai-lab!prep.ai.mit.edu!gnulists
  3. From: jaap@alice.att.com (jaap)
  4. Newsgroups: comp.text,gnu.groff.bug
  5. Subject: Re: Annoying ?roff-ism
  6. Message-ID: <24497@alice.att.com>
  7. Date: 28 Dec 92 16:24:44 GMT
  8. References: <1992Dec23.150031.5068@spdcc.com>
  9. Reply-To: jaap@alice.UUCP ()
  10. Followup-To: comp.text,gnu.groff.bug
  11. Organization: AT&T, Bell Labs
  12. Lines: 39
  13. Approved: info-gnu@prep.ai.mit.edu
  14. To: uunet!gnu-groff-bug@uunet.uu.net
  15. Responding-System: alice.att.com
  16.  
  17. In article <1992Dec23.150031.5068@spdcc.com> rdonahue@spdcc.com (Bob Donahue) writes:
  18.  > 
  19.  > [...] I have set up several macros to keep track of
  20.  > figures, tables, etc. for my thesis, e.g.:
  21.  > 
  22.  > .\"  tX ----- TABLE CAPTION
  23.  > .de tX
  24.  > 'tm T|\\n%|\\n(cC.\\n+(tT|\\$1|
  25.  > ..
  26.  > 
  27.  > which pumps out things to stderr, and lets me keep track of the the
  28.  > table/figure number, etc. auto-magically.  Cool.
  29.  > 
  30.  >     However, I also keep my tables and figures in floating keeps.
  31.  > 
  32.  >     I realized yesterday that the \\%n register records the
  33.  > page groff was on when the keep is FIRST ENCOUNTERED, and not the
  34.  > page where the KEEP is finally executed!  Therefore, any contents
  35.  > page I generate from this output is nearly always wrong (usually
  36.  > of by 1, sometimes 2 rarely is it correct).
  37.  > 
  38.  
  39. In general, floating keeps use diversions.  When they don't fit, the
  40. keep is rediverted.  Because of this, one should not do the .tm
  41. directly, but hold off and do the .tm when the diversion is actually
  42. printed.
  43.  
  44. Having this in mind, the next macros does what you want:  If not in a
  45. diversion, do the .tm; else, we call ourselves again.  Applying this
  46. method to your original macro one gets something like:
  47.  
  48.     .de Tx
  49.     .ie '\\n(.z'' T|\\n%|(cC.\\n(+(tT|\\$1|
  50.     .el \\!.Tx \\$1
  51.     ..
  52.  
  53. Enjoy!
  54.  
  55.     jaap
  56.