troff
GNU roff typesetting processor
TLDR
Format a document using the man macro package
SYNOPSIS
troff [-abcivzCERU] [-d cs] [-f fam] [-F dir] [-m name] [-n num] [-o list] [-r cn] [-T name] [-w name] [file ...]
DESCRIPTION
troff is the typesetting processor of the groff (GNU roff) text formatting system. It reads text files containing formatting commands and produces formatted output for various devices including PostScript, PDF, and terminals.
troff is usually invoked through groff, which handles preprocessors (tbl, eqn, pic) and postprocessors automatically. Macro packages provide high-level formatting: man for manual pages, ms for general documents, mom for complex documents.
The groff implementation extends traditional Unix troff with color support, additional escape sequences, and improved compatibility features while maintaining backward compatibility.
PARAMETERS
-a
Generate ASCII approximation of typeset output.-b
Print backtrace with each warning or error message.-c
Disable color output.-C
Enable compatibility mode with traditional troff.-d cs
Define string c as s.-f fam
Set default font family.-F dir
Search directory for font files.-i
Read standard input after processing files.-m name
Include macro package (e.g., man, ms, me, mom).-n num
Number first page as num.-o list
Output only pages in list.-r cn
Set register c to value n.-T name
Prepare output for device name (default: ps).-U
Enable unsafe mode (allows dangerous requests).-v
Print version number.-w name
Enable warning name. Use -w all for most warnings.-W name
Disable warning name.
CAVEATS
Direct use of troff is uncommon; groff is the preferred wrapper that handles the complete processing pipeline. The -U unsafe mode should be avoided unless necessary as it enables potentially dangerous file operations. Compatibility mode (-C) may be needed for older documents.
HISTORY
The original troff was written by Joe Ossanna at Bell Labs in 1973 as part of Unix, evolving from the earlier runoff formatter. After Ossanna's death in 1977, Brian Kernighan rewrote and maintained troff. GNU troff (groff) was developed by James Clark starting in 1989 as a free software replacement, and is now maintained by the groff project as part of the GNU system.
