groff normally runs the gtroff program and a postprocessor
appropriate for the selected device. The default device is ‘ps’
(but it can be changed when groff is configured and built). It
can optionally preprocess with any of gpic, geqn,
gtbl, ggrn, grap, grefer, or gsoelim.
This section only documents options to the groff front end. Many
of the arguments to groff are passed on to gtroff,
therefore those are also included. Arguments to pre- or postprocessors
can be found in Invoking gpic, Invoking geqn, Invoking gtbl, Invoking ggrn, Invoking grefer, Invoking gsoelim, Invoking grotty, Invoking grops, Invoking grohtml, Invoking grodvi, Invoking grolj4, Invoking grolbp, and Invoking gxditview.
The command line format for groff is:
groff [ -abceghilpstvzCEGNRSUVXZ ] [ -Fdir ] [ -mname ]
[ -Tdef ] [ -ffam ] [ -wname ] [ -Wname ]
[ -Mdir ] [ -dcs ] [ -rcn ] [ -nnum ]
[ -olist ] [ -Parg ] [ -Larg ] [ -Idir ]
[ files... ]
The command line format for gtroff is as follows.
gtroff [ -abcivzCERU ] [ -wname ] [ -Wname ] [ -dcs ]
[ -ffam ] [ -mname ] [ -nnum ]
[ -olist ] [ -rcn ] [ -Tname ]
[ -Fdir ] [ -Mdir ] [ files... ]
Obviously, many of the options to groff are actually passed on to
gtroff.
Options without an argument can be grouped behind a single -. A filename of - denotes the standard input. It is possible to have whitespace between an option and its parameter.
The grog command can be used to guess the correct groff
command to format a file.
Here's the description of the command-line options:
geqn.
gtbl.
ggrn.
grap.
gpic.
gsoelim.
grefer. No mechanism is provided for passing
arguments to grefer because most grefer options have
equivalent commands which can be included in the file. See grefer,
for more details.
Note that gtroff also accepts a -R option, which is not
accessible via groff. This option prevents the loading of the
troffrc and troffrc-end files.
groff print out their version number.
stdout instead of executing it. If
specified more than once, print the pipeline on stderr and
execute it.
gtroff. Only error messages are printed.
gtroff. Normally groff
automatically runs the appropriate postprocessor.
groff does not
prepend ‘-’ to arg before passing it to the postprocessor.
print command in the device description file
(see Font Files, for more info). If not present, -l is
ignored.
groff does not prepend a
‘-’ to arg before passing it to the postprocessor. If the
print keyword in the device description file is missing,
-L is ignored.
groff was configured and built. The
following are the output devices currently available:
psdviX75X75-12X100X100-12asciilatin1utf8cp1047lj4lbphtmlxhtmlpre-grohtml) and a postprocessor (post-grohtml).
The predefined gtroff string register .T contains the
current output device; the read-only number register .T is set
to 1 if this option is used (which is always true if groff
is used to call gtroff). See Built-in Registers.
The postprocessor to be used for a device is specified by the
postpro command in the device description file. (See Font Files, for more info.) This can be overridden with the -X
option.
gxditview instead of using the usual postprocessor.
This is unlikely to produce good results except with -Tps.
Note that this is not the same as using -TX75 or
-TX100 to view a document with gxditview: The former
uses the metrics of the specified device, whereas the latter uses
X-specific fonts and metrics.
eqn delimiters. This is the same as
the -N option in geqn.
gpic and disable the
open, opena, pso, sy, and pi
requests. For security reasons, this is enabled by default.
open, opena, pso,
sy, and pi requests.
.A is then set to 1. See Built-in Registers. A typical example is
groff -a -man -Tdvi troff.man | less
which shows how lines are broken for the DVI device. Note that this
option is rather useless today since graphic output devices are
available virtually everywhere.
gtroff can get
confused by as or am requests while counting line numbers.
groff and AT&T
troff.
groff searches
for this in its macro directories. If it isn't found, it tries
tmac.name (searching in the same directories).
gtroff exits after printing the last page in
the list. All the ranges are inclusive on both ends.
Within gtroff, this information can be extracted with the
‘.P’ register. See Built-in Registers.
If your document restarts page numbering at the beginning of each
chapter, then gtroff prints the specified page range for each
chapter.
gtroff
numeric expression. All register assignments happen before loading any
macro file (including the start-up file).
gsoelim (see gsoelim for more details);
it also implies groff's -s option.
gtroff; it is used to search files named in the psbb and
so requests.
grops; it is used to search files named in the
\X'ps: import and \X'ps: file escapes.
The current directory is always searched first. This option may be specified more than once; the directories are searched in the order specified. No directory search is performed for files specified using an absolute path.