|GROFF(1)||General Commands Manual||GROFF(1)|
||[-abcegijklpstzCEGNRSUVXZ] [-d cs] [-D arg] [-f fam] [-F dir] [-I dir] [-K arg] [-L arg] [-m name] [-M dir] [-n num] [-o list] [-P arg] [-r cn] [-T dev] [-w name] [-W name] [file ...]|
||-v [option ...]|
||--version [option ...]|
The groff program allows control of the whole groff system by command-line options. This is a great simplification in comparison to the classical case (which uses pipes only).
As groff is a wrapper program for troff both programs share a set of options. But the groff program has some additional, native options and gives a new meaning to some troff options. On the other hand, not all troff options can be fed into groff.
- -D arg
- Set default input encoding used by preconv to arg. Implies -k.
- Preprocess with eqn.
- Preprocess with grn.
- Preprocess with grap. Implies -p.
- Print a help message.
- -I dir
- This option may be used to specify a directory to search for files (both those on the command line and those named in .psbb and .so requests, and \X'ps: import' , \X'ps: file' and \X'pdf: pdfpic' 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. This option implies the -s option.
- Preprocess with chem. Implies -p.
- Preprocess with preconv. This is run before any other preprocessor. Please refer to preconv's manual page for its behaviour if no -K (or -D) option is specified.
- -K arg
- Set input encoding used by preconv to arg. Implies -k.
- Send the output to a spooler program for printing. The command that should be used for this is specified by the print command in the device description file, see groff_font(5). If this command is not present, the output is piped into the lpr(1) program by default. See options -L and -X.
- -L arg
- Pass arg to the spooler program. Several arguments should be passed with a separate -L option each. Note that groff does not prepend ‘-’ (a minus sign) to arg before passing it to the spooler program.
- Don't allow newlines within eqn delimiters. This is the same as the -N option in eqn.
- Preprocess with pic.
- -P -option
- -P -option -P arg
- Pass -option or -option arg to the postprocessor. The option must be specified with the necessary preceding minus sign(s) ‘-’ or ‘--’ because groff does not prepend any dashes before passing it to the postprocessor. For example, to pass a title to the gxditview postprocessor, the shell command
groff -X -P -title -P 'groff it' foo
- is equivalent to
groff -X -Z foo | gxditview -title 'groff it' -
- Preprocess with refer. No mechanism is provided for passing arguments to refer because most refer options have equivalent language elements that can be specified within the document. See refer(1) for more details.
- Preprocess with soelim.
- Safer mode. Pass the -S option to pic and disable the following troff requests: .open, .opena, .pso, .sy, and .pi. For security reasons, safer mode is enabled by default.
- Preprocess with tbl.
- -T dev
- Set output device to dev. For this device, troff generates the intermediate output; see groff_out(5). Then groff calls a postprocessor to convert troff's intermediate output to its final format. Real devices in groff are
- TeX DVI format (postprocessor is grodvi).
- HTML and XHTML output (preprocessors are soelim and pre-grohtml, postprocessor is post-grohtml).
- Canon CAPSL printers (LBP-4 and LBP-8 series laser printers; postprocessor is grolbp).
- HP LaserJet4 compatible (or other PCL5 compatible) printers (postprocessor is grolj4).
- PostScript output (postprocessor is grops).
- Portable Document Format (PDF) output (postprocessor is gropdf).
- For the following TTY output devices (postprocessor is always grotty), -T selects the output encoding:
- 7bit ASCII.
- Latin-1 character set for EBCDIC hosts.
- ISO 8859-1.
- Unicode character set in UTF-8 encoding. This mode has the most useful fonts for TTY mode, so it is the best mode for TTY output.
- The following arguments select gxditview as the ‘postprocessor’ (it is rather a viewing program):
- 75dpi resolution, 10pt document base font.
- 75dpi resolution, 12pt document base font.
- 100dpi resolution, 10pt document base font.
- 100dpi resolution, 12pt document base font.
- The default device is ps.
- Unsafe mode. Reverts to the (old) unsafe behaviour; see option -S.
- Output version information of groff and of all programs that are run by it; that is, the given command line is parsed in the usual way, passing -v to all subprograms.
- Output the pipeline that would be run by groff (as a wrapper program) on the standard output, but do not execute it. If given more than once, the commands are both printed on the standard error and run.
- Use gxditview instead of using the usual postprocessor to (pre)view a document. The printing spooler behavior as outlined with options -l and -L is carried over to gxditview(1) by determining an argument for the -printCommand option of gxditview(1). This sets the default Print action and the corresponding menu entry to that value. -X only produces good results with -Tps, -TX75, -TX75-12, -TX100, and -TX100-12. The default resolution for previewing -Tps output is 75dpi; this can be changed by passing the -resolution option to gxditview, for example
groff -X -P-resolution -P100 -man foo.1
- Suppress output generated by troff. Only error messages are printed.
- Do not automatically postprocess groff intermediate output in the usual manner. This will cause the troff output to appear on standard output, replacing the usual postprocessor output; see groff_out(5).
- ASCII approximation of output.
- Backtrace on error or warning.
- Disable color output. Please consult the grotty(1) man page for more details.
- Enable compatibility mode.
- -d cs
- -d name=s
- Define string.
- Disable troff error messages.
- -f fam
- Set default font family.
- -F dir
- Set path for device DESC files.
- Process standard input after the specified input files.
- -m name
- Include macro file name.tmac (or tmac.name); see also groff_tmac(5).
- -M dir
- Path for macro files.
- -n num
- Number the first page num.
- -o list
- Output only pages in list.
- -r cn
- -r name=n
- Set number register.
- -w name
- Enable warning name. See troff(1) for names.
- -W name
- disable warning name. See troff(1) for names.
The physical paper size, giving the actual dimensions of the paper sheets, is controlled by output devices like grops with the command-line options -p and -l. See groff_font(5) and the man pages of the output devices for more details. groff uses the command-line option -P to pass options to output devices; for example, the following selects A4 paper in landscape orientation for the PS device:
groff -Tps -P-pa4 -P-l ...
The grog(1) program can be used for guessing the correct groff command line to format a file.
The groffer(1) program is an all-around viewer for groff files and man pages.
- for mathematical formulae,
- for including gremlin(1) pictures,
- for drawing diagrams,
- for chemical structure diagrams,
- for bibliographic references,
- for including macro files from standard locations,
- for tables.
A new preprocessor not available in classical troff is preconv(1) which converts various input encodings to something groff can understand. It is always run first before any other preprocessor.
Besides these, there are some internal preprocessors that are automatically run with some devices. These aren't visible to the user.
- The traditional man page format; see groff_man(7). It can be specified on the command line as -man or -m man.
- The general package for man pages; it automatically recognizes whether the documents uses the man or the mdoc format and branches to the corresponding macro package. It can be specified on the command line as -mandoc or -m mandoc.
- The BSD-style man page format; see groff_mdoc(7). It can be specified on the command line as -mdoc or -m mdoc.
- The classical me document format; see groff_me(7). It can be specified on the command line as -me or -m me.
- The classical mm document format; see groff_mm(7). It can be specified on the command line as -mm or -m mm.
- The classical ms document format; see groff_ms(7). It can be specified on the command line as -ms or -m ms.
- HTML-like macros for inclusion in arbitrary groff documents; see groff_www(7).
Details on the naming of macro files and their placement can be found in groff_tmac(5); this man page also documents some other, minor auxiliary macro packages not mentioned here.
The groff extensions to the classical troff language are documented in groff_diff(7).
An overview of language features, including all supported escapes and requests, can be found in groff(7).
There is a shell script nroff(1) that emulates the behavior of classical nroff. It tries to automatically select the proper output encoding, according to the current locale.
The formatter program generates intermediate output; see groff_out(7).
- Text output using the ascii(7) character set.
- Text output using the EBCDIC code page IBM cp1047 (e.g., OS/390 Unix).
- TeX DVI format.
- HTML output.
- Text output using the ISO Latin-1 (ISO 8859-1) character set; see iso_8859_1(7).
- Output for Canon CAPSL printers (LBP-4 and LBP-8 series laser printers).
- HP LaserJet4-compatible (or other PCL5-compatible) printers.
- PostScript output; suitable for printers and previewers like gv(1).
- PDF files; suitable for viewing with tools such as evince(1) and okular(1).
- Text output using the Unicode (ISO 10646) character set with UTF-8 encoding; see unicode(7).
- XHTML output.
- 75dpi X Window System output suitable for the previewers xditview(1x) and gxditview(1). A variant for a 12pt document base font is X75-12.
- 100dpi X Window System output suitable for the previewers xditview(1x) and gxditview(1). A variant for a 12pt document base font is X100-12.
The postprocessor to be used for a device is specified by the postpro command in the device description file; see groff_font(5). This can be overridden with the -X option.
The default device is ps.
- for some Canon printers,
- for printers compatible to the HP LaserJet 4 and PCL5,
- for text output using various encodings, e.g., on text-oriented terminals or line printers.
Today, most printing or drawing hardware is handled by the operating system, by device drivers, or by software interfaces, usually accepting PostScript. Consequently, there isn't an urgent need for more hardware device postprocessors.
The groff software devices for conversion into other document file formats are
- for the DVI format,
- for HTML and XHTML formats,
- for PostScript.
- for PDF.
Combined with the many existing free conversion tools this should be sufficient to convert a troff document into virtually any existing data format.
- Add information to troff font description files for use with groff.
- Create font description files for PostScript device.
- Convert an eqn image into a cropped image.
- Mark differences between groff, nroff, or troff files.
- Convert a grap diagram into a cropped bitmap image.
- General viewer program for groff files and man pages.
- The groff X viewer, the GNU version of xditview.
- Create font description files for lj4 device.
- Make inverted index for bibliographic databases.
- Search bibliographic databases.
- Interactively search bibliographic databases.
- Create PDF documents using groff.
- Translate a PostScript font in .pfb format to ASCII.
- Convert a pic diagram into a cropped image.
- Create font description files for TeX DVI device.
- roff viewer historically distributed with the X Window System.
- Convert X font metrics into GNU troff font metrics.
- This search path, followed by PATH, is used for commands that are executed by groff. If it is not set then the directory where the groff binaries were installed is prepended to PATH.
- When there is a need to run different roff implementations at the same time groff provides the facility to prepend a prefix to most of its programs that could provoke name clashings at run time (default is to have none). Historically, this prefix was the character g, but it can be anything. For example, gtroff stood for groff's troff, gtbl for the groff version of tbl. By setting GROFF_COMMAND_PREFIX to different values, the different roff installations can be addressed. More exactly, if it is set to prefix xxx then groff as a wrapper program internally calls xxxtroff instead of troff. This also applies to the preprocessors eqn, grn, pic, refer, tbl, soelim, and to the utilities indxbib and lookbib. This feature does not apply to any programs different from the ones above (most notably groff itself) since they are unique to the groff package.
- The value of this environment value is passed to the preconv preprocessor to select the encoding of input files. Setting this option implies groff's command-line option -k (this is, groff actually always calls preconv). If set without a value, groff calls preconv without arguments. An explicit -K command-line option overrides the value of GROFF_ENCODING. See preconv(1) for details.
- A list of directories in which to search for the devname directory in addition to the default ones. See troff(1) and groff_font(5) for more details.
- A list of directories in which to search for macro files in addition to the default directories. See troff(1) and groff_tmac(5) for more details.
- The directory in which temporary files are created. If this is not set but the environment variable TMPDIR instead, temporary files are created in the directory TMPDIR. On MS-DOS and Windows platforms, the environment variables TMP and TEMP (in that order) are searched also, after GROFF_TMPDIR and TMPDIR. Otherwise, temporary files are created in /tmp. The refer(1), groffer(1), grohtml(1), and grops(1) commands use temporary files.
- Preset the default device. If this is not set the ps device is used as default. This device name is overwritten by the option -T.
To process a roff file using the preprocessors tbl and pic and the me macro set, classical troff had to be called by
pic foo.me | tbl | troff -me -Tlatin1 | grotty
Using groff, this pipe can be shortened to the equivalent command
groff -p -t -me -T latin1 foo.me
An even easier way to call this is to use grog(1) to guess the preprocessor and macro options and execute the generated command (by using backquotes to specify shell command substitution)
`grog -Tlatin1 foo.me`
The simplest way is to view the contents in an automated way by calling
- Application defaults directory for gxditview(1).
- Directory containing groff's executable commands.
- List of common words for indxbib(1).
- Directory for data files.
- Default index for lkbib(1) and refer(1).
- Documentation directory.
- Example directory.
- Font directory.
- HTML documentation directory.
- Legacy font directory.
- Local font directory.
- Local macro package (tmac file) directory.
- Macro package (tmac file) directory.
- Font directory for compatibility with old versions of groff; see grops(1).
- PDF documentation directory.
- System macro package (tmac file) directory.
- Initialization file for troff. This is interpreted by troff before reading the macro sets and any input.
- Final startup file for troff. It is parsed after all macro sets have been read.
- Macro file for macro package name.
- Device description file for device name, see groff_font(5).
- Font file for font F of device name.
Three groff mailing lists are available:
- bug tracker activity (read-only);
- general discussion; and
- commit activity (read-only), which reports changes to groff's source code repository by its developers.
Details on repository access and much more can be found in the file README at the top directory of the groff source package.
But there are special sections of man pages. groff has man pages in sections 1, 5,and 7. When there are several man pages with the same name in the same man section, the one with the lowest section is should as first. The other man pages can be shown anyway by adding the section number as argument before the man page name. Reading the man page about the groff language is done by one of
man 7 groff groffer 7 groff
- Introduction, history and further readings:
- Viewer for groff files:
- groffer(1), gxditview(1), xditview(1x).
- Wrapper programs for formatters:
- groff(1), grog(1).
- Roff preprocessors:
- eqn(1), grn(1), pic(1), chem(1), preconv(1), refer(1), soelim(1), tbl(1), grap(1).
- Roff language with the groff extensions:
- groff(7), groff_char(7), groff_diff(7), groff_font(5).
- Roff formatter programs:
- nroff(1), troff(1), ditroff(7).
- The intermediate output language:
- Postprocessors for the output devices:
- grodvi(1), grohtml(1), grolbp(1), grolj4(1), lj4_font(5), grops(1), gropdf(1), grotty(1).
- Groff macro packages and macro-specific utilities:
- groff_tmac(5), groff_man(7), groff_mdoc(7), groff_me(7), groff_mm(7), groff_mmse(7), groff_mom(7), groff_ms(7), groff_www(7), groff_trace(7), mmroff(7).
- The following utilities are available:
- addftinfo(1), afmtodit(1), eqn2graph(1), gdiffmk(1), grap2graph(1), groffer(1), gxditview(1), hpftodit(1), indxbib(1), lkbib(1), lookbib(1), pdfroff(1), pfbtops(1), pic2graph(1), tfmtodit(1), xtotroff(1).
|30 March 2021||groff 1.22.4|