troff - the troff processor of the groff text formatting system
This manual page describes the GNU version of troff
. It is part of the
groff document formatting system. It is functionally compatible with Unix
troff, but has many extensions, see groff_diff(7)
. Usually it should be
invoked using the groff(1)
command which will also run preprocessors
and postprocessors in the appropriate order and with the appropriate options.
Whitespace is permitted between a command-line option and its argument.
- Generate an ASCII approximation of the typeset output.
- Print a backtrace with each warning or error message. This
backtrace should help track down the cause of the error. The line numbers
given in the backtrace may not always be correct, for troff's idea
of line numbers gets confused by as or am requests.
- Disable color output (always disabled in compatibility
- Enable compatibility mode.
-dname=s Define c or
name to be a string s; c must be a one letter
- Inhibit all error messages of troff. Note that this
doesn't affect messages output to standard error by macro packages using
the tm or tm1 requests.
- Use fam as the default font family.
- Search in directory (or directory path) dir for
subdirectories devname (name is the name of the device) and
there for the DESC file and font files. dir is scanned
before all other font directories.
- Read the standard input after all the named input files
have been processed.
- This option may be used to add a directory to the search
path for files (both those on the command line and those named in
.psbb requests). The search path is initialized with the current
directory. This option may be specified more than once; the directories
are then searched in the order specified (but before the current
directory). If you want to make the current directory be read before other
directories, add -I. at the appropriate place.
- No directory search is performed for files with an absolute
- Read in the file name.tmac. If it isn't found, try
tmac.name instead. It will be first searched for in directories
given with the -M command-line option, then in directories given in
the GROFF_TMAC_PATH environment variable, then in the current
directory (only if in unsafe mode), the home directory,
/usr/lib/groff/site-tmac, /usr/share/groff/site-tmac, and
- Search directory (or directory path) dir for macro
files. This is scanned before all other macro directories.
- Number the first page num.
- Output only pages in list, which is a
comma-separated list of page ranges; n means print page n,
m-n means print every page between m and
n, -n means print every page up to n,
n- means print every page from n. troff will
exit after printing the last page in the list.
-rname=n Set number register
c or name to n; c must be a one character
name; n can be any troff numeric expression.
- Don't load troffrc and troffrc-end.
- Prepare output for device name, rather than the
default ps; see groff(1) for a more detailed
- Unsafe mode. This will enable the following requests:
open, opena, pso, sy, and pi. For
security reasons, these potentially dangerous requests are disabled
otherwise. It will also add the current directory to the macro search
- Print the version number.
- Enable warning name. Available warnings are
described in section “Warnings” below. To enable most useful
warnings use -w all. To enable absolutely all warnings use
-w w instead. Multiple -w options are allowed.
- Inhibit warning name. Multiple -W options are
- Suppress formatted output.
The warnings that can be given by troff
are divided into the following
categories. The name associated with each warning is used by the -w
options; the number is used by the warn
request, and by the
register; it is always a power of 2 to allow bitwise composition.
- In fill mode, lines which could not be broken so that their
length was less than the line length. This is enabled by default.
- Non-existent characters. This is enabled by default.
- Color-related warnings.
- Missing or mismatched closing delimiters.
- Use of di or da without an argument when
there is no current diversion.
- Use of the el request with no matching ie
- Unrecognized escape sequences. When an unrecognized escape
sequence is encountered, the escape character is ignored.
- Indicates a missing file for the mso request.
Enabled by default.
- Non-existent fonts. This is enabled by default.
- Invalid escapes in text ignored with the ig request.
These are conditions that are errors when they do not occur in ignored
- Invalid input characters.
- Use of undefined strings, macros and diversions. When an
undefined string, macro or diversion is used, that string is automatically
defined as empty. So, in most cases, at most one warning will be given for
- Requests that are missing non-optional arguments.
- Invalid numeric expressions. This is enabled by
- Out of range arguments.
- Use of undefined number registers. When an undefined number
register is used, that register is automatically defined to have a value
of 0. So, in most cases, at most one warning will be given for use
of a particular name.
- Use of \} where a number was expected.
- Meaningless scaling indicators.
- Missing space between a request or macro and its argument.
This warning will be given when an undefined name longer than two
characters is encountered, and the first two characters of the name make a
defined name. The request or macro will not be invoked. When this warning
is given, no macro is automatically defined. This is enabled by default.
This warning will never occur in compatibility mode.
- Dubious syntax in numeric expressions.
- Inappropriate use of a tab character. Either use of a tab
character where a number was expected, or use of tab character in an
unquoted macro argument.
There are also names that can be used to refer to groups of warnings:
- All warnings except di, mac, and reg.
It is intended that this covers all warnings that are useful with
traditional macro packages.
- All warnings.
- A colon separated list of directories in which to search
for macro files. troff will scan directories given in the -M
option before these, and in standard directories (current directory if in
unsafe mode, home directory, /usr/lib/groff/site-tmac,
- Default device.
- A colon separated list of directories in which to search
for the devname directory. troff will scan directories given
in the -F option before these, and in standard directories
/usr/lib/font) after these.
- Initialization file (called before any other macro
- Initialization file (called after any other macro
- Device description file for device name.
- Font file for font F of device name.
Note that troffrc
are searched for neither in the
current nor the home directory by default for security reasons (even if the
option is given). Use the -M
command-line option or the
environment variable to add these directories to the
search path if necessary.
The GNU version of troff
was originally written by James Clark; he also
wrote the original version of this document, which was modified by
- The main program of the groff system, a wrapper
- A description of the groff language, including a
short but complete reference of all predefined requests, registers, and
escapes of plain groff. From the command line, this is called
- The differences of the groff language and the
classical troff language. Currently, this is the most actual
document of the groff system.
Groff: The GNU Implementation of troff
- An overview over groff and other roff
systems, including pointers to further related documentation.
, by Trent A. Fisher and Werner
Lemberg, is the primary groff
manual. You can browse it interactively
with “info groff”.