4.6.5.9 Tables, figures, equations, and references

ms often sees use with the tbl, pic, eqn, and refer preprocessors. Mark text meant for preprocessors by enclosing it in pairs of tokens as follows, with nothing between the dot and the macro name. Preprocessors match these tokens only at the start of an input line. troff interprets them as macro calls.

Macro: .TS [H]
Macro: .TE

Demarcate a table to be processed by the tbl preprocessor. The optional argument H to TS instructs ms to repeat table rows (often column headings) at the top of each new page the table spans, if applicable; calling the TH macro marks the end of such rows. The GNU tbl(1) man page provides a comprehensive reference to the preprocessor and offers examples of its use.

Macro: .PS h v
Macro: .PE
Macro: .PF

PS begins a picture to be processed by the gpic preprocessor; either of PE or PF ends it, the latter with “flyback” to the vertical position at its top. Create pic input manually or with a program such as xfig. h and v are the horizontal and vertical dimensions of the picture; gpic supplies them automatically.

Macro: .EQ [align [label]]
Macro: .EN

Demarcate an equation to be processed by the eqn preprocessor. The equation is centered by default; align can be ‘C’, ‘L’, or ‘I’ to (explicitly) center, left-align, or indent it by the amount stored in the DI register, respectively. If specified, label is set right-aligned.

Macro: .[
Macro: .]

Demarcate a bibliographic citation to be processed by the refer preprocessor. grefer(1) provides a comprehensive reference to the preprocessor and the format of its bibliographic database.

When refer emits collected references (as might be done on a “Works Cited” page), it interpolates the REFERENCES string as an unnumbered heading (SH).

The following is an example of how to set up a table that may print across two or more pages.

.TS H
allbox;
Cb | Cb .
Part→Description
_
.TH
.T&
GH-1978→Fribulating gonkulator
...the rest of the table follows...
.TE

Attempting to place a multi-page table inside a keep can lead to unpleasant results, particularly if the tbl allbox option is used.

Mathematics can be typeset using the language of the eqn preprocessor.

.EQ C (\*[SN-NO-DOT]a)
p ~ = ~ q sqrt { ( 1 + ~ ( x / q sup 2 ) }
.EN

This input formats a labelled equation. We used the SN-NO-DOT string to base the equation label on the current heading number, giving us more flexibility to reorganize the document.

Create diagrams with gpic.

.PS
circle "input";
arrow;
box width 1.5i "\f[CR]groff -Rept -ms\f[]";
arrow;
circle "output";
.PE

groff options run preprocessors on the input: -e for geqn, -p for gpic, -R for grefer, and -t for gtbl.