16. PreprocessorsThis section is divided into the following three subsections, each covering a different preprocessor of the nroff/troff formatting system:
Each of these preprocessors translates code into nroff/troff requests and escape sequences, which run independently of the formatter. Usually, one or more of these preprocessors are invoked as part of a command pipeline to format a file:
% On multi-user systems, it is typical to have a general-purpose shell script for formatting. You would then select various command-line options to specify which (if any) preprocessors to include in your particular format command. But you can also invoke the preprocessors individually. This is useful for confirming that syntax is correct or for determining where it fails. For example, the command:
% takes input between each .TS/.TE macro pair and converts it into tbl code. All other input is passed to output unchanged. 16.1 TblTbl is a preprocessor for formatting tables in nroff/troff. When used in a command pipeline, tbl should precede eqn. This makes output processing more efficient. Tbl has the following command-line syntax:
16.1.1 General Coding SchemeIn a text file, coding for tbl might look like this:
Successful processing of a table by tbl depends largely on
the header lines, which consist of one line listing the options and
one or more format lines. Each field of the table input must be
separated by a tab or designated tab symbol, with each row typed
entirely on a single line unless a field is enclosed by the text block symbols
16.1.2 Tbl Macros
16.1.3 OptionsOptions affect the entire table. Options can be separated by commas or spaces, but the line must end with a semicolon.
16.1.4 Format
The format line affects the layout of individual columns and rows of
the table. Each line contains a key letter for each column of the
table. The column entries should be separated by spaces, and the
format section must end with a period. Each line of format corresponds
to one line of the table, except for the last, which corresponds to all
following lines up to the next 16.1.4.1 Key Letters
16.1.4.2 Key ModifiersThese must follow a key letter.
16.1.5 DataThe data portion includes both the heading and text of the table. Each table entry must be separated by a tab symbol.
16.1.6 A Tbl ExampleInput:
.TS center box linesize(6) tab(@); cb s s. Horizontal Local Motions _ .T& ci | ci s ci | ci s ci | ci | ci c | l s. Function@Effect in \^@_ \^@troff@nroff _ \eh'n'@Move distance N \e(space)@Unpaddable space-size space \e0@Digit-size space _ .T& c | l | l. \e|@1/6 em space@ignored \e^@1/12 em space@ignored .TE Result:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|