troff(1) General Commands Manual troff(1)
troff - GNU troff document formatter
troff [-abcizCERU] [-d cs] [-f fam] [-F dir] [-I dir] [-m name] [-M dir] [-n num] [-o list] [-r cn] [-T name] [-w name] [-W name] [file ...] troff --help troff -v troff --version
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.
-a Generate a plain text approximation of the typeset output. The read-only register .A is set to 1. This option produces a sort of abstract preview of the formatted output. • Page breaks are marked by a phrase in angle brackets; for example, “<beginning of page>”. • Lines are broken where they would be in the formatted output. • A horizontal motion of any size is represented as one space. Adjacent horizontal motions are not combined. Inter-sentence space nodes (those arising from the second argument to the .ss request) are not represented. • Vertical motions are not represented. • Special characters are rendered in angle brackets; for example, the default soft hyphen character appears as “<hy>”. The above description should not be considered a specification; the details of -a output are subject to change. -b 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. -c Disable color output; also disable SGR escape output to grotty(1) devices. -C Enable compatibility mode; implies -c. -dcs -dname=s Define c or name to be a string s; c must be a one letter name. -E Inhibit troff error messages; implies -Ww. Note that this doesn't suppress messages sent to the standard error stream by documents or macro packages using .tm or related requests. -ffam Use fam as the default font family. -Fdir Search in directory dir for the selected output device's directory of device and font description files. See the description of GROFF_FONT_PATH in section “Environment” below for the default search locations and ordering. -i Read the standard input after all the named input files have been processed. -I dir Search dir for input files (those on the command line, those named in .psbb, .so, and .soquiet requests, and those named in “\X'ps: import'”, “\X'ps: file'”, and “\X'pdf: pdfpic'” escapes). This option may be specified more than once; the directories are then searched in the order specified. If you want to search the current directory before others, add “-I .” at the appropriate place. The current working directory is otherwise searched last. -I works similarly to, and is named for, the “include” option of Unix C compilers. No directory search is performed for files specified using an absolute file name. -mname Process name.tmac before any input files. If name.tmac is not found, tmac.name is attempted. name (in both arrangements) is presumed to be a macro file; see the description of GROFF_TMAC_PATH in section “Environment” below for the default search locations and ordering. -Mdir Search directory dir for macro files. See the description of GROFF_TMAC_PATH in section “Environment” below for the default search locations and ordering. -nnum Number the first page num. -olist 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. -rcn -rname=n Set number register c or name to n; c must be a one character name; n can be any roff numeric expression. -R Don't load troffrc and troffrc-end. -Tname Prepare output for device name, rather than the default “ps”; see groff(1) for a more detailed description. -U Operate in unsafe mode, which enables the .open, .opena, .pi, .pso, and .sy requests. These requests are disabled by default because they allow an untrusted input document to write to arbitrary file names and run arbitrary commands. This option also adds the current directory to the macro search path; see the -m option above. -wname 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. -Wname Inhibit warning name. Multiple -W options are allowed. -z 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 and -W options; the number is used by the warn request, and by the .warn register; it is always a power of 2 to allow bitwise composition. ┌─────────────────────┬─────────────────────────────┐ │Bit Code Warning │ Bit Code Warning │ ├─────────────────────┼─────────────────────────────┤ │ 0 1 char │ 10 1024 reg │ │ 1 2 number │ 11 2048 tab │ │ 2 4 break │ 12 4096 right-brace │ │ 3 8 delim │ 13 8192 missing │ │ 4 16 el │ 14 16384 input │ │ 5 32 scale │ 15 32768 escape │ │ 6 64 range │ 16 65536 space │ │ 7 128 syntax │ 17 131072 font │ │ 8 256 di │ 18 262144 ig │ │ 9 512 mac │ 19 524288 color │ │ │ 20 1048576 file │ └─────────────────────┴─────────────────────────────┘ break 4 When filling is enabled, a line could not be broken such that its length was less than the output line length \n[.l]. This is enabled by default. char 1 Non-existent characters. This is enabled by default. color 524288 Color-related warnings. delim 8 Missing or mismatched closing delimiters. di 256 Use of di or da without an argument when there is no current diversion. el 16 Use of the el request with no matching ie request. escape 32768 Unrecognized escape sequences. When an unrecognized escape sequence is encountered, the escape character is ignored. file 1048576 Indicates a missing file for the mso request. Enabled by default. font 131072 Non-existent fonts. This is enabled by default. ig 262144 Invalid escapes in text ignored with the ig request. These are conditions that are errors when they do not occur in ignored text. input 16384 Invalid input characters. mac 512 An undefined string, macro, diversion, or box was used. When such an object is dereferenced, an empty object of that name is automatically created. So, in most cases, at most one warning is given for each name. This warning is also emitted upon an attempt to move an unplanted trap. In such cases, the unplanted macro is not dereferenced, so it is not created if it does not exist. missing 8192 Requests that are missing non-optional arguments. number 2 Invalid numeric expressions. This is enabled by default. range 64 Out of range arguments. reg 1024 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. right-brace 4096 Use of \} where a number was expected. scale 32 Meaningless scaling indicators. space 65536 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. syntax 128 Invalid syntax. tab 2048 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 All warnings except di, mac, and reg. It is intended that this covers all warnings that are useful with traditional macro packages. w All warnings.
GROFF_FONT_PATH and GROFF_TMAC_PATH each accept a search path of directories; that is, a list of directory names separated by the system's path component separator character. On Unix systems, this character is a colon (:); on Windows systems, it is a semicolon (;). GROFF_FONT_PATH A list of directories in which to seek the selected output device's directory of device and font description files. troff will scan directories given as arguments to any specified -F options before these, then in a site-specific directory (/usr/local/share/groff/site-font), a standard location (/usr/local/share/groff/1.23.0/font), and a compatibility directory (/usr/lib/font) after them. GROFF_TMAC_PATH A list of directories in which to search for macro files. troff will scan directories given as arguments to any specified -M options before these, then the current directory (only if in unsafe mode), the user's home directory, a platform-specific directory (/usr/local/lib/ groff/site-tmac), a site-specific directory (/usr/local/ share/groff/site-tmac), and a standard location (/usr/ local/share/groff/1.23.0/tmac) after them. GROFF_TYPESETTER Default output device. SOURCE_DATE_EPOCH A timestamp (expressed as seconds since the Unix epoch) to use as the creation timestamp in place of the current time. The time is converted to human-readable form using ctime(3) when the formatter starts up and stored in registers usable by documents and macro packages. TZ The timezone to use when converting the current time (or value of SOURCE_DATE_EPOCH) to human-readable form; see tzset(3).
/usr/local/share/groff/1.23.0/tmac/troffrc Initialization file (called before any other macro package). /usr/local/share/groff/1.23.0/tmac/troffrc-end Initialization file (called after any other macro package). /usr/local/share/groff/1.23.0/tmac/name.tmac /usr/local/share/groff/1.23.0/tmac/tmac.name Macro files /usr/local/share/groff/1.23.0/font/devname/DESC Device description file for device name. /usr/local/share/groff/1.23.0/font/devname/F Font file for font F of device name. Note that troffrc and troffrc-end are searched for neither in the current nor the home directory by default for security reasons (even if the -U option is given). Use the -M command-line option or the GROFF_TMAC_PATH 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 Werner Lemberg ⟨email@example.com⟩ and Bernd Warken ⟨firstname.lastname@example.org⟩.
groff(1) The main program of the groff system, a wrapper around troff. groff(7) 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 by man 7 groff groff_diff(7) The differences of the groff language and the classical troff language. Currently, this is the most actual document of the groff system. roff(7) An overview over groff and other roff systems, including pointers to further related documentation. Groff: The GNU Implementation of troff, by Trent A. Fisher and Werner Lemberg, is the primary groff manual. You can browse it interactively with “info groff”.
This page is part of the groff (GNU troff) project. Information about the project can be found at ⟨http://www.gnu.org/software/groff/⟩. If you have a bug report for this manual page, see ⟨http://www.gnu.org/software/groff/⟩. This page was obtained from the project's upstream Git repository ⟨https://git.savannah.gnu.org/git/groff.git⟩ on 2021-06-20. (At that time, the date of the most recent commit that was found in the repository was 2021-06-17.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to email@example.com groff 1.23.0.rc1.654-4e1db-dirt1y6 June 2021 troff(1)
Pages that refer to this page: colcrt(1), groffer(1), grops(1), man(1), zsoelim(1), groff_out(5), groff_char(7), groff_trace(7), roff(7)