LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

troff

GNU roff typesetting processor

TLDR

Format a document using the man macro package
$ troff -man [file.1]
copy
Format with the ms macro package
$ troff -ms [file.ms]
copy
Generate ASCII output
$ troff -a [file]
copy
Print version information
$ troff -v
copy
Enable all warnings
$ troff -w all [file]
copy
Format with compatibility mode
$ troff -C [file]
copy

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.

INSTALL

sudo apt install groff-base
copy
sudo dnf install groff-base
copy
sudo pacman -S groff
copy
sudo apk add groff
copy
sudo zypper install groff
copy
brew install groff
copy
nix profile install nixpkgs#groff
copy

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.

SEE ALSO

groff(1), nroff(1), man(1), tbl(1), eqn(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid