tbl
Format tables for troff or groff
TLDR
Process input with tables, saving the output for future typesetting with groff to PostScript
Typeset input with tables to PDF using the [me] macro package
SYNOPSIS
tbl [options] [file ...]
PARAMETERS
-TX
Generate troff output that is suitable for devices that use TeX, primarily for DVI output.
-ms
Inform tbl that the ms macro package is being used. This affects certain default settings for table formatting.
-mm
Inform tbl that the mm macro package is being used, similar to -ms.
-t
Print warning messages to standard error regarding potential issues in table descriptions.
-v
Print the version number of tbl to standard error and exit.
DESCRIPTION
tbl is a specialized preprocessor designed to format tables for the groff typesetting system (or its predecessor troff). It reads input files containing table descriptions, which are delimited by .TS (Table Start) and .TE (Table End) macros. Within these delimiters, users can specify table layouts, column definitions, data, and various formatting options using a simple, intuitive syntax.
tbl then translates these high-level descriptions into a series of groff (or troff) commands that precisely control the layout, alignment, spacing, and appearance of the table. It is typically used as part of a groff pipeline, where the output of tbl is piped to groff along with other text. This allows for complex, multi-column tables to be easily embedded and formatted within roff documents, making it an essential tool for creating professional-quality documentation, manuals, and reports. Its strength lies in abstracting away the complex troff primitives required for table layout, providing a much simpler, declarative syntax.
CAVEATS
Mastering tbl's table description language can be challenging for complex or highly customized table layouts.
While powerful for text and numeric data, it does not inherently support embedding graphical elements or images directly within table cells.
Its reliance on the groff/troff ecosystem means that a full understanding of the document processing pipeline is often required for effective use and troubleshooting.
TABLE STRUCTURE AND WORKFLOW
Tables are defined within input files by placing the table description between .TS (Table Start) and .TE (Table End) macros. The lines immediately following .TS specify global table options and column formats, followed by the table data itself.
A common workflow involves piping the output of tbl to groff:
tbl document.roff | groff -mandoc > document.ps
This command first processes the tables, then formats the entire document, and finally outputs it to a PostScript file.
HISTORY
tbl originated from the original Bell Labs troff system developed by Joe F. Ossanna and later enhanced by Brian W. Kernighan. It was one of the earliest specialized preprocessors for troff, designed specifically to simplify the creation of complex tables, a task notoriously difficult with raw troff commands. Its declarative approach to table layout greatly improved productivity. It has since become a standard component of Unix-like systems, with the GNU version being maintained as part of the groff suite, ensuring its continued relevance in document formatting.