# troff

## Name



           troff - GNU _roff_ typesetter and document formatter
    


## Synopsis



           **troff**[**-abcCEiRUz**] [**-d** _ctext_] [**-d** _string_**=**_text_] [**-f** _font-family_]
                 [**-F** _font-directory_] [**-I** _inclusion-directory_] [**-m** _macro-_
                 _package_] [**-M** _macro-directory_] [**-n** _page-number_] [**-o** _page-_
                 _list_] [**-r** _cnumeric-expression_] [**-r** _register_**=**_numeric-_
                 _expression_] [**-T** _output-device_] [**-w** _warning-category_]
                 [**-W** _warning-category_] [_file_ ...]
    
           **troff --help**
    
           **troff -v**
    
           **troff --version**
    


## Description



           GNU _troff_ transforms _groff_(7) language input into the device-
           independent page description language detailed in _groff_out_(5);
           _troff_ is thus the heart of the GNU _roff_ document formatting
           system.  If no _file_ operands are present, or if _file_ is “**-** ”, _troff_
           reads the standard input stream.
    
           GNU _troff_ is functionally compatible with the AT&T _troff_
           typesetter and features numerous extensions.  Many people prefer
           to use the _groff_(1) command, a front end which also runs
           preprocessors and output drivers in the appropriate order and with
           appropriate options.
    


## Options



           **-h** and **--help** display a usage message, while **-v** and **--version** show
           version information; all exit afterward.
    
           **-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 formatted
                     output.
    
                  •  Vertical motion, apart from that implied by a break, is
                     not represented.
    
                  •  A horizontal motion of any size is represented as one
                     space.  Adjacent horizontal motions are not combined.
                     Supplemental inter-sentence space (configured by the
                     second argument to the **.ss** request) is not represented.
    
                  •  A special character is rendered as its identifier
                     between angle brackets; for example, a hyphen appears as
                     “<hy>”.
    
                  The above description should not be considered a
                  specification; the details of **-a** output are subject to
                  change.
    
           **-b** Write a backtrace reporting the state of _troff_ 's input
                  parser to the standard error stream with each diagnostic
                  message.  The line numbers given in the backtrace might not
                  always be correct, because _troff_ 's idea of line numbers can
                  be confused by requests that append to macros.
    
           **-c** Start with color output disabled.
    
           **-C** Enable AT&T _troff_ compatibility mode; implies **-c**.  See
                  _groff_diff_(7).
    
           **-d** _ctext_
           **-d** _string_**=**_text_
                  Define _roff_ string _c_ or _string_ as _text._  _c_ must be a one-
                  character identifier; _string_ can be of arbitrary length.
                  Such assignments happen before any macro file is loaded,
                  including the startup file.  Due to _getopt_long_(3)
                  limitations, _c_ cannot be, and _string_ cannot contain, an
                  equals sign, even though that is a valid character in a
                  _roff_ identifier.
    
           **-E** Inhibit _troff_ error messages; implies **-Ww**.  This option
                  does _not_ suppress messages sent to the standard error
                  stream by documents or macro packages using **tm** or related
                  requests.
    
           **-f** _fam_ Use _fam_ as the default font family.
    
           **-F** _dir_ 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 stream after all named input files
                  have been processed.
    
           **-I** _dir_ Search the directory _dir_ for files (those named on the
                  command line; in **psbb** , **so** , and **soquiet** requests; and in
                  “**\X'ps: import'** ”, “**\X'ps: file'** ”, and “**\X'pdf: pdfpic'** ”
                  device extension escape sequences).  **-I** may be specified
                  more than once; each _dir_ is searched in the given order.
                  To search the current working directory before others, add
                  “**-I .** ” at the desired place; it is otherwise searched last.
                  **-I** works similarly to, and is named for, the “include”
                  option of Unix C compilers.
    
           **-m** _mac_ Search for the macro package mac _.tmac_ and read it prior to
                  any input.  If not found, _tmac._ mac is attempted.  See the
                  description of _GROFF_TMAC_PATH_ in section “Environment”
                  below for the default search locations and ordering.
    
           **-M** _dir_ Search directory _dir_ for macro files.  See the description
                  of _GROFF_TMAC_PATH_ in section “Environment” below for the
                  default search locations and ordering.
    
           **-n** _num_ Begin numbering pages at _num._  The default is **1**.
    
           **-o** _list_
                  Output only pages in _list,_ which is a comma-separated list
                  of inclusive page ranges; _n_ means page _n, m_**-**_n_ means every
                  page between _m_ and _n_ , **-**_n_ means every page up to _n_ , and _n_**-**
                  means every page from _n_ on.  _troff_ stops processing and
                  exits after formatting the last page enumerated in _list._
    
           **-r** _cnumeric-expression_
           **-r** _register_**=**_numeric-expression_
                  Define _roff_ register _c_ or _register_ as _numeric-expression._
                  _c_ must be a one-character identifier; _register_ can be of
                  arbitrary length.  Such assignments happen before any macro
                  file is loaded, including the startup file.  Due to
                  _getopt_long_(3) limitations, _c_ cannot be, and _register_
                  cannot contain, an equals sign, even though that is a valid
                  character in a _roff_ identifier.
    
           **-R** Don't load _troffrc_ and _troffrc-end_.
    
           **-T** _dev_ Prepare output for device _dev._  The default is **ps** ; see
                  _groff_(1).
    
           **-U** Operate in _unsafe mode,_ enabling the **cf** , **open** , **opena** , **pi** ,
                  **pso** , and **sy** requests, which are disabled by default because
                  they allow an untrusted input document to run arbitrary
                  commands and write to arbitrary file names.  (GNU _troff_
                  does not, however, accept newlines (line feeds) in file
                  names supplied as arguments to requests.)  This option also
                  adds the current directory to the macro package search
                  path; see the **-m** and **-M** options above.
    
           **-w** _cat_
           **-W** _cat_ Enable and inhibit, respectively, warnings in category _cat._
                  See section “Warnings” below.
    
           **-z** Suppress formatted output.
    


## Warnings



           GNU _troff_ divides its warning diagnostics into named, numbered
           categories.  The **-w** and **-W** options use the associated names.  A
           power of two characterizes each category; the **warn** request and the
           **.warn** register respectively set and report the sum of enabled
           category codes.  Warnings of each category are produced under the
           following circumstances.
    
                ┌───────────────────────┬─────────────────────────────┐
                │ Bit   Code   Category │ Bit    Code      Category   │
                ├───────────────────────┼─────────────────────────────┤
                │   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_   _unused_   │  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   A filled output line could not be broken such
                               that its length was less than or equal to, or
                               adjusted such that its length was exactly
                               equal to, the output line length “**\n[.l]** ”.
                               GNU _troff_ reports the amount of overset or
                               underset in the scaling unit configured by the
                               **warnscale** request in **troff** mode, and in ens
                               (‘**n** ’; character cells) in **nroff** mode.  This
                               category is enabled by default.
    
           **char** 1   No user-defined character of the requested
                               name or index exists and no mounted font
                               defines a glyph for it, or input could not be
                               encoded for device-independent output.  This
                               category is enabled by default.
    
           **color** 524288   An undefined color name was selected, an
                               attempt was made to define a color using an
                               unrecognized color space, an invalid component
                               in a color definition was encountered, or an
                               attempt was made to redefine a default color.
    
           **delim** 8   The selected delimiter character was ambiguous
                               because it is also meaningful when beginning a
                               numeric expression, or the closing delimiter
                               in an escape sequence was missing or
                               mismatched.
    
                               A future _groff_ release may reject ambiguous
                               delimiters.  In compatibility mode, ambiguous
                               delimiters are accepted without warning.
    
           **di** 256   A **di** , **da** , **box** , or **boxa** request was invoked
                               without an argument when there was no current
                               diversion.
    
           **escape** 32768   An unsupported escape sequence was
                               encountered.
    
           **file** 1048576   An attempt was made to load a file that does
                               not exist, or a stream remained open at
                               formatter exit.  This category is enabled by
                               default.
    
           **font** 131072   A non-existent font was selected, or the
                               selection was ignored because a font selection
                               escape sequence was used after the output line
                               continuation escape sequence on an input line.
                               This category is enabled by default.
    
           **ig** 262144   An invalid escape sequence occurred in input
                               ignored using the **ig** request.  This warning
                               category diagnoses a condition that is an
                               error when it occurs in non-ignored input.
    
           **input** 16384   An invalid character occurred on the input
                               stream.
    
           **mac** 512   An undefined string, macro, or diversion was
                               used.  When such an object is dereferenced, an
                               empty one of that name is automatically
                               created.  So, unless it is later deleted, at
                               most one warning is given for each.
    
                               _troff_ also uses this category to warn of an
                               attempt to move an unplanted trap macro.  In
                               such cases, the unplanted macro is _not_
                               dereferenced, so it is not created if it does
                               not exist.
    
           **missing** 8192   A request was invoked with a mandatory
                               argument absent.
    
           **number** 2   An invalid numeric expression was encountered.
                               This category is enabled by default.
    
           **range** 64   A numeric expression was out of range for its
                               context.
    
           **reg** 1024   An undefined register was used.  When an
                               undefined register is dereferenced, it is
                               automatically defined with a value of 0.  So,
                               unless it is later deleted, at most one
                               warning is given for each.
    
           **right-brace** 4096   A right brace escape sequence **\}** was
                               encountered where a number was expected.
    
           **scale** 32   A scaling unit inappropriate to its context
                               was used in a numeric expression.
    
           **space** 65536   A space was missing between a request or macro
                               and its argument.  This warning is produced
                               when an undefined name longer than two
                               characters is encountered and the first two
                               characters of the name constitute a defined
                               name.  No request is invoked, no macro called,
                               and an empty macro is not defined.  This
                               category is enabled by default.  It never
                               occurs in compatibility mode.
    
           **syntax** 128   A self-contradictory hyphenation mode or
                               character flags were requested; an empty or
                               incomplete numeric expression was encountered;
                               an operand to a numeric operator was missing;
                               a recognized but inapposite escape sequence or
                               unprintable character code was used in a
                               device extension command; an attempt was made
                               to define a recursive, empty, or nonsensical
                               character class; or a _groff_ extension
                               conditional expression operator was used while
                               in compatibility mode.
    
           **tab** 2048   A tab character was encountered where a number
                               was expected, or appeared in an unquoted macro
                               argument.
    
           Two warning names group other warning categories for convenience.
    
           **all** All warning categories except **di** , **mac** , and **reg**.  This
                  shorthand is intended to produce all warnings that are
                  useful with macro packages and documents written for AT&T
                  _troff_ and its descendants, which have less fastidious
                  diagnostics than GNU _troff_.
    
           **w** All warning categories.  Authors of documents and macro
                  packages targeting _groff_ are encouraged to use this
                  setting.
    


## Exit status



           _troff_ exits with status **0** on successful operation, status **2** if the
           program cannot interpret its command-line arguments, and status **1**
           if it encounters a fatal error during operation, or is directed to
           abort by the input.
    


## Environment



           _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 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_
                  Set the default output device.  If empty or not set, **ps** is
                  used.  The **-T** option overrides _GROFF_TYPESETTER_.
    
           _SOURCE_DATE_EPOCH_
                  A timestamp (expressed as seconds since the Unix epoch) to
                  use as the output creation timestamp in place of the
                  current time.  The time is converted to human-readable form
                  using _gmtime_(3) and _asctime_(3) when the formatter starts up
                  and stored in registers usable by documents and macro
                  packages.
    
           _TZ_     The time zone to use when converting the current time to
                  human-readable form; see _tzset_(3).  If _SOURCE_DATE_EPOCH_ is
                  used, it is always converted to human-readable form using
                  UTC.
    


## Files



           _/usr/local/share/groff/1.23.0/tmac/troffrc_
                  is an initialization macro file loaded before any macro
                  packages specified with **-m** options.
    
           _/usr/local/share/groff/1.23.0/tmac/troffrc-end_
                  is an initialization macro file loaded after all macro
                  packages specified with **-m** options.
    
           _/usr/local/share/groff/1.23.0/tmac/_ name _.tmac_
                  are macro files distributed with _groff_.
    
           _/usr/local/share/groff/1.23.0/font/dev_ name _/DESC_
                  describes the output device _name_.
    
           _/usr/local/share/groff/1.23.0/font/dev_ name _/_ F
                  describes the font _F_ of device _name._
    
           _troffrc_ and _troffrc-end_ are sought neither in the current nor the
           home directory by default for security reasons, even if the **-U**
           option is specified.  Use the **-M** command-line option or the
           _GROFF_TMAC_PATH_ environment variable to add these directories to
           the search path if necessary.
    


## Authors



           The GNU version of _troff_ was originally written by James Clark; he
           also wrote the original version of this document, which was
           updated by Werner Lemberg ⟨wl@gnu.org⟩, Bernd Warken ⟨groff-bernd
           .warken-72@web.de⟩, and G. Branden Robinson ⟨g.branden.robinson@
           gmail.com⟩.
    


## See also



           _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”.
    
           _groff_(1)
                  offers an overview of the GNU _roff_ system and describes its
                  front end executable.
    
           _groff_(7)
                  details the _groff_ language, including a short but complete
                  reference of all predefined requests, registers, and escape
                  sequences.
    
           _groff_char_(7)
                  explains the syntax of _groff_ special character escape
                  sequences, and lists all special characters predefined by
                  the language.
    
           _groff_diff_(7)
                  enumerates the differences between AT&T device-independent
                  _troff_ and _groff_.
    
           _groff_font_(5)
                  covers the format of _groff_ device and font description
                  files.
    
           _groff_out_(5)
                  describes the format of _troff_ 's output.
    
           _groff_tmac_(5)
                  includes information about macro files that ship with
                  _groff_.
    
           _roff_(7)
                  supplies background on _roff_ systems in general, including
                  pointers to further related documentation.
    


* * *