Using the `tbl` Command (with examples)
Use Case 1: Process input with tables, saving the output for future typesetting with groff to PostScript
tbl path/to/input_file > path/to/output.roff
Motivation: This use case is useful when you have a file containing tables that need to be processed before being typeset with groff to PostScript. The tbl
command acts as a preprocessor for the groff document formatting system, allowing you to transform the tables into a format suitable for typesetting.
Explanation: In this example, the tbl
command is given the path to an input file that contains tables (path/to/input_file
). The output of the tbl
command is then redirected to a file (path/to/output.roff
). The file format .roff
is commonly used for storing groff input.
Example Output: The output file (path/to/output.roff
) will contain the processed tables in a format suitable for typesetting with groff. It can be later used as input for groff to produce a PostScript file.
Use Case 2: Typeset input with tables to PDF using the [me] macro package
tbl -T pdf path/to/input.tbl | groff -me -T pdf > path/to/output.pdf
Motivation: This use case is helpful when you want to typeset tables contained in an input file directly to PDF format, using the [me] macro package for groff. The tbl
command is used to preprocess the tables, and groff
handles the typesetting process.
Explanation: In this example, the tbl
command is invoked with the -T pdf
option to specify the desired output format as PDF. The path to the input file containing the tables is provided (path/to/input.tbl
). The output of tbl
is then piped (|
) to groff
, which is invoked with the -me
option to specify the [me] macro package for typesetting. The -T pdf
option is used to set the output format of groff
to PDF. Finally, the output PDF file is redirected (>
) to a specified path (path/to/output.pdf
).
Example Output: The resultant path/to/output.pdf
file will contain the typeset tables in PDF format based on the input provided. The tables will be formatted according to the rules specified in the [me] macro package used by groff.
In this article, we explored two different use cases of the tbl
command. The first use case demonstrated how to process input files with tables and save the output for future typesetting with groff to PostScript. The second use case showed how to directly typeset tables to PDF format using the [me] macro package. The tbl
command acts as a preprocessor for the tables, while groff
handles the final typesetting process. These examples highlight the versatility of the tbl
command in creating properly formatted and typeset tables for various purposes.