Linuxdoc Linux Questions
Click here to ask our community of linux experts!
Custom Search

6. What preprocessors may I use?

Groff comes with at least three preprocessors, tbl, eqn, and pic (on some systems they are named gtbl, geqn and gpic.) Their purpose is to translate preprocessor macros and their data to regular troff input. Tbl is a table preprocessor, eqn is an equations/maths preprocessor and pic is a picture preprocessor. Please refer to the man pages for more information on what functionality they provide. To put it in a nutshell: don't write man pages requiring any preprocessor. Eqn will generally produce terrible output for typewriter-like devices, unfortunately the type of device 99% of all man pages are viewed on (well, at least I do). For example, XAllocColor.3x uses a few formulas with exponentiation. Due to the nature of typewriter-like devices, the exponent will be on the same line as the base. N to the power of two appears as `N2'. Tbl should be avoided because all xman programs I have seen fail on them. Xman 3.1.6 uses the following command to format man pages, e.g. signal(7):

gtbl /usr/man/man7/signal.7 | geqn | gtbl | groff -Tascii -man /tmp/xmana01760 2> /dev/null

which screws up for sources using gtbl, because gtbl output is fed again into gtbl. The effect is a man page without your table. I don't know if it's a bug or a feature that gtbl chokes on its own output or if xman could be a little smarter and not use gtbl twice. Furthermore, some systems use grog to determine what options to pass to groff. Unfortunately grog sometimes guesses wrong and recommends groff -t when in fact tbl must not be used. We are basically left with two workarounds for tables:

  1. Format the table yourself manually and put it between .nf and .fi lines so that it will be left unformatted. You won't have bold and italics this way but this beats having your table swallowed any day.

  2. Use any tbl macros you like but distribute the tbl output instead of the input. There is however this quirk with grog who thinks that any file containing a line starting with .TS requires tbl. Tbl output for some reason unbeknownst to me still contains .TS and .TE. It seems you can simply remove them and have the result still look okay. YMMV, so please test this with your particular man page.

I have yet to see a man page requiring pic preprocessing. But I would not like it. As you can see above, xman will not use it and groff will certainly do the funky wadakiki on the input.