Groff
Groff
Groff
by Trent A. Fisher
and Werner Lemberg
This manual documents GNU troff version 1.22.4.
Copyright
c 1994–2018 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this doc-
ument under the terms of the GNU Free Documentation License,
Version 1.3 or any later version published by the Free Software
Foundation; with no Invariant Sections, with the Front-Cover texts
being “A GNU Manual,” and with the Back-Cover Texts as in (a)
below. A copy of the license is included in the section entitled
“GNU Free Documentation License.”
(a) The FSF’s Back-Cover Text is: “You have the freedom to copy
and modify this GNU manual. Buying copies from the FSF sup-
ports it in developing GNU and promoting software freedom.”
i
Table of Contents
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 What Is groff? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.3 groff Capabilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.4 Macro Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.5 Preprocessors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.6 Output Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.7 Credits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2 Invoking groff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2 Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.3 Macro Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.4 Font Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.5 Paper Size. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.6 Invocation Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.6.1 grog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4 Macro Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.1 man . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.1.1 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.1.2 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
ii The GNU Troff Manual
5 gtroff Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
5.1 Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
5.1.1 Filling and Adjusting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
5.1.2 Hyphenation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
5.1.3 Sentences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
5.1.4 Tab Stops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
5.1.5 Implicit Line Breaks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
5.1.6 Input Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
5.1.7 Input Encodings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
5.2 Measurements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
5.2.1 Default Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
5.3 Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
5.4 Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
5.5 Embedded Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
5.5.1 Requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
5.5.1.1 Request and Macro Arguments . . . . . . . . . . . . . . . . . . . . . . . 68
5.5.2 Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
5.5.3 Escapes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
5.5.3.1 Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
5.6 Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
5.6.1 Setting Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
5.6.2 Interpolating Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
5.6.3 Auto-increment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
5.6.4 Assigning Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
5.6.5 Built-in Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
5.7 Manipulating Filling and Adjusting . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
5.8 Manipulating Hyphenation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
5.9 Manipulating Spacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
5.10 Tabs and Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
5.10.1 Leaders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
5.10.2 Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
5.11 Character Translations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
5.12 Troff and Nroff Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
5.13 Line Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
5.14 Line Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
5.15 Page Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
5.16 Page Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
5.17 Fonts and Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
5.17.1 Changing Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
5.17.2 Font Families . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
5.17.3 Font Positions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
5.17.4 Using Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
5.17.5 Character Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
5.17.6 Special Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
5.17.7 Artificial Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
5.17.8 Ligatures and Kerning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
iv The GNU Troff Manual
6 Preprocessors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
6.1 geqn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
6.1.1 Invoking geqn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
6.2 gtbl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
6.2.1 Invoking gtbl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
6.3 gpic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
6.3.1 Invoking gpic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
6.4 ggrn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
6.4.1 Invoking ggrn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
6.5 grap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
6.6 gchem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
6.6.1 Invoking gchem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
6.7 grefer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
6.7.1 Invoking grefer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
v
9 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
1 Introduction
GNU troff (or groff) is a system for typesetting documents. troff is
very flexible and has been used extensively for some thirty years. It is well
entrenched in the Unix community.
1.2 History
troff can trace its origins back to a formatting program called RUNOFF,
written by Jerry Saltzer, which ran on the CTSS (Compatible Time Shar-
ing System, a project of MIT, the Massachusetts Institute of Technology)
in the mid-sixties.2 The name came from the use of the phrase “run off a
document”, meaning to print it out. Bob Morris ported it to the 635 archi-
tecture and called the program roff (an abbreviation of runoff). It was
rewritten as rf for the PDP-7 (before having Unix), and at the same time
1
What You See Is What You Get
2
Jerome H. Saltzer, a grad student then, later a Professor of Electrical Engineering,
now retired. Saltzer’s PhD thesis was the first application for RUNOFF and is available
from the MIT Libraries.
2 The GNU Troff Manual
1.5 Preprocessors
Although groff provides most functions needed to format a document, some
operations would be unwieldy (e.g. to draw pictures). Therefore, programs
called preprocessors were written that understand their own language and
produce the necessary groff operations. These preprocessors are able to
differentiate their own input from the rest of the document via markers.
To use a preprocessor, Unix pipes are used to feed the output from the
preprocessor into groff. Any number of preprocessors may be used on a
given document; in this case, the preprocessors are linked together into one
pipeline. However, with groff, the user does not need to construct the pipe,
but only tell groff what preprocessors to use.
groff currently has preprocessors for producing tables (tbl), typesetting
equations (eqn), drawing pictures (pic and grn), processing bibliographies
(refer), and drawing chemical structures (chem). An associated program
that is useful when dealing with preprocessors is soelim.
A free implementation of grap, a preprocessor for drawing graphs, can
be obtained as an extra package; groff can use grap also.
Unique to groff is the preconv preprocessor that enables groff to han-
dle documents in various input encodings.
There are other preprocessors in existence, but, unfortunately, no free
implementations are available. Among them is a preprocessor for drawing
mathematical pictures (ideal).
1.7 Credits
Large portions of this manual were taken from existing documents, most
notably, the manual pages for the groff package by James Clark, and Eric
Allman’s papers on the me macro package.
The section on the man macro package is partly based on Susan G. Klein-
mann’s groff_man manual page written for the Debian GNU/Linux system.
Larry Kollar contributed the section on the ms macro package.
7
2 Invoking groff
This section focuses on how to invoke the groff front end. This front end
takes care of the details of constructing the pipeline among the preprocessors,
gtroff and the postprocessor.
It has become a tradition that GNU programs get the prefix ‘g’ to distin-
guish it from its original counterparts provided by the host (see Section 2.2
[Environment], page 12, for more details). Thus, for example, geqn is GNU
eqn. On operating systems like GNU/Linux or the Hurd, which don’t con-
tain proprietary versions of troff, and on MS-DOS/MS-Windows, where
troff and associated programs are not available at all, this prefix is omit-
ted since GNU troff is the only used incarnation of troff. Exception:
‘groff’ is never replaced by ‘roff’.
In this document, we consequently say ‘gtroff’ when talking about the
GNU troff program. All other implementations of troff are called AT&T
troff, which is the common origin of all troff derivates (with more or less
compatible changes). Similarly, we say ‘gpic’, ‘geqn’, etc.
2.1 Options
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, gchem, grefer, gsoelim, or preconv.
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 Section 6.3.1 [Invoking gpic], page 189, Section 6.1.1 [Invoking geqn],
page 189, Section 6.2.1 [Invoking gtbl], page 189, Section 6.4.1 [Invoking
ggrn], page 189, Section 6.7.1 [Invoking grefer], page 189, Section 6.6.1
[Invoking gchem], page 189, Section 6.8.1 [Invoking gsoelim], page 189,
Section 6.9.1 [Invoking preconv], page 190, Section 7.2.1 [Invoking grotty],
page 191, Section 7.3.1 [Invoking grops], page 192, Section 7.4.1 [Invoking
gropdf], page 193, Section 7.8.1 [Invoking grohtml], page 196, Section 7.5.1
[Invoking grodvi], page 194, Section 7.6.1 [Invoking grolj4], page 194,
Section 7.7.1 [Invoking grolbp], page 195, and Section 7.9.1 [Invoking
gxditview], page 197.
The command-line format for groff is:
groff [ -abceghijklpstvzCEGNRSUVXZ ] [ -dcs ] [ -Darg ]
[ -ffam ] [ -Fdir ] [ -Idir ] [ -Karg ]
[ -Larg ] [ -mname ] [ -Mdir ] [ -nnum ]
[ -olist ] [ -Parg ] [ -rcn ] [ -Tdev ]
[ -wname ] [ -Wname ] [ files... ]
The command-line format for gtroff is as follows.
8 The GNU Troff Manual
‘-N’ Don’t allow newlines with eqn delimiters. This is the same as
the -N option in geqn.
‘-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 beginning with n. 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 Section 5.6.5 [Built-in Registers], page 77.
If your document restarts page numbering at the beginning of
each chapter, then gtroff prints the specified page range for
each chapter.
‘-p’ Preprocess with gpic.
‘-Parg’ Pass arg to the postprocessor. Each argument should be passed
with a separate -P option. Note that groff does not prepend
‘-’ to arg before passing it to the postprocessor.
‘-rcn’
‘-rname=n’
Set number register c or name to the value n. c must be a
one-letter name; name can be of arbitrary length. n can be any
gtroff numeric expression. All register assignments happen
before loading any macro file (including the start-up file).
‘-R’ Preprocess with grefer. No mechanism is provided for passing
arguments to grefer because most grefer options have equiv-
alent commands that can be included in the file. See Section 6.7
[grefer], page 189, for more details.
Note that gtroff also accepts a -R option, which is not accessi-
ble via groff. This option prevents the loading of the troffrc
and troffrc-end files.
‘-s’ Preprocess with gsoelim.
‘-S’ Safer mode. Pass the -S option to gpic and disable the open,
opena, pso, sy, and pi requests. For security reasons, this is
enabled by default.
‘-t’ Preprocess with gtbl.
‘-Tdev’ Prepare output for device dev. The default device is ‘ps’, unless
changed when groff was configured and built. The following
are the output devices currently available:
ps For PostScript printers and previewers.
pdf For PDF viewers or printers.
Chapter 2: Invoking groff 11
‘-v’ Make programs run by groff print out their version number.
‘-V’ Print the pipeline on stdout instead of executing it. If specified
more than once, print the pipeline on stderr and execute it.
‘-X’ Preview with gxditview instead of using the usual postproces-
sor. 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.
‘-z’ Suppress output from gtroff. Only error messages are printed.
‘-Z’ Do not postprocess the output of gtroff. Normally groff au-
tomatically runs the appropriate postprocessor.
2.2 Environment
There are also several environment variables (of the operating system, not
within gtroff) that can modify the behavior of groff.
GROFF_BIN_PATH
This search path, followed by PATH, is used for commands exe-
cuted by groff.
GROFF_COMMAND_PREFIX
If this is set to X, then groff runs Xtroff instead of
gtroff. This also applies to tbl, pic, eqn, grn, chem, refer,
and soelim. It does not apply to grops, grodvi, grotty,
pre-grohtml, post-grohtml, preconv, grolj4, gropdf, and
gxditview.
The default command prefix is determined during the installa-
tion process. If a non-GNU troff system is found, prefix ‘g’ is
used, none otherwise.
GROFF_ENCODING
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 (that 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 the manual
page of preconv for details.
GROFF_FONT_PATH
A colon-separated list of directories in which to search for the
devname directory (before the default directories are tried). See
Section 2.4 [Font Directories], page 14.
Chapter 2: Invoking groff 13
GROFF_TMAC_PATH
A colon-separated list of directories in which to search for macro
files (before the default directories are tried). See Section 2.3
[Macro Directories], page 13.
GROFF_TMPDIR
The directory in which groff creates temporary files. If this
is not set and TMPDIR is set, temporary files are created in
that directory. Otherwise temporary files are created in a
system-dependent default directory (on Unix and GNU/Linux
systems, this is usually /tmp). grops, grefer, pre-grohtml,
and post-grohtml can create temporary files in this directory.
GROFF_TYPESETTER
The default output device.
SOURCE_DATE_EPOCH
A timestamp (expressed as seconds since the Unix epoch) to use
in place of the current time when initializing time-based built-in
registers such as \n[seconds].
Note that MS-DOS and MS-Windows ports of groff use semi-colons,
rather than colons, to separate the directories in the lists described above.
2.6.1 grog
grog reads files, guesses which of the groff preprocessors and/or macro
packages are required for formatting them, and prints the groff command
including those options on the standard output. It generates one or more of
the options -e, -man, -me, -mm, -mom, -ms, -mdoc, -mdoc-old, -p, -R, -g,
-G, -s, and -t.
A special file name - refers to the standard input. Specifying no files
also means to read the standard input. Any specified options are included
in the printed command. No space is allowed between options and their
arguments. The only options recognized are -C (which is also passed on) to
enable compatibility mode, and -v to print the version number and exit.
For example,
grog -Tdvi paper.ms
1
The same is true for the other main macro packages that come with groff: man, mdoc,
ms, mm, and mandoc. This won’t work in general; for example, to load trace.tmac,
either ‘-mtrace’ or ‘-m trace’ must be used.
16 The GNU Troff Manual
guesses the appropriate command to print paper.ms and then prints it to the
command line after adding the -Tdvi option. For direct execution, enclose
the call to grog in backquotes at the Unix shell prompt:
‘grog -Tdvi paper.ms‘ > paper.dvi
As seen in the example, it is still necessary to redirect the output to some-
thing meaningful (i.e. either a file or a pager program like less).
17
3.1 Basics
This section covers some of the basic concepts necessary to understand how
to use a macro package.1 References are made throughout to more detailed
information, if desired.
gtroff reads an input file prepared by the user and outputs a formatted
document suitable for publication or framing. The input consists of text,
or words to be printed, and embedded commands (requests and escapes),
which tell gtroff how to format the output. For more detail on this, see
Section 5.5 [Embedded Commands], page 67.
The word argument is used in this chapter to mean a word or number
that appears on the same line as a request, and which modifies the meaning
of that request. For example, the request
.sp
spaces one line, but
.sp 4
spaces four lines. The number 4 is an argument to the sp request, which
says to space four lines instead of one. Arguments are separated from the
request and from each other by spaces (no tabs). More details on this can
be found in Section 5.5.1.1 [Request and Macro Arguments], page 68.
The primary function of gtroff is to collect words from input lines, fill
output lines with those words, justify the right-hand margin by inserting
extra spaces in the line, and output the result. For example, the input:
Now is the time
for all good men
to come to the aid
of their party.
Four score and seven
years ago, etc.
is read, packed onto output lines, and justified to produce:
Now is the time for all good men to come to the aid of their party.
Four score and seven years ago, etc.
Sometimes a new output line should be started even though the current
line is not yet full; for example, at the end of a paragraph. To do this it
is possible to cause a break, which starts a new output line. Some requests
1
This section is derived from Writing Papers with nroff using -me by Eric P. Allman.
18 The GNU Troff Manual
cause a break automatically, as normally do blank input lines and input lines
beginning with a space.
Not all input lines are text to be formatted. Some input lines are requests
that describe how to format the text. Requests always have a period (‘.’)
or an apostrophe (‘’’) as the first character of the input line.
The text formatter also does more complex things, such as automatically
numbering pages, skipping over page boundaries, putting footnotes in the
correct place, and so forth.
Here are a few hints for preparing text for input to gtroff.
• First, keep the input lines short. Short input lines are easier to edit,
and gtroff packs words onto longer lines anyhow.
• In keeping with this, it is helpful to begin a new line after every comma
or phrase, since common corrections are to add or delete sentences or
phrases.
• End each sentence with two spaces – or better, start each sentence on
a new line. gtroff recognizes characters that usually end a sentence,
and inserts sentence space accordingly.
• Do not hyphenate words at the end of lines – gtroff is smart enough
to hyphenate words as needed, but is not smart enough to take hyphens
out and join a word back together. Also, words such as “mother-in-law”
should not be broken over a line, since then a space can occur where
not wanted, such as “mother- in-law”.
gtroff double-spaces output text automatically if you use the request
‘.ls 2’. Reactivate single-spaced mode by typing ‘.ls 1’.2
A number of requests allow to change the way the output looks, some-
times called the layout of the output page. Most of these requests adjust
the placing of whitespace (blank lines or spaces).
The bp request starts a new page, causing a line break.
The request ‘.sp N’ leaves N lines of blank space. N can be omitted
(meaning skip a single line) or can be of the form N i (for N inches) or N c
(for N centimeters). For example, the input:
.sp 1.5i
My thoughts on the subject
.sp
leaves one and a half inches of space, followed by the line “My thoughts on
the subject”, followed by a single blank line (more measurement units are
available, see Section 5.2 [Measurements], page 62).
Text lines can be centered by using the ce request. The line after ce
is centered (horizontally) on the page. To center more than one line, use
2
If you need finer granularity of the vertical space, use the pvs request (see Section 5.18.1
[Changing Type Sizes], page 128).
Chapter 3: Tutorial for Macro Users 19
3.2.1 Paragraphs
One of the most common and most used capability is starting a paragraph.
There are a number of different types of paragraphs, any of which can be
initiated with macros supplied by the macro package. Normally, paragraphs
start with a blank line and the first line indented, like the text in this manual.
There are also block style paragraphs, which omit the indentation:
Some men look at constitutions with sanctimonious
reverence, and deem them like the ark of the covenant, too
sacred to be touched.
And there are also indented paragraphs, which begin with a tag or label at
the margin and the remaining text indented.
one This is the first paragraph. Notice how the first
line of the resulting paragraph lines up with the
other lines in the paragraph.
longlabel
This paragraph had a long label. The first
character of text on the first line does not line up
with the text on second and subsequent lines,
although they line up with each other.
A variation of this is a bulleted list.
. Bulleted lists start with a bullet. It is possible
to use other glyphs instead of the bullet. In nroff
mode using the ASCII character set for output, a dot
is used instead of a real bullet.
20 The GNU Troff Manual
3.2.5 Displays
Displays are sections of text to be set off from the body of the paper. Major
quotes, tables, and figures are types of displays, as are all the examples used
in this document.
Major quotes are quotes that are several lines long, and hence are set in
from the rest of the text without quote marks around them.
A list is an indented, single-spaced, unfilled display. Lists should be used
when the material to be printed should not be filled and justified like normal
text, such as columns of figures or the examples used in this paper.
A keep is a display of lines that are kept on a single page if possible. An
example for a keep might be a diagram. Keeps differ from lists in that lists
may be broken over a page boundary whereas keeps are not.
Floating keeps move relative to the text. Hence, they are good for things
that are referred to by name, such as “See figure 3”. A floating keep appears
at the bottom of the current page if it fits; otherwise, it appears at the top
of the next page. Meanwhile, the surrounding text ‘flows’ around the keep,
thus leaving no blank areas.
3.2.8 Indices
While some macro packages use the term index, none actually provide that
functionality. The facilities they call indices are actually more appropriate
for tables of contents.
To produce a real index in a document, external tools like the makeindex
program are necessary.
For example, all macro packages mark tables (which are processed with
gtbl) by placing them between TS and TE macros. The ms macro package
has an option, ‘.TS H’, that prints a caption at the top of a new page (when
the table is too long to fit on a single page).
4 Macro Packages
This chapter documents the main macro packages that come with groff.
Different main macro packages can’t be used at the same time; for exam-
ple
groff -m man foo.man -m ms bar.doc
doesn’t work. Note that option arguments are processed before non-option
arguments; the above (failing) sample is thus reordered to
groff -m man -m ms foo.man bar.doc
4.1 man
This is the most popular and probably the most important macro package
of groff. It is easy to use, and a vast majority of manual pages are based
on it.
4.1.1 Options
The command-line format for using the man macros with groff is:
groff -m man [ -rLL=length ] [ -rLT=length ] [ -rFT=dist ]
[ -rcR=1 ] [ -rC1 ] [ -rD1 ] [-rHY=flags ]
[ -rPnnn ] [ -rSxx ] [ -rXnnn ]
[ -rIN=length ] [ -rSN=length ] [ files... ]
It is possible to use ‘-man’ instead of ‘-m man’.
-rcR=1 This option (the default if a TTY output device is used) creates
a single, very long page instead of multiple pages. Use -rcR=0
to disable it.
-rC1 If more than one manual page is given on the command line,
number the pages continuously, rather than starting each at 1.
-rD1 Double-sided printing. Footers for even and odd pages are for-
matted differently.
-rFT=dist
Set the position of the footer text to dist. If positive, the distance
is measured relative to the top of the page, otherwise it is relative
to the bottom. The default is −0.5 i.
-rHY=flags
Set hyphenation flags. Possible values are 1 to hyphenate with-
out restrictions, 2 to not hyphenate the last word on a page, 4 to
not hyphenate the last two characters of a word, and 8 to not
hyphenate the first two characters of a word. These values are
additive; the default is 8.
-rIN=length
Set the body text indentation to length. If not specified, the
indentation defaults to 7 n (7 characters) in nroff mode and 7.2 n
24 The GNU Troff Manual
4.1.2 Usage
This section describes the available macros for manual pages. For further
customization, put additional macros and requests into the file man.local,
which is loaded immediately after the man package.
.TH title section [extra1 [extra2 [extra3]]] [Macro]
Set the title of the man page to title and the section to section, which
must have a value between 1 and 8. The value of section may also have
a string appended, e.g. ‘.pm’, to indicate a specific subsection of the man
pages.
Both title and section are positioned at the left and right in the header
line (with section in parentheses immediately appended to title. extra1
is positioned in the middle of the footer line. extra2 is positioned at the
1
Note that the use of a ‘.ll length’ request to initialize the line length, prior to use
of the ‘TH’ macro, is supported for backward compatibility with some versions of the
man program. Always use the -rLL=length option, or an equivalent ‘.nr LL length’
request, in preference to such a ‘.ll length’ request. In particular, note that in nroff
mode, the request ‘.ll 65n’, (with any length expression that evaluates equal to 65 n,
i.e., the formatter’s default line length in nroff mode), does not set the line length to
65 n (it is adjusted to the man macro package’s default setting of 78 n), whereas the use
of the -rLL=65n option, or the ‘.nr LL 65n’ request does establish a line length of 65 n.
Chapter 4: Macro Packages 25
left in the footer line (or at the left on even pages and at the right on odd
pages if double-sided printing is active). extra3 is centered in the header
line.
For HTML and XHTML output, headers and footers are completely sup-
pressed.
Additionally, this macro starts a new page; the new line number is 1 again
(except if the -rC1 option is given on the command line) – this feature
is intended only for formatting multiple man pages; a single man page
should contain exactly one TH macro at the beginning of the file.
.SH [heading] [Macro]
Set up an unnumbered section heading sticking out to the left. Prints out
all the text following SH up to the end of the line (or the text in the next
line if there is no argument to SH) in bold face (or the font specified by
the string HF), one size larger than the base document size. Additionally,
the left margin and the indentation for the following text is reset to its
default value.
.SS [heading] [Macro]
Set up an unnumbered (sub)section heading. Prints out all the text fol-
lowing SS up to the end of the line (or the text in the next line if there is
no argument to SS) in bold face (or the font specified by the string HF),
at the same size as the base document size. Additionally, the left margin
and the indentation for the following text is reset to its default value.
.TP [nnn] [Macro]
Set up an indented paragraph with label. The indentation is set to nnn
if that argument is supplied (the default unit is ‘n’ if omitted), otherwise
it is set to the previous indentation value specified with TP, IP, or HP (or
to the default value if none of them have been used yet).
The first line of text following this macro is interpreted as a string to be
printed flush-left, as it is appropriate for a label. It is not interpreted as
part of a paragraph, so there is no attempt to fill the first line with text
from the following input lines. Nevertheless, if the label is not as wide
as the indentation the paragraph starts at the same line (but indented),
continuing on the following lines. If the label is wider than the indentation
the descriptive part of the paragraph begins on the line following the label,
entirely indented. Note that neither font shape nor font size of the label
is set to a default value; on the other hand, the rest of the text has default
font settings.
.LP [Macro]
.PP [Macro]
.P [Macro]
These macros are mutual aliases. Any of them causes a line break at the
current position, followed by a vertical space downwards by the amount
specified by the PD macro. The font size and shape are reset to the
26 The GNU Troff Manual
To summarize, the following macros cause a line break with the insertion
of vertical space (which amount can be changed with the PD macro): SH, SS,
TP, LP (PP, P), IP, and HP.
The macros RS and RE also cause a break but do not insert vertical space.
Finally, the macros SH, SS, LP (PP, P), and RS reset the indentation to its
default value.
.B [text] [Macro]
Set text in bold face. If no text is present on the line where the macro is
called, then the text of the next line appears in bold face.
.I [text] [Macro]
Set text in italic. If no text is present on the line where the macro is
called, then the text of the next line appears in italic.
.DT [Macro]
Set tabs every 0.5 inches. Since this macro is always executed during a
call to the TH macro, it makes sense to call it only if the tab positions
have been changed.
.PD [nnn] [Macro]
Adjust the empty space before a new paragraph (or section). The op-
tional argument gives the amount of space (default unit is ‘v’); without
parameter, the value is reset to its default value (1 line in nroff mode,
0.4 v otherwise).
This affects the macros SH, SS, TP, LP (as well as PP and P), IP, and HP.
The following two macros are included for BSD compatibility.
.AT [system [release]] [Macro]
Alter the footer for use with AT&T manpages. This command exists only
for compatibility; don’t use it. The first argument system can be:
3 7th Edition (the default)
4 System III
5 System V
An optional second argument release to AT specifies the release number
(such as “System V Release 3”).
.UC [version] [Macro]
Alters the footer for use with BSD manpages. This command exists only
for compatibility; don’t use it. The argument can be:
3 3rd Berkeley Distribution (the default)
4 4th Berkeley Distribution
5 4.2 Berkeley Distribution
6 4.3 Berkeley Distribution
7 4.4 Berkeley Distribution
\*[Tm] [String]
The ‘trademark’ sign.
\*[lq] [String]
\*[rq] [String]
Left and right quote. This is equal to \(lq and \(rq, respectively.
.Ds [Macro]
Begin a non-filled display.
.De [Macro]
End a non-filled display started with Ds.
.EX [indent] [Macro]
Begin a non-filled display using the constant width (Courier) typeface.
Use the optional indent argument to indent the display.
.EE [Macro]
End a non-filled display started with EX.
.G [text] [Macro]
Set text in Helvetica. If no text is present on the line where the macro is
called, then the text of the next line appears in Helvetica.
.GL [text] [Macro]
Set text in Helvetica Oblique. If no text is present on the line where
the macro is called, then the text of the next line appears in Helvetica
Oblique.
.HB [text] [Macro]
Set text in Helvetica Bold. If no text is present on the line where the
macro is called, then all text up to the next HB appears in Helvetica Bold.
.TB [text] [Macro]
Identical to HB.
.MS title sect [punct] [Macro]
Set a manpage reference in Ultrix format. The title is in Courier instead
of italic. Optional punctuation follows the section number without an
intervening space.
.NT [C] [title] [Macro]
Begin a note. Print the optional title, or the word “Note”, centered on
the page. Text following the macro makes up the body of the note, and
is indented on both sides. If the first argument is C, the body of the
note is printed centered (the second argument replaces the word “Note”
if specified).
.NE [Macro]
End a note begun with NT.
.PN path [punct] [Macro]
Set the path name in constant width (Courier), followed by optional punc-
tuation.
.Pn [punct] path [punct] [Macro]
If called with two arguments, identical to PN. If called with three argu-
ments, set the second argument in constant width (Courier), bracketed
by the first and third arguments in the current font.
Chapter 4: Macro Packages 31
.R [Macro]
Switch to roman font and turn off any underlining in effect.
.RN [Macro]
Print the string ‘<RETURN>’.
.VS [4] [Macro]
Start printing a change bar in the margin if the number 4 is specified.
Otherwise, this macro does nothing.
.VE [Macro]
End printing the change bar begun by VS.
Simple example
The following example man.local file alters the SH macro to add some extra
vertical space before printing the heading. Headings are printed in Helvetica
Bold.
.\" Make the heading fonts Helvetica
.ds HF HB
.
.\" Put more whitespace in front of headings.
.rn SH SH-orig
.de SH
. if t .sp (u;\\n[PD]*2)
. SH-orig \\$*
..
4.2 mdoc
See the groff mdoc(7) man page (type man groff_mdoc at the command
line).
4.3 ms
The -ms macros are suitable for reports, letters, books, user manuals, and
so forth. The package provides macros for cover pages, section headings,
paragraphs, lists, footnotes, pagination, and a table of contents.
4.3.1 Introduction to ms
The original -ms macros were included with AT&T troff as well as the
man macros. While the man package is intended for brief documents that
can be read on-line as well as printed, the ms macros are suitable for longer
documents that are meant to be printed rather than read on-line.
The ms macro package included with groff is a complete, bottom-up
re-implementation. Several macros (specific to AT&T or Berkeley) are not
included, while several new commands are. See Section 4.3.7 [Differences
from AT&T ms], page 55, for more information.
32 The GNU Troff Manual
2
Actually, only the title is required.
Chapter 4: Macro Packages 33
Margin Settings
\n[PO] [Register]
Defines the page offset (i.e., the left margin). There is no explicit right
margin setting; the combination of the PO and LL registers implicitly
define the right margin width.
Effective: next page.
Default value: 1 i.
\n[LL] [Register]
Defines the line length (i.e., the width of the body text).
Effective: next paragraph.
Default: 6 i.
\n[LT] [Register]
Defines the title length (i.e., the header and footer width). This is usually
the same as LL, but not necessarily.
Effective: next paragraph.
Default: 6 i.
\n[HM] [Register]
Defines the header margin height at the top of the page.
Effective: next page.
Default: 1 i.
\n[FM] [Register]
Defines the footer margin height at the bottom of the page.
Effective: next page.
Default: 1 i.
Text Settings
\n[PS] [Register]
Defines the point size of the body text. If the value is larger than or equal
to 1000, divide it by 1000 to get a fractional point size. For example, ‘.nr
PS 10250’ sets the document’s point size to 10.25 p.
Effective: next paragraph.
Default: 10 p.
34 The GNU Troff Manual
\n[VS] [Register]
Defines the space between lines (line height plus leading). If the value is
larger than or equal to 1000, divide it by 1000 to get a fractional point
size. Due to backwards compatibility, VS must be smaller than 40000
(this is 40.0 p).
Effective: next paragraph.
Default: 12 p.
\n[PSINCR] [Register]
Defines an increment in point size, which is applied to section headings at
nesting levels below the value specified in GROWPS. The value of PSINCR
should be specified in points, with the p scaling factor, and may include
a fractional component; for example, ‘.nr PSINCR 1.5p’ sets a point size
increment of 1.5 p.
Effective: next section heading.
Default: 1 p.
\n[GROWPS] [Register]
Defines the heading level below which the point size increment set by
PSINCR becomes effective. Section headings at and above the level spec-
ified by GROWPS are printed at the point size set by PS; for each level
below the value of GROWPS, the point size is increased in steps equal to
the value of PSINCR. Setting GROWPS to any value less than 2 disables the
incremental heading size feature.
Effective: next section heading.
Default: 0.
\n[HY] [Register]
Defines the hyphenation level. HY sets safely the value of the low-level hy
register. Setting the value of HY to 0 is equivalent to using the nh request.
Effective: next paragraph.
Default: 6.
\n[FAM] [Register]
Defines the font family used to typeset the document.
Effective: next paragraph.
Default: as defined in the output device.
Paragraph Settings
\n[PI] [Register]
Defines the initial indentation of a (PP macro) paragraph.
Effective: next paragraph.
Default: 5 n.
Chapter 4: Macro Packages 35
\n[PD] [Register]
Defines the space between paragraphs.
Effective: next paragraph.
Default: 0.3 v.
\n[QI] [Register]
Defines the indentation on both sides of a quoted (QP, QS, and QE macros)
paragraph.
Effective: next paragraph.
Default: 5 n.
\n[PORPHANS] [Register]
Defines the minimum number of initial lines of any paragraph that should
be kept together, to avoid orphan lines at the bottom of a page. If a new
paragraph is started close to the bottom of a page, and there is insufficient
space to accommodate PORPHANS lines before an automatic page break,
then the page break is forced, before the start of the paragraph.
Effective: next paragraph.
Default: 1.
\n[HORPHANS] [Register]
Defines the minimum number of lines of the following paragraph that
should be kept together with any section heading introduced by the NH or
SH macros. If a section heading is placed close to the bottom of a page,
and there is insufficient space to accommodate both the heading and at
least HORPHANS lines of the following paragraph, before an automatic page
break, then the page break is forced before the heading.
Effective: next paragraph.
Default: 1.
Footnote Settings
\n[FL] [Register]
Defines the length of a footnote.
Effective: next footnote.
Default: \n[LL] ∗ 5/6.
\n[FI] [Register]
Defines the footnote indentation.
Effective: next footnote.
Default: 2 n.
\n[FF] [Register]
The footnote format:
0 Print the footnote number as a superscript; indent the foot-
note (default).
36 The GNU Troff Manual
\n[FPS] [Register]
Defines the footnote point size. If the value is larger than or equal to
1000, divide it by 1000 to get a fractional point size.
Effective: next footnote.
Default: \n[PS] − 2.
\n[FVS] [Register]
Defines the footnote vertical spacing. If the value is larger than or equal
to 1000, divide it by 1000 to get a fractional point size.
Effective: next footnote.
Default: \n[FPS] + 2.
\n[FPD] [Register]
Defines the footnote paragraph spacing.
Effective: next footnote.
Default: \n[PD]/2.
\n[DD] [Register]
Sets the vertical spacing before and after a display, a tbl table, an eqn
equation, or a pic image.
Effective: next paragraph.
Default: 0.5 v.
...
.AI [Macro]
Specifies the author’s institution. You can specify multiple institutions
in the same way that you specify multiple authors.
.AB [no] [Macro]
Begins the abstract. The default is to print the word ABSTRACT, cen-
tered and in italics, above the text of the abstract. The word no as an
optional argument suppresses this heading.
38 The GNU Troff Manual
.AE [Macro]
Ends the abstract.
The following is example mark-up for a title page.
.RP
.TL
The Inevitability of Code Bloat
in Commercial and Free Software
.AU
J. Random Luser
.AI
University of West Bumblefuzz
.AB
This report examines the long-term growth
of the code bases in two large, popular software
packages; the free Emacs and the commercial
Microsoft Word.
While differences appear in the type or order
of features added, due to the different
methodologies used, the results are the same
in the end.
.PP
The free software approach is shown to be
superior in that while free software can
become as bloated as commercial offerings,
free software tends to have fewer serious
bugs and the added features are in line with
user demand.
.AE
4.3.5.1 Paragraphs
The following paragraph types are available.
.PP [Macro]
Sets a paragraph with an initial indentation.
.LP [Macro]
Sets a paragraph without an initial indentation.
Chapter 4: Macro Packages 39
.QP [Macro]
Sets a paragraph that is indented at both left and right margins by
the amount of the register QI. The effect is identical to the HTML
<BLOCKQUOTE> element. The next paragraph or heading returns mar-
gins to normal. QP inserts vertical space of amount set by register PD
before the paragraph.
.QS [Macro]
.QE [Macro]
These macros begin and end a quoted section. The QI register controls
the amount of indentation. Both QS and QE insert inter-paragraph vertical
space set by register PD. The text between QS and QE can be structured
further by use of the macros LP or PP.
.XP [Macro]
Sets a paragraph whose lines are indented, except for the first line. This
is a Berkeley extension.
The following markup uses all four paragraph macros.
40 The GNU Troff Manual
.NH 2
Cases used in the study
.LP
The following software and versions were
considered for this report.
.PP
For commercial software, we chose
.B "Microsoft Word for Windows" ,
starting with version 1.0 through the
current version (Word 2000).
.PP
For free software, we chose
.B Emacs ,
from its first appearance as a standalone
editor through the current version (v20).
See [Bloggs 2002] for details.
.QP
Franklin’s Law applied to software:
software expands to outgrow both
RAM and disk space over time.
.LP
Bibliography:
.XP
Bloggs, Joseph R.,
.I "Everyone’s a Critic" ,
Underground Press, March 2002.
A definitive work that answers all questions
and criticisms about the quality and usability of
free software.
The PORPHANS register (see Section 4.3.3 [ms Document Control Regis-
ters], page 33) operates in conjunction with each of these macros, to inhibit
the printing of orphan lines at the bottom of any page.
4.3.5.2 Headings
Use headings to create a hierarchical structure for your document. The ms
macros print headings in bold, using the same font family and point size as
the body text.
The following describes the heading macros:
.NH curr-level [Macro]
.NH S level0 . . . [Macro]
Numbered heading. The argument is either a numeric argument to indi-
cate the level of the heading, or the letter S followed by numeric arguments
to set the heading level explicitly.
Chapter 4: Macro Packages 41
4.3.5.3 Highlighting
The ms macros provide a variety of methods to highlight or emphasize text:
.B [txt [post [pre]]] [Macro]
Sets its first argument in bold type. If you specify a second argument,
groff prints it in the previous font after the bold text, with no inter-
vening space (this allows you to set punctuation after the highlighted
42 The GNU Troff Manual
\*[{] [String]
\*[}] [String]
Text enclosed with \*{ and \*} is printed as a superscript.
4.3.5.4 Lists
The IP macro handles duties for all lists.
o lawyers
o guns
o money
The following is an example of a numbered list.
.nr step 1 1
A numbered list:
.IP \n[step] 3
lawyers
.IP \n+[step]
guns
.IP \n+[step]
money
Produces:
44 The GNU Troff Manual
A numbered list:
1. lawyers
2. guns
3. money
A glossary-style list:
.IP lawyers 0.4i
Two or more attorneys.
.IP guns
Firearms, preferably
large-caliber.
.IP money
Gotta pay for those
lawyers and guns!
Produces:
A glossary-style list:
lawyers
Two or more attorneys.
money
Gotta pay for those lawyers and guns!
In the last example, the IP macro places the definition on the same line
as the term if it has enough space; otherwise, it breaks to the next line and
starts the definition below the term. This may or may not be the effect
you want, especially if some of the definitions break and some do not. The
following examples show two possible ways to force a break.
The first workaround uses the br request to force a break after printing
the term or label.
Chapter 4: Macro Packages 45
A glossary-style list:
.IP lawyers 0.4i
Two or more attorneys.
.IP guns
.br
Firearms, preferably large-caliber.
.IP money
Gotta pay for those lawyers and guns!
The second workaround uses the \p escape to force the break. Note the
space following the escape; this is important. If you omit the space, groff
prints the first word on the same line as the term or label (if it fits) then
breaks the line.
A glossary-style list:
.IP lawyers 0.4i
Two or more attorneys.
.IP guns
\p Firearms, preferably large-caliber.
.IP money
Gotta pay for those lawyers and guns!
To set nested lists, use the RS and RE macros. See Section 4.3.5.5 [Inden-
tation values in ms], page 46, for more information.
For example:
.IP \[bu] 2
Lawyers:
.RS
.IP \[bu]
Dewey,
.IP \[bu]
Cheatham,
.IP \[bu]
and Howe.
.RE
.IP \[bu]
Guns
Produces:
46 The GNU Troff Manual
o Lawyers:
o Dewey,
o Cheatham,
o and Howe.
o Guns
.DE [Macro]
Indents the display as defined by the DI register. The ‘.DS I’ call gen-
erates a page break, if necessary, to keep the entire display on one page.
The ID macro allows the display to break across pages. The DE macro
ends the display.
.DS B [Macro]
.BD [Macro]
.DE [Macro]
Sets a block-centered display: the entire display is left-justified, but in-
dented so that the longest line in the display is centered on the page. The
‘.DS B’ call generates a page break, if necessary, to keep the entire display
on one page. The BD macro allows the display to break across pages. The
DE macro ends the display.
.DS C [Macro]
.CD [Macro]
.DE [Macro]
Sets a centered display: each line in the display is centered. The ‘.DS C’
call generates a page break, if necessary, to keep the entire display on one
page. The CD macro allows the display to break across pages. The DE
macro ends the display.
.DS R [Macro]
.RD [Macro]
.DE [Macro]
Right-justifies each line in the display. The ‘.DS R’ call generates a page
break, if necessary, to keep the entire display on one page. The RD macro
allows the display to break across pages. The DE macro ends the display.
.Ds [Macro]
.De [Macro]
These two macros were formerly provided as aliases for DS and DE, re-
spectively. They have been removed, and should no longer be used. The
original implementations of DS and DE are retained, and should be used
instead. X11 documents that actually use Ds and De always load a spe-
cific macro file from the X11 distribution (macros.t) that provides proper
definitions for the two macros.
On occasion, you may want to keep other text together on a page. For
example, you may want to keep two paragraphs together, or a paragraph
that refers to a table (or list, or other item) immediately following. The ms
macros provide the KS and KE macros for this purpose.
.KS [Macro]
.KE [Macro]
The KS macro begins a block of text to be kept on a single page, and the
KE macro ends the block.
48 The GNU Troff Manual
.KF [Macro]
.KE [Macro]
Specifies a floating keep; if the keep cannot fit on the current page, groff
holds the contents of the keep and allows text following the keep (in the
source file) to fill in the remainder of the current page. When the page
breaks, whether by an explicit bp request or by reaching the end of the
page, groff prints the floating keep at the top of the new page. This
is useful for printing large graphics or tables that do not need to appear
exactly where specified.
You can also use the ne request to force a page break if there is not
enough vertical space remaining on the page.
Use the following macros to draw a box around a section of text (such as
a display).
.B1 [Macro]
.B2 [Macro]
Marks the beginning and ending of text that is to have a box drawn
around it. The B1 macro begins the box; the B2 macro ends it. Text in
the box is automatically placed in a diversion (keep).
.PS [Macro]
.PE [Macro]
Denotes a graphic, to be processed by the pic preprocessor. You can
create a pic file by hand, using the AT&T pic manual available on the
Web as a reference, or by using a graphics program such as xfig.
.[ [Macro]
.] [Macro]
Denotes a reference, to be processed by the refer preprocessor. The GNU
refer(1) man page provides a comprehensive reference to the preprocessor
and the format of the bibliographic database.
4.3.5.10 Footnotes
The ms macro package has a flexible footnote system. You can specify either
numbered footnotes or symbolic footnotes (that is, using a marker such as a
dagger symbol).
\*[*] [String]
Specifies the location of a numbered footnote marker in the text.
.FS [Macro]
.FE [Macro]
Specifies the text of the footnote. The default action is to create a num-
bered footnote; you can create a symbolic footnote by specifying a mark
glyph (such as \[dg] for the dagger glyph) in the body text and as an
argument to the FS macro, followed by the text of the footnote and the
FE macro.
You can control how groff prints footnote numbers by changing the
value of the FF register. See Section 4.3.3 [ms Document Control Registers],
page 33.
Footnotes can be safely used within keeps and displays, but you should
avoid using numbered footnotes within floating keeps. You can set a second
\** marker between a \** and its corresponding .FS entry; as long as each
FS macro occurs after the corresponding \** and the occurrences of .FS are
in the same order as the corresponding occurrences of \**.
50 The GNU Troff Manual
\*[LH] [String]
\*[CH] [String]
\*[RH] [String]
Sets the left, center, and right headers.
\*[LF] [String]
\*[CF] [String]
\*[RF] [String]
Sets the left, center, and right footers.
For documents that need different information printed in the even and
odd pages, use the following macros:
.PT [Macro]
.HD [Macro]
.BT [Macro]
The PT macro defines a custom header; the BT macro defines a custom
footer. These macros must handle odd/even/first page differences if nec-
essary.
The HD macro defines additional header processing to take place after
executing the PT macro.
Chapter 4: Macro Packages 51
4.3.6.2 Margins
You control margins using a set of number registers. See Section 4.3.3 [ms
Document Control Registers], page 33, for details.
.1C [Macro]
Single-column mode.
.2C [Macro]
Two-column mode.
\*[Q] [String]
\*[U] [String]
Prints typographer’s quotes in troff, and plain quotes in nroff. \*Q is the
left quote and \*U is the right quote.
Improved accent marks are available in the ms macros.
.AM [Macro]
Specify this macro at the beginning of your document to enable extended
accent marks and special characters. This is a Berkeley extension.
To use the accent marks, place them after the character being accented.
Note that groff’s native support for accents is superior to the following
definitions.
The following accent marks are available after invoking the AM macro:
\*[’] [String]
Acute accent.
\*[‘] [String]
Grave accent.
\*[^] [String]
Circumflex.
\*[,] [String]
Cedilla.
\*[~] [String]
Tilde.
\*[:] [String]
Umlaut.
\*[v] [String]
Hacek.
\*[_] [String]
Macron (overbar).
\*[.] [String]
Underdot.
\*[o] [String]
Ring above.
The following are standalone characters available after invoking the AM
macro:
\*[?] [String]
Upside-down question mark.
Chapter 4: Macro Packages 55
\*[!] [String]
Upside-down exclamation point.
\*[8] [String]
German ß ligature.
\*[3] [String]
Yogh.
\*[Th] [String]
Uppercase thorn.
\*[th] [String]
Lowercase thorn.
\*[D-] [String]
Uppercase eth.
\*[d-] [String]
Lowercase eth.
\*[q] [String]
Hooked o.
\*[ae] [String]
Lowercase æ ligature.
\*[Ae] [String]
Uppercase Æ ligature.
• Macros that cause a reset (paragraphs, headings, etc.) may change the
indentation. Macros that change the indentation do not increment or
decrement the indentation, but rather set it absolutely. This can cause
problems for documents that define additional macros of their own. The
solution is to use not the in request but instead the RS and RE macros.
• To make groff -ms use the default page offset (which also specifies
the left margin), the PO register must stay undefined until the first -ms
macro is evaluated. This implies that PO should not be used early in
the document, unless it is changed also: Remember that accessing an
undefined register automatically defines it.
\n[GS] [Register]
This number register is set to 1 by the groff -ms macros, but it is not
used by the AT&T troff -ms macros. Documents that need to determine
whether they are being formatted with AT&T troff -ms or groff -ms
should use this number register.
Emulations of a few ancient Bell Labs macros can be re-enabled by calling
the otherwise undocumented SC section-header macro. Calling SC enables
UC for marking up a product or application name, and the pair P1/P2 for
surrounding code example displays.
These are not enabled by default because (a) they were not documented,
in the original ms manual, and (b) the P1 and UC macros collide with different
macros with the same names in the Berkeley version of ms.
These groff emulations are sufficient to give back the 1976 Kernighan &
Cherry paper Typesetting Mathematics – User’s Guide its section headings,
and restore some text that had gone missing as arguments of undefined
macros. No warranty express or implied is given as to how well the typo-
graphic details these produce match the original Bell Labs macros.
4.4 me
See the meintro.me and meref.me documents in groff’s doc directory.
4.5 mm
See the groff mm(7) man page (type man groff_mm at the command line).
4.6 mom
The main documentation files for the mom macros are in HTML format. Ad-
ditional, useful documentation is in PDF format. See the groff(1) man page,
section “Installation Directories”, for their location.
• toc.html Entry point to the full mom manual.
• macrolist.html Hyperlinked index of macros with brief descriptions,
arranged by category.
• mom-pdf.pdf PDF features and usage.
The mom macros are in active development between groff releases. The
most recent version, along with up-to-date documentation, is available at
http://www.schaffter.ca/mom/mom-05.html.
The groff mom(7) man page (type man groff_mom at the command line)
contains a partial list of available macros, however their usage is best under-
stood by consulting the HTML documentation.
59
5 gtroff Reference
This chapter covers all of the facilities of gtroff. Users of macro packages
may skip it if not interested in details.
5.1 Text
gtroff input files contain text with control commands interspersed through-
out. But, even without control codes, gtroff still does several things with
the input text:
• filling and adjusting
• adding additional space after sentences
• hyphenating
• inserting implicit line breaks
5.1.2 Hyphenation
Since the odds are not great for finding a set of words, for every output
line, which fit nicely on a line without inserting excessive amounts of space
between words, gtroff hyphenates words so that it can justify lines without
inserting too much space between words. It uses an internal hyphenation
algorithm (a simplified version of the algorithm used within TEX) to indicate
which words can be hyphenated and how to do so. When a word is hyphen-
ated, the first part of the word is added to the current filled line being output
(with an attached hyphen), and the other portion is added to the next line
to be filled.
See Section 5.8 [Manipulating Hyphenation], page 84.
5.1.3 Sentences
Although it is often debated, some typesetting rules say there should be
different amounts of space after various punctuation marks. For example,
the Chicago typesetting manual says that a period at the end of a sentence
should have twice as much space following it as would a comma or a period
as part of an abbreviation.
60 The GNU Troff Manual
gtroff does this by flagging certain characters (normally ‘!’, ‘?’, and
‘.’) as end-of-sentence characters. When gtroff encounters one of these
characters at the end of a line, it appends a normal space followed by a
sentence space in the formatted output. (This justifies one of the conventions
mentioned in Section 5.1.6 [Input Conventions], page 61.)
In addition, the following characters and symbols are treated transpar-
ently while handling end-of-sentence characters: ‘"’, ‘’’, ‘)’, ‘]’, ‘*’, \[dg],
\[rq], and \[cq].
See the cflags request in Section 5.17.4 [Using Symbols], page 114, for
more details.
To prevent the insertion of extra space after an end-of-sentence character
(at the end of a line), append \&.
Due to the importance of the Euro glyph in Europe, the groff package now
comes with a PostScript font called freeeuro.pfa, which provides various
glyph shapes for the Euro. In other words, latin-9 encoding is supported for
the -Tps device out of the box (latin-2 isn’t).
By its very nature, -Tutf8 supports all input encodings; -Tdvi has sup-
port for both latin-2 and latin-9 if the command-line -mec is used also to
load the file ec.tmac (which flips to the EC fonts).
5.2 Measurements
gtroff (like many other programs) requires numeric parameters to specify
various measurements. Most numeric parameters1 may have a measurement
unit attached. These units are specified as a single character that immedi-
ately follows the number or expression. Each of these units are understood,
by gtroff, to be a multiple of its basic unit. So, whenever a different mea-
surement unit is specified gtroff converts this into its basic units. This
basic unit, represented by a ‘u’, is a device dependent measurement, which
is quite small, ranging from 1/75 th to 1/72000 th of an inch. The values may
be given as fractional numbers; however, fractional basic units are always
rounded to integers.
Some of the measurement units are completely independent of any of the
current settings (e.g. type size) of gtroff.
Although groff’s basic unit is device-dependent, it may still be smaller
than the smallest unit the device is capable of producing. The register .H
specifies how many groff basic units constitute the current device’s basic unit
horizontally, and the register .V specifies this value vertically.
i Inches. An antiquated measurement unit still in use in certain
backwards countries with incredibly low-cost computer equip-
ment. One inch is defined to be 2.54 cm (worldwide since 1964).
c Centimeters. One centimeter is about 0.3937 in.
p Points. This is a typesetter’s measurement used for measure
type size. It is 72 points to an inch.
P Pica. Another typesetting measurement. 6 picas to an inch (and
12 points to a pica).
s
z See Section 5.18.2 [Fractional Type Sizes], page 130, for a dis-
cussion of these units.
f Fractions. Value is 65536. See Section 5.28 [Colors], page 169,
for usage.
1
those that specify vertical or horizontal motion or a type size
Chapter 5: gtroff Reference 63
5.3 Expressions
gtroff has most arithmetic operators common to other languages:
• Arithmetic: ‘+’ (addition), ‘-’ (subtraction), ‘/’ (division), ‘*’ (multipli-
cation), ‘%’ (modulo).
gtroff only provides integer arithmetic. The internal type used for
computing results is ‘int’, which is usually a 32-bit signed integer.
• Comparison: ‘<’ (less than), ‘>’ (greater than), ‘<=’ (less than or equal),
‘>=’ (greater than or equal), ‘=’ (equal), ‘==’ (the same as ‘=’).
• Logical: ‘&’ (logical and), ‘:’ (logical or).
64 The GNU Troff Manual
• Unary operators: ‘-’ (negating, i.e. changing the sign), ‘+’ (just for
completeness; does nothing in expressions), ‘!’ (logical not; this works
only within if and while requests).2 See below for the use of unary
operators in motion requests.
The logical not operator, as described above, works only within if and
while requests. Furthermore, it may appear only at the beginning of
an expression, and negates the entire expression. Attempting to insert
the ‘!’ operator within the expression results in a ‘numeric expression
expected’ warning. This maintains compatibility with old versions of
troff.
Example:
.nr X 1
.nr Y 0
.\" This does not work as expected
.if (\n[X])&(!\n[Y]) .nop X only
.
.\" Use this construct instead
.if (\n[X]=1)&(\n[Y]=0) .nop X only
• Extrema: ‘>?’ (maximum), ‘<?’ (minimum).
Example:
.nr x 5
.nr y 3
.nr z (\n[x] >? \n[y])
The register z now contains 5.
• Scaling: (c;e). Evaluate e using c as the default scaling indicator. If
c is missing, ignore scaling indicators in the evaluation of e.
Parentheses may be used as in any other language. However, in gtroff
they are necessary to ensure order of evaluation. gtroff has no operator
precedence; expressions are evaluated left to right. This means that gtroff
evaluates ‘3+5*4’ as if it were parenthesized like ‘(3+5)*4’, not as ‘3+(5*4)’,
as might be expected.
For many requests that cause a motion on the page, the unary operators
‘+’ and ‘-’ work differently if leading an expression. They then indicate a
motion relative to the current position (down or up, respectively).
Similarly, a leading ‘|’ operator indicates an absolute position. For ver-
tical movements, it specifies the distance from the top of the page; for hor-
izontal movements, it gives the distance from the beginning of the input
line.
‘+’ and ‘-’ are also treated differently by the following requests and es-
capes: bp, in, ll, lt, nm, nr, pl, pn, po, ps, pvs, rt, ti, \H, \R, and \s.
Here, leading plus and minus signs indicate increments and decrements.
2
Note that, for example, ‘!(-1)’ evaluates to ‘true’ because gtroff treats both negative
numbers and zero as ‘false’.
Chapter 5: gtroff Reference 65
See Section 5.6.1 [Setting Registers], page 72, for some examples.
\B’anything’ [Escape]
Return 1 if anything is a valid numeric expression; or 0 if anything is
empty or not a valid numeric expression.
Due to the way arguments are parsed, spaces are not allowed in expres-
sions, unless the entire expression is surrounded by parentheses.
See Section 5.5.1.1 [Request and Macro Arguments], page 68, and
Section 5.20 [Conditionals and Loops], page 136.
5.4 Identifiers
Like any other language, gtroff has rules for properly formed identifiers.
In gtroff, an identifier can be made up of almost any printable character,
with the exception of the following characters:
• Whitespace characters (spaces, tabs, and newlines).
• Backspace (ASCII 0x08 or EBCDIC 0x16) and character code 0x01.
• The following input characters are invalid and are ignored if groff runs
on a machine based on ASCII, causing a warning message of type ‘input’
(see Section 5.33 [Debugging], page 180, for more details): 0x00, 0x0B,
0x0D–0x1F, 0x80–0x9F.
And here are the invalid input characters if groff runs on an EBCDIC
host: 0x00, 0x08, 0x09, 0x0B, 0x0D–0x14, 0x17–0x1F, 0x30–0x3F.
Currently, some of these reserved codepoints are used internally, thus
making it non-trivial to extend gtroff to cover Unicode or other char-
acter sets and encodings that use characters of these ranges.
Note that invalid characters are removed before parsing; an identifier
foo, followed by an invalid character, followed by bar is treated as
foobar.
For example, any of the following is valid.
br
PP
(l
end-list
@_
Note that identifiers longer than two characters with a closing bracket (‘]’)
in its name can’t be accessed with escape sequences that expect an identifier
as a parameter. For example, ‘\[foo]]’ accesses the glyph ‘foo’, followed
by ‘]’, whereas ‘\C’foo]’’ really asks for glyph ‘foo]’.
To avoid problems with the refer preprocessor, macro names should not
start with ‘[’ or ‘]’. Due to backwards compatibility, everything after ‘.[’
and ‘.]’ is handled as a special argument to refer. For example, ‘.[foo’
makes refer to start a reference, using ‘foo’ as a parameter.
66 The GNU Troff Manual
\A’ident’ [Escape]
Test whether an identifier ident is valid in gtroff. It expands to the
character 1 or 0 according to whether its argument (usually delimited by
quotes) is or is not acceptable as the name of a string, macro, diversion,
number register, environment, or font. It returns 0 if no argument is
given. This is useful for looking up user input in some sort of associative
table.
\A’end-list’
⇒ 1
See Section 5.5.3 [Escapes], page 70, for details on parameter delimiting
characters.
Identifiers in gtroff can be any length, but, in some contexts, gtroff
needs to be told where identifiers end and text begins (and in different ways
depending on their length):
• Single character.
• Two characters. Must be prefixed with ‘(’ in some situations.
• Arbitrary length (gtroff only). Must be bracketed with ‘[’ and ‘]’ in
some situations. Any length identifier can be put in brackets.
Unlike many other programming languages, undefined identifiers are
silently ignored or expanded to nothing. When gtroff finds an undefined
identifier, it emits a warning, doing the following:
• If the identifier is a string, macro, or diversion, gtroff defines it as
empty.
• If the identifier is a number register, gtroff defines it with a value of 0.
See Section 5.33.1 [Warnings], page 183., Section 5.6.2 [Interpolating Reg-
isters], page 74, and Section 5.19 [Strings], page 131.
Note that macros, strings, and diversions share the same name space.
.de xxx
. nop foo
..
.
.di xxx
bar
.br
.di
.
.xxx
⇒ bar
As can be seen in the previous example, gtroff reuses the identifier ‘xxx’,
changing it from a macro to a diversion. No warning is emitted! The contents
of the first macro definition is lost.
See Section 5.6.2 [Interpolating Registers], page 74, and Section 5.19
[Strings], page 131.
Chapter 5: gtroff Reference 67
5.5.1 Requests
A request line begins with a control character, which is either a single quote
(‘’’, the no-break control character) or a period (‘.’, the normal control
character). These can be changed; see Section 5.11 [Character Translations],
page 96, for details. After this there may be optional tabs or spaces followed
by an identifier, which is the name of the request. This may be followed by
any number of space-separated arguments (no tabs here).
Since a control character followed by whitespace only is ignored, it is com-
mon practice to use this feature for structuring the source code of documents
or macro packages.
.de foo
. tm This is foo.
..
.
.
.de bar
. tm This is bar.
..
Another possibility is to use the blank line macro request blm by assigning
an empty macro to it.
.de do-nothing
..
.blm do-nothing \" activate blank line macro
.de foo
. tm This is foo.
..
.de bar
. tm This is bar.
..
5.5.2 Macros
gtroff has a macro facility for defining a series of lines that can be invoked
by name. They are called in the same manner as requests – arguments also
may be passed basically in the same manner.
See Section 5.21 [Writing Macros], page 141, and Section 5.5.1.1 [Request
and Macro Arguments], page 68.
70 The GNU Troff Manual
5.5.3 Escapes
Escapes may occur anywhere in the input to gtroff. They usually begin
with a backslash and are followed by a single character, which indicates
the function to be performed. The escape character can be changed; see
Section 5.11 [Character Translations], page 96.
Escape sequences that require an identifier as a parameter accept three
possible syntax forms.
• The next single character is the identifier.
• If this single character is an opening parenthesis, take the following two
characters as the identifier. Note that there is no closing parenthesis
after the identifier.
• If this single character is an opening bracket, take all characters until a
closing bracket as the identifier.
Examples:
\fB
\n(XX
\*[TeX]
Other escapes may require several arguments and/or some special format.
In such cases the argument is traditionally enclosed in single quotes (and
quotes are always used in this manual for the definitions of escape sequences).
The enclosed text is then processed according to what that escape expects.
Example:
\l’1.5i\(bu’
Note that the quote character can be replaced with any other character
that does not occur in the argument (even a newline or a space character)
in the following escapes: \o, \b, and \X. This makes e.g.
A caf
\o
e\’
in Paris
⇒ A café in Paris
possible, but it is better not to use this feature to avoid confusion.
The following escape sequences (which are handled similarly to characters
since they don’t take a parameter) are also allowed as delimiters: \%, ‘\ ’,
\|, \^, \{, \}, \’, \‘, \-, \_, \!, \?, \), \/, \,, \&, \:, \~, \0, \a, \c, \d,
\e, \E, \p, \r, \t, and \u. Again, don’t use these if possible.
No newline characters as delimiters are allowed in the following escapes:
\A, \B, \Z, \C, and \w.
Finally, the escapes \D, \h, \H, \l, \L, \N, \R, \s, \S, \v, and \x can’t
use the following characters as delimiters:
Chapter 5: gtroff Reference 71
5.5.3.1 Comments
Probably one of the most5 common forms of escapes is the comment.
\" [Escape]
Start a comment. Everything to the end of the input line is ignored.
This may sound simple, but it can be tricky to keep the comments from
interfering with the appearance of the final output.
If the escape is to the right of some text or a request, that portion of the
line is ignored, but the space leading up to it is noticed by gtroff. This
only affects the ds and as request and its variants.
One possibly irritating idiosyncracy is that tabs must not be used to line
up comments. Tabs are not treated as whitespace between the request
and macro arguments.
A comment on a line by itself is treated as a blank line, because after
eliminating the comment, that is all that remains:
Test
\" comment
Test
produces
Test
Test
To avoid this, it is common to start the line with .\", which causes the
line to be treated as an undefined request and thus ignored completely.
Another commenting scheme seen sometimes is three consecutive single
quotes (’’’) at the beginning of a line. This works, but gtroff gives a
warning about an undefined macro (namely ’’), which is harmless, but
irritating.
5
Unfortunately, this is a lie. But hopefully future gtroff hackers will believe it :-)
72 The GNU Troff Manual
\# [Escape]
To avoid all this, gtroff has a new comment mechanism using the \#
escape. This escape works the same as \" except that the newline is also
ignored:
Test
\# comment
Test
produces
Test Test
as expected.
5.6 Registers
Numeric variables in gtroff are called registers. There are a number of
built-in registers, supplying anything from the date to details of formatting
parameters.
See Section 5.4 [Identifiers], page 65, for details on register identifiers.
\ni [Escape]
\n(id [Escape]
\n[ident] [Escape]
Interpolate number register with name ident (one-character name i, two-
character name id). This means that the value of the register is expanded
in-place while gtroff is parsing the input line. Nested assignments (also
called indirect assignments) are possible.
.nr a 5
.nr as \na+\na
\n(as
⇒ 10
.nr a1 5
.nr ab 6
.ds str b
.ds num 1
\n[a\n[num]]
⇒ 5
\n[a\*[str]]
⇒ 6
5.6.3 Auto-increment
Number registers can also be auto-incremented and auto-decremented. The
increment or decrement value can be specified with a third argument to the
nr request or \R escape.
\n+i [Escape]
\n-i [Escape]
\n+(id [Escape]
\n-(id [Escape]
\n+[ident] [Escape]
\n-[ident] [Escape]
Before interpolating, increment or decrement ident (one-character name i,
two-character name id) by the auto-increment value as specified with
the nr request (or the \R escape). If no auto-increment value has been
specified, these syntax forms are identical to \n.
For example,
76 The GNU Troff Manual
.nr a 0 1
.nr xx 0 5
.nr foo 0 -2
\n+a, \n+a, \n+a, \n+a, \n+a
.br
\n-(xx, \n-(xx, \n-(xx, \n-(xx, \n-(xx
.br
\n+[foo], \n+[foo], \n+[foo], \n+[foo], \n+[foo]
produces
1, 2, 3, 4, 5
-5, -10, -15, -20, -25
-2, -4, -6, -8, -10
To change the increment value without changing the value of a register
(a in the example), the following can be used:
.nr a \na 10
\n[seconds]
The number of seconds after the minute, normally in the range 0
to 59, but can be up to 61 to allow for leap seconds. Initialized
at start-up of gtroff.
\n[minutes]
The number of minutes after the hour, in the range 0 to 59.
Initialized at start-up of gtroff.
\n[hours]
The number of hours past midnight, in the range 0 to 23. Ini-
tialized at start-up of gtroff.
\n[dw] Day of the week (1–7).
\n[dy] Day of the month (1–31).
\n[mo] Current month (1–12).
\n[year] The current year.
\n[yr] The current year minus 1900. Unfortunately, the documentation
of Unix Version 7’s troff had a year 2000 bug: It incorrectly
claimed that yr contains the last two digits of the year. That
claim has never been true of either AT&T troff or GNU troff.
Old troff input that looks like this:
’\" The following line stopped working after 1999
This document was formatted in 19\n(yr.
can be corrected as follows:
This document was formatted in \n[year].
or, to be portable to older troff versions, as follows:
.nr y4 1900+\n(yr
This document was formatted in \n(y4.
\n[.c]
\n[c.] The current input line number. Register ‘.c’ is read-only,
whereas ‘c.’ (a gtroff extension) is writable also, affecting both
‘.c’ and ‘c.’.
\n[ln] The current output line number after a call to the nm request to
activate line numbering.
See Section 5.31 [Miscellaneous], page 176, for more information
about line numbering.
\n[.x] The major version number. For example, if the version number
is 1.03 then .x contains ‘1’.
\n[.y] The minor version number. For example, if the version number
is 1.03 then .y contains ‘03’.
\n[.Y] The revision number of groff.
Chapter 5: gtroff Reference 79
The fill mode status is associated with the current environment (see
Section 5.26 [Environments], page 166).
See Section 5.14 [Line Control], page 104, for interaction with the \c
escape.
.nf [Request]
Activate no-fill mode. Input lines are output as-is, retaining line breaks
and ignoring the current line length. This command implicitly disables
adjusting; it also causes a break. The number register .u is set to 0.
The fill mode status is associated with the current environment (see
Section 5.26 [Environments], page 166).
See Section 5.14 [Line Control], page 104, for interaction with the \c
escape.
b
n Justify to both margins. This is the default used by gtroff.
.de AD
. br
. ad \\$1
..
.
.de NA
. br
. na
..
.
textA
.AD r
.nr ad \n[.j]
textB
.AD c
textC
.NA
textD
.AD \" back to centering
textE
.AD \n[ad] \" back to right justifying
textF
produces the following output:
textA
textB
textC
textD
textE
textF
As just demonstrated, the current adjustment mode is available in the
read-only number register .j; it can be stored and subsequently used to
set adjustment.
The adjustment mode status is associated with the current environment
(see Section 5.26 [Environments], page 166).
.na [Request]
Disable adjusting. This request won’t change the current adjustment
mode: A subsequent call to ad uses the previous adjustment setting.
The adjustment mode status is associated with the current environment
(see Section 5.26 [Environments], page 166).
.brp [Request]
\p [Escape]
Break, adjusting the current line per the current adjustment mode.
With \p, this break will happen at the next word boundary. The \p itself
is removed entirely, adding neither a break nor a space where it appears
82 The GNU Troff Manual
.ll 4.5i
1.\ This is the first footnote.\c
.ss 48
.nop
.ss 12
2.\ This is the second footnote.
The result:
1. This is the first footnote. 2. This
is the second footnote.
Note that the \h escape produces unbreakable space.
.ce [nnn] [Request]
\n[.ce] [Register]
Center text. While the ‘.ad c’ request also centers text, it fills the text
as well. ce does not fill the text it affects. This request causes a break.
The number of lines still to be centered is associated with the current
environment (see Section 5.26 [Environments], page 166).
The following example demonstrates the differences. Here is the input:
.ll 4i
.ce 1000
This is a small text fragment that shows the differences
between the ‘.ce’ and the ‘.ad c’ request.
.ce 0
.ad c
This is a small text fragment that shows the differences
between the ‘.ce’ and the ‘.ad c’ request.
And here the result:
This is a small text fragment that
shows the differences
between the ‘.ce’ and the ‘.ad c’ request.
The .ce read-only number register contains the number of lines remaining
to be centered, as set by the ce request.
.rj [nnn] [Request]
\n[.rj] [Register]
Justify unfilled text to the right margin. Arguments are identical to the
ce request. The .rj read-only number register is the number of lines to
be right-justified as set by the rj request. This request causes a break.
The number of lines still to be right-justified is associated with the current
environment (see Section 5.26 [Environments], page 166).
returns
s-
plit-
t-
in-
g
instead of the correct ‘split-ting’. US-English patterns as distributed
with groff need two characters at the beginning and three characters at
the end; this means that value 4 of hy is mandatory. Value 8 is possible
as an additional restriction, but values 1 (the default!), 16, and 32 should
be avoided.
Here is a table of left and right minimum values for hyphenation as needed
by the patterns distributed with groff; see the groff tmac(5) man page
(type man groff_tmac at the command line) for more information on
groff’s language macro files.
value, which is 0. The default scaling indicator for this request is ‘m’.
The hyphenation space is associated with the current environment (see
Section 5.26 [Environments], page 166).
A negative argument resets the hyphenation space to zero, emitting a
warning of type ‘range’.
The current hyphenation space is available in the .hys read-only number
register.
6
Soft hyphen character is a misnomer since it is an output glyph.
90 The GNU Troff Manual
For convenience you may wish to use the following macros to set the
height of the next line at a given distance from the top or the bottom of
the page:
.de y-from-top-down
. sp |\\$1-\\n[.v]u
..
.
.de y-from-bot-up
. sp |\\n[.p]u-\\$1-\\n[.v]u
..
A call to ‘.y-from-bot-up 10c’ means that the bottom of the next line
will be at 10 cm from the paper edge at the bottom.
If a vertical trap is sprung during execution of sp, the amount of vertical
space after the trap is discarded. For example, this
.de xxx
..
.
.wh 0 xxx
.
.pl 5v
foo
.sp 2
bar
.sp 50
baz
results in
foo
bar
baz
The amount of discarded space is available in the number register .trunc.
To protect sp against vertical traps, use the vpt request:
.vpt 0
.sp -3
.vpt 1
.ls [nnn] [Request]
\n[.L] [Register]
Output nnn−1 blank lines after each line of text. With no argument,
gtroff uses the previous value before the last ls call.
.ls 2 \" This causes double-spaced output
.ls 3 \" This causes triple-spaced output
.ls \" Again double-spaced
Chapter 5: gtroff Reference 91
\t [Escape]
This escape is a non-interpreted tab character. In copy mode (see
Section 5.21.1 [Copy-in Mode], page 144), \t is the same as a real tab
character.
specified by appending ‘R’, ‘L’, or ‘C’ to the tab specifier. The default
justification is ‘L’. Example:
.ta 1i 2iC 3iR
Some notes:
• The default unit of the ta request is ‘m’.
• A tab stop is converted into a non-breakable horizontal movement
that can be neither stretched nor squeezed. For example,
.ds foo a\tb\tc
.ta T 5i
\*[foo]
creates a single line, which is a bit longer than 10 inches (a string is
used to show exactly where the tab characters are). Now consider
the following:
.ds bar a\tb b\tc
.ta T 5i
\*[bar]
gtroff first converts the tab stops of the line into unbreakable hori-
zontal movements, then splits the line after the second ‘b’ (assuming
a sufficiently short line length). Usually, this isn’t what the user
wants.
• Superfluous tabs (i.e., tab characters that do not correspond to a
tab stop) are ignored except the first one, which delimits the char-
acters belonging to the last tab stop for right-justifying or centering.
Consider the following example
.ds Z foo\tbar\tfoo
.ds ZZ foo\tbar\tfoobar
.ds ZZZ foo\tbar\tfoo\tbar
.ta 2i 4iR
\*[Z]
.br
\*[ZZ]
.br
\*[ZZZ]
.br
which produces the following output:
foo bar foo
foo bar foobar
foo bar foobar
The first line right-justifies the second ‘foo’ relative to the tab stop.
The second line right-justifies ‘foobar’. The third line finally right-
justifies only ‘foo’ because of the additional tab character, which
marks the end of the string belonging to the last defined tab stop.
94 The GNU Troff Manual
5.10.1 Leaders
Sometimes it may be desirable to use the tc request to fill a particular
tab stop with a given glyph (for example dots in a table of contents), but
7
Tab repetition character is a misnomer since it is an output glyph.
Chapter 5: gtroff Reference 95
also normal tab stops on the rest of the line. For this gtroff provides an
alternate tab mechanism, called leaders, which does just that.
A leader character (character code 1) behaves similarly to a tab character:
It moves to the next tab stop. The only difference is that for this movement,
the fill glyph defaults to a period character and not to space.
\a [Escape]
This escape is a non-interpreted leader character. In copy mode (see
Section 5.21.1 [Copy-in Mode], page 144), \a is the same as a real leader
character.
.lc [fill-glyph] [Request]
Declare the leader repetition character.8 Without an argument, leaders
act the same as tabs (i.e., using whitespace for filling). gtroff’s start-
up value is a dot (‘.’). The value of the leader repetition character is
associated with the current environment (see Section 5.26 [Environments],
page 166).
For a table of contents, to name an example, tab stops may be defined
so that the section number is one tab stop, the title is the second with the
remaining space being filled with a line of dots, and then the page number
slightly separated from the dots.
.ds entry 1.1\tFoo\a\t12
.lc .
.ta 1i 5i +.25i
\*[entry]
This produces
1.1 Foo.......................................... 12
5.10.2 Fields
Fields are a more general way of laying out tabular data. A field is defined as
the data between a pair of delimiting characters. It contains substrings that
are separated by padding characters. The width of a field is the distance on
the input line from the position where the field starts to the next tab stop. A
padding character inserts stretchable space similar to TEX’s \hss command
(thus it can even be negative) to make the sum of all substring lengths plus
the stretchable space equal to the field width. If more than one padding
character is inserted, the available space is evenly distributed among them.
.fc [delim-char [padding-char]] [Request]
Define a delimiting and a padding character for fields. If the latter is
missing, the padding character defaults to a space character. If there is
no argument at all, the field mechanism is disabled (which is the default).
Note that contrary to e.g. the tab repetition character, delimiting and
8
Leader repetition character is a misnomer since it is an output glyph.
96 The GNU Troff Manual
.eo [Request]
Disable the escape mechanism completely. After executing this request,
the backslash character ‘\’ no longer starts an escape sequence.
This request can be very helpful in writing macros since it is not necessary
then to double the escape character. Here an example:
Chapter 5: gtroff Reference 97
Nroff mode and Troff mode since the differences are hardcoded. For GNU
troff, this distinction is not appropriate because gtroff simply takes the
information given in the font files for a particular device without handling
requests specially if a TTY output device is used.
Usually, a macro package can be used with all output devices. Never-
theless, it is sometimes necessary to make a distinction between TTY and
non-TTY devices: gtroff provides two built-in conditions ‘n’ and ‘t’ for
the if, ie, and while requests to decide whether gtroff shall behave like
nroff or like troff.
.troff [Request]
Make the ‘t’ built-in condition true (and the ‘n’ built-in condition false)
for if, ie, and while conditional requests. This is the default if gtroff
(not groff) is started with the -R switch to avoid loading of the start-up
files troffrc and troffrc-end. Without -R, gtroff stays in troff mode
if the output device is not a TTY (e.g. ‘ps’).
.nroff [Request]
Make the ‘n’ built-in condition true (and the ‘t’ built-in condition false)
for if, ie, and while conditional requests. This is the default if gtroff
uses a TTY output device; the code for switching to nroff mode is in the
file tty.tmac, which is loaded by the start-up file troffrc.
See Section 5.20 [Conditionals and Loops], page 136, for more details on
built-in conditions.
A simple demonstration:
.ll 3i
This is text without indentation.
The line length has been set to 3\~inch.
.in +.5i
.ll -.5i
Now the left and right margins are both increased.
.in
.ll
Calling .in and .ll without parameters restore
the previous values.
Result:
This is text without indenta-
tion. The line length has
been set to 3 inch.
Now the left and
right margins are
both increased.
Calling .in and .ll without
parameters restore the previ-
ous values.
\n[.ll] [Register]
Set the line length to length (or increment or decrement the current value
by length). Initially, the line length is set to 6.5 i. The effect of ll is
delayed until a partially collected line (if it exists) is output. The default
scaling indicator is ‘m’.
If ll is called without an argument, the line length is reset to the previous
value before the last call to ll. If a negative line length is specified (which
is not allowed), gtroff emits a warning of type ‘range’ and sets the line
length to zero.
The line length is associated with the current environment (see
Section 5.26 [Environments], page 166).
The current line length (as set by ll) can be found in the read-only
number register ‘.l’. The read-only number register .ll is the line length
that applies to the current output line.
Similar to .i and .in, the difference between .l and .ll is that the latter
takes into account whether a partially collected line still uses the old line
length value.
This is a
\h’|1.2i’test.
produces
This is a test.
This is a test.
The main usage of this feature is to define macros that act exactly at the
place where called.
.\" A simple macro to underline a word
.de underline
. nop \\$1\l’|0\[ul]’
..
In the above example, ‘|0’ specifies a negative distance from the current
position (at the end of the just emitted argument \$1) back to the beginning
of the input line. Thus, the ‘\l’ escape draws a line from right to left.
gtroff makes a difference between input and output line continuation;
the latter is also called interrupting a line.
\RET [Escape]
\c [Escape]
Chapter 5: gtroff Reference 105
\n[.int] [Register]
Continue a line. \RET (this is a backslash at the end of a line immediately
followed by a newline) works on the input level, suppressing the effects
of the following newline in the input.
This is a \
.test
⇒ This is a .test
The ‘|’ operator is also affected.
\c works on the output level. Anything after this escape on the same
line is ignored except \R, which works as usual. Anything before \c on
the same line is appended to the current partial output line. The next
non-command line after an interrupted line counts as a new input line.
The visual results depend on whether no-fill mode is active.
• If no-fill mode is active (using the nf request), the next input text
line after \c is handled as a continuation of the same input text line.
.nf
This is a \c
test.
⇒ This is a test.
• If fill mode is active (using the fi request), a word interrupted with
\c is continued with the text on the next input text line, without an
intervening space.
This is a te\c
st.
⇒ This is a test.
Note that an intervening control line that causes a break is stronger than
\c, flushing out the current partial line in the usual way.
The .int register contains a positive value if the last output line was
interrupted with \c; this is associated with the current environment (see
Section 5.26 [Environments], page 166).
Note that this only specifies the size of the page, not the top and bottom
margins. Those are not set by gtroff directly. See Section 5.24 [Traps],
page 155, for further information on how to do this.
Negative pl values are possible also, but not very useful: No trap is
sprung, and each line is output on a single page (thus suppressing all
vertical spacing).
If no argument or an invalid argument is given, pl sets the page length
to 11 i.
gtroff provides several operations that help in setting up top and bottom
titles (or headers and footers).
.tl ’left’center’right’ [Request]
Print a title line. It consists of three parts: a left justified portion, a
centered portion, and a right justified portion. The argument separator
‘’’ can be replaced with any character not occurring in the title line. The
‘%’ character is replaced with the current page number. This character
can be changed with the pc request (see below).
Without argument, tl is ignored.
Some notes:
• The line length set by the ll request is not honoured by tl; use the
lt request (described below) instead, to control line length for text
set by tl.
• A title line is not restricted to the top or bottom of a page.
• tl prints the title line immediately, ignoring a partially filled line
(which stays untouched).
• It is not an error to omit closing delimiters. For example, ‘.tl /foo’
is equivalent to ‘.tl /foo///’: It prints a title line with the left
justified word ‘foo’; the centered and right justified parts are empty.
• tl accepts the same parameter delimiting characters as the \A escape;
see Section 5.5.3 [Escapes], page 70.
.lt [length] [Request]
.lt +length [Request]
.lt -length [Request]
\n[.lt] [Register]
The title line is printed using its own line length, which is specified (or
incremented or decremented) with the lt request. Initially, the title line
length is set to 6.5 i. If a negative line length is specified (which is not
allowed), gtroff emits a warning of type ‘range’ and sets the title line
length to zero. The default scaling indicator is ‘m’. If lt is called without
an argument, the title length is reset to the previous value before the last
call to lt.
The current setting of this is available in the .lt read-only number reg-
ister; it is associated with the current environment (see Section 5.26 [En-
vironments], page 166).
Chapter 5: gtroff Reference 107
is triggered (see Section 5.24 [Traps], page 155, for further information).
The default scaling indicator for ne is ‘v’; the default value of space is 1 v
if no argument is given.
For example, to make sure that no fewer than 2 lines get orphaned, do
the following before each paragraph:
.ne 2
text text text
ne then automatically causes a page break if there is space for one line
only.
\n[nl] [Register]
This register contains the current vertical position. If the vertical position
is zero and the top of page transition hasn’t happened yet, nl is set
to negative value. gtroff itself does this at the very beginning of a
document before anything has been printed, but the main usage is to
plant a header trap on a page if this page has already started.
Consider the following:
.de xxx
. sp
. tl ’’Header’’
. sp
..
.
First page.
.bp
.wh 0 xxx
.nr nl (-1)
Second page.
Result:
Chapter 5: gtroff Reference 109
First page.
...
Header
Second page.
...
Without resetting nl to a negative value, the just planted trap would be
active beginning with the next page, not the current one.
See Section 5.25 [Diversions], page 162, for a comparison with the .h and
.d registers.
eggs, bacon,
.ft B
spam
.ft
and sausage.
The zoom factor of the current font is available in the read-only number
register ‘.zoom’, in multiples of 1/1000th. It returns zero if there is no
magnification.
The ‘.fn’ register contains the current real font name of the current font.
This is a string-valued register. If the current font is a style, the value of
\n[.fn] is the proper concatenation of family and style name.
Both the ft request and the \f escape have alternative syntax forms to
access font positions.
\f[nnn] [Escape]
Change the current font position to nnn (one-digit position n, two-digit
position nn), which must be a non-negative integer.
If nnn is associated with a style (as set with the sty request or with the
styles command in the DESC file), use it within the current font family
(as set with the fam request, the \F escape, or the family command in
the DESC file).
this is font 1
.ft 2
this is font 2
.ft \" switch back to font 1
.ft 3
this is font 3
.ft
this is font 1 again
See Section 5.17.1 [Changing Fonts], page 109, for the standard syntax
form.
• If the symbol has been defined with the fschar request for the current
font, use it.
• Check all fonts in the order of appearance in the last special call.
• If the symbol has been defined with the schar request, use it.
• As a last resort, consult all fonts loaded up to now for special fonts and
check them, starting with the lowest font number. Note that this can
sometimes lead to surprising results since the fonts line in the DESC file
often contains empty positions, which are filled later on. For example,
consider the following:
fonts 3 0 0 FOO
This mounts font foo at font position 3. We assume that FOO is a special
font, containing glyph foo, and that no font has been loaded yet. The
line
.fspecial BAR BAZ
makes font BAZ special only if font BAR is active. We further assume
that BAZ is really a special font, i.e., the font description file contains
the special keyword, and that it also contains glyph foo with a special
shape fitting to font BAR. After executing fspecial, font BAR is loaded
at font position 1, and BAZ at position 2.
We now switch to a new font XXX, trying to access glyph foo that is
assumed to be missing. There are neither font-specific special fonts
for XXX nor any other fonts made special with the special request, so
gtroff starts the search for special fonts in the list of already mounted
fonts, with increasing font positions. Consequently, it finds BAZ before
FOO even for XXX, which is not the intended behaviour.
See Section 8.2 [Font Files], page 212, and Section 5.17.6 [Special Fonts],
page 122, for more details.
The list of available symbols is device dependent; see the groff char(7)
man page for a complete list of all glyphs. For example, say
man -Tdvi groff_char > groff_char.dvi
for a list using the default DVI fonts (not all versions of the man program
support the -T option). If you want to use an additional macro package to
change the used fonts, groff must be called directly:
groff -Tdvi -mec -man groff_char.7 > groff_char.dvi
Glyph names not listed in groff char(7) are derived algorithmically, using
a simplified version of the Adobe Glyph List (AGL) algorithm, which is
described in https://github.com/adobe-type-tools/agl-aglfn. The
(frozen) set of glyph names that can’t be derived algorithmically is called
groff glyph list (GGL).
• A glyph for Unicode character U+XXXX[X [X ]], which is not a compos-
ite character is named uXXXX[X[X]]. X must be an uppercase hexadeci-
mal digit. Examples: u1234, u008E, u12DB8. The largest Unicode value
is 0x10FFFF. There must be at least four X digits; if necessary, add
116 The GNU Troff Manual
leading zeroes (after the ‘u’). No zero padding is allowed for charac-
ter codes greater than 0xFFFF. Surrogates (i.e., Unicode values greater
than 0xFFFF represented with character codes from the surrogate area
U+D800-U+DFFF) are not allowed too.
• A glyph representing more than a single input character is named
‘u’ component1 ‘_’ component2 ‘_’ component3 . . .
Example: u0045_0302_0301.
For simplicity, all Unicode characters that are composites must be de-
composed maximally (this is normalization form D in the Unicode stan-
dard); for example, u00CA_0301 is not a valid glyph name since U+00CA
(latin capital letter e with circumflex) can be further decom-
posed into U+0045 (latin capital letter e) and U+0302 (combining
circumflex accent). u0045_0302_0301 is thus the glyph name for
U+1EBE, latin capital letter e with circumflex and acute.
• groff maintains a table to decompose all algorithmically derived glyph
names that are composites itself. For example, u0100 (latin letter
a with macron) is automatically decomposed into u0041_0304. Ad-
ditionally, a glyph name of the GGL is preferred to an algorithmically
derived glyph name; groff also automatically does the mapping. Exam-
ple: The glyph u0045_0302 is mapped to ^E.
• glyph names of the GGL can’t be used in composite glyph names; for
example, ^E_u0301 is invalid.
\(nm [Escape]
\[name] [Escape]
\[component1 component2 . . . ] [Escape]
Insert a symbol name (two-character name nm) or a composite glyph
with component glyphs component1, component2, . . . There is no special
syntax for one-character names – the natural form ‘\n’ would collide with
escapes.9
If name is undefined, a warning of type ‘char’ is generated, and the escape
is ignored. See Section 5.33 [Debugging], page 180, for information about
warnings.
groff resolves \[...] with more than a single component as follows:
• Any component that is found in the GGL is converted to the uXXXX
form.
• Any component uXXXX that is found in the list of decomposable
glyphs is decomposed.
9
Note that a one-character symbol is not the same as an input character, i.e., the
character a is not the same as \[a]. By default, groff defines only a single one-
character symbol, \[-]; it is usually accessed as \-. On the other hand, gtroff has
the special feature that \[charXXX] is the same as the input character with character
code XXX. For example, \[char97] is identical to the letter a if ASCII encoding is
active.
Chapter 5: gtroff Reference 117
This only works if both the characters before and after have
non-zero hyphenation codes (as set with the hcode request).
Use value 64 to override this behaviour.
8 The character overlaps horizontally if used as a horizontal
line building element. Initially the symbols ‘\[ul]’, ‘\[rn]’,
‘\[ru]’, ‘\[radicalex]’, and ‘\[sqrtex]’ have this property.
16 The character overlaps vertically if used as vertical line build-
ing element. Initially symbol ‘\[br]’ has this property.
32 An end-of-sentence character followed by any number of char-
acters with this property is treated as the end of a sentence
if followed by a newline or two spaces; in other words the
character is transparent for the purposes of end-of-sentence
recognition – this is the same as having a zero space factor
in TEX (initially characters ‘"’)]*’ and the symbols ‘\[dg]’,
‘\[rq]’, and ‘\[cq]’ have this property).
64 Ignore hyphenation code values of the surrounding charac-
ters. Use this in combination with values 2 and 4 (initially
no characters have this property). For example, if you need
an automatic break point after the en-dash in number ranges
like ‘3000–5000’, insert
.cflags 68 \(en
into your document. Note, however, that this can lead to bad
layout if done without thinking; in most situations, a better
solution instead of changing the cflags value is to insert \:
right after the hyphen at the places that really need a break
point.
128 Prohibit a line break before the character, but allow a line
break after the character. This works only in combination
with flags 256 and 512 (see below) and has no effect otherwise.
256 Prohibit a line break after the character, but allow a line
break before the character. This works only in combination
with flags 128 and 512 (see below) and has no effect otherwise.
512 Allow line break before or after the character. This works
only in combination with flags 128 and 256 and has no effect
otherwise.
Contrary to flag values 2 and 4, the flags 128, 256, and 512
work pairwise. If, for example, the left character has value
512, and the right character 128, no line break gets inserted.
If we use value 6 instead for the left character, a line break
after the character can’t be suppressed since the right neigh-
bour character doesn’t get examined.
120 The GNU Troff Manual
12
char is a misnomer since an output glyph is defined.
Chapter 5: gtroff Reference 121
See Section 5.17.4 [Using Symbols], page 114, for a detailed description
of the glyph searching mechanism in gtroff.
.rchar c1 c2 . . . [Request]
.rfschar f c1 c2 . . . [Request]
Remove the definitions of glyphs c1, c2, . . . This undoes the effect of a
char, fchar, or schar request.
It is possible to omit the whitespace between arguments.
The request rfschar removes glyph definitions defined with fschar for
glyph f.
See Section 7.1 [Special Characters], page 191.
If you want to add ‘-’ to a class, it must be the first character value in
the argument list, otherwise it gets misinterpreted as a range.
Note that it is not possible to use class names within range definitions.
Typical use of the class request is to control line-breaking and hyphen-
ation rules as defined by the cflags request. For example, to inhibit line
breaks before the characters belonging to the prepunctx class, you can
write:
.cflags 2 \C’[prepunctx]’
See the cflags request in Section 5.17.4 [Using Symbols], page 114, for
more details.
\H’height’ [Escape]
\H’+height’ [Escape]
\H’-height’ [Escape]
Chapter 5: gtroff Reference 123
\n[.height] [Register]
Change (increment, decrement) the height of the current font, but not
the width. If height is zero, restore the original height. Default scaling
indicator is ‘z’.
The read-only number register .height contains the font height as set by
\H.
Currently, only the -Tps and -Tpdf devices support this feature.
Note that \H doesn’t produce an input token in gtroff. As a conse-
quence, it can be used in requests like mc (which expects a single character
as an argument) to change the font on the fly:
.mc \H’+5z’x\H’0’
In compatibility mode, gtroff behaves differently: If an increment or
decrement is used, it is always taken relative to the current point size and
not relative to the previously selected font height. Thus,
.cp 1
\H’+5’test \H’+5’test
prints the word ‘test’ twice with the same font height (five points larger
than the current font size).
\S’slant’ [Escape]
\n[.slant] [Register]
Slant the current font by slant degrees. Positive values slant to the right.
Only integer values are possible.
The read-only number register .slant contains the font slant as set by
\S.
Currently, only the -Tps and -Tpdf devices support this feature.
Note that \S doesn’t produce an input token in gtroff. As a conse-
quence, it can be used in requests like mc (which expects a single character
as an argument) to change the font on the fly:
.mc \S’20’x\S’0’
This request is incorrectly documented in the original Unix troff manual;
the slant is always set to an absolute value.
.ul [lines] [Request]
The ul request normally underlines subsequent lines if a TTY output
device is used. Otherwise, the lines are printed in italics (only the term
‘underlined’ is used in the following). The single argument is the num-
ber of input lines to be underlined; with no argument, the next line is
underlined. If lines is zero or negative, stop the effects of ul (if it was
active). Requests and empty lines do not count for computing the num-
ber of underlined input lines, even if they produce some output like tl.
Lines inserted by macros (e.g. invoked by a trap) do count.
At the beginning of ul, the current font is stored and the underline font
is activated. Within the span of a ul request, it is possible to change
fonts, but after the last line affected by ul the saved font is restored.
124 The GNU Troff Manual
the word ‘file’. This produces a cleaner look (albeit subtle) to the printed
output. Usually, ligatures are not available in fonts for TTY output devices.
Most PostScript fonts support the fi and fl ligatures. The C/A/T
typesetter that was the target of AT&T troff also supported ‘ff’, ‘ffi’, and
‘ffl’ ligatures. Advanced typesetters or ‘expert’ fonts may include ligatures
for ‘ft’ and ‘ct’, although GNU troff does not support these (yet).
Only the current font is checked for ligatures and kerns; neither special
fonts nor entities defined with the char request (and its siblings) are taken
into account.
.lg [flag] [Request]
\n[.lg] [Register]
Switch the ligature mechanism on or off; if the parameter is non-zero or
missing, ligatures are enabled, otherwise disabled. Default is on. The
current ligature mode can be found in the read-only number register .lg
(set to 1 or 2 if ligatures are enabled, 0 otherwise).
Setting the ligature mode to 2 enables the two-character ligatures (fi, fl,
and ff) and disables the three-character ligatures (ffi and ffl).
Pairwise kerning is another subtle typesetting mechanism that modifies
the distance between a glyph pair to improve readability. In most cases (but
not always) the distance is decreased. For example, compare the combination
of the letters ‘V’ and ‘A’. With kerning, ‘VA’ is printed. Without kerning
it appears as ‘VA’. Typewriter-like fonts and fonts for terminals where all
glyphs have the same width don’t use kerning.
.kern [flag] [Request]
\n[.kern] [Register]
Switch kerning on or off. If the parameter is non-zero or missing, enable
pairwise kerning, otherwise disable it. The read-only number register
.kern is set to 1 if pairwise kerning is enabled, 0 otherwise.
If the font description file contains pairwise kerning information, glyphs
from that font are kerned. Kerning between two glyphs can be inhibited
by placing \& between them: ‘V\&A’.
See Section 8.2.2 [Font File Format], page 215.
Track kerning expands or reduces the space between glyphs. This can be
handy, for example, if you need to squeeze a long word onto a single line or
spread some text to fill a narrow column. It must be used with great care
since it is usually considered bad typography if the reader notices the effect.
.tkf f s1 n1 s2 n2 [Request]
Enable track kerning for font f. If the current font is f the width of
every glyph is increased by an amount between n1 and n2 (n1, n2 can be
negative); if the current point size is less than or equal to s1 the width is
increased by n1; if it is greater than or equal to s2 the width is increased
126 The GNU Troff Manual
by n2; if the point size is greater than or equal to s1 and less than or
equal to s2 the increase in width is a linear function of the point size.
The default scaling indicator is ‘z’ for s1 and s2, ‘p’ for n1 and n2.
Note that the track kerning amount is added even to the rightmost glyph
in a line; for large values it is thus recommended to increase the line
length by the same amount to compensate it.
Sometimes, when typesetting letters of different fonts, more or less space
at such boundaries is needed. There are two escapes to help with this.
\/ [Escape]
Increase the width of the preceding glyph so that the spacing between
that glyph and the following glyph is correct if the following glyph is a
roman glyph. For example, if an italic f is immediately followed by a ro-
man right parenthesis, then in many fonts the top right portion of the f
overlaps the top left of the right parenthesis. Use this escape sequence
whenever an italic glyph is immediately followed by a roman glyph with-
out any intervening space. This small amount of space is also called italic
correction.
\f[I]f\f[R])
⇒ f)
\f[I]f\/\f[R])
⇒ f)
\, [Escape]
Modify the spacing of the following glyph so that the spacing between
that glyph and the preceding glyph is correct if the preceding glyph is
a roman glyph. Use this escape sequence whenever a roman glyph is
immediately followed by an italic glyph without any intervening space.
In analogy to above, this space could be called left italic correction, but
this term isn’t used widely.
q\f[I]f
⇒ qf
q\,\f[I]f
⇒ qf
\& [Escape]
Insert a zero-width character, which is invisible. Its intended use is to
stop interaction of a character with its surroundings.
• It prevents the insertion of extra space after an end-of-sentence char-
acter.
Test.
Test.
⇒ Test. Test.
Test.\&
Test.
⇒ Test. Test.
Chapter 5: gtroff Reference 127
5.18 Sizes
gtroff uses two dimensions with each line of text, type size and vertical
spacing. The type size is approximately the height of the tallest glyph.13
Vertical spacing is the amount of space gtroff allows for a line of text;
13
This is usually the parenthesis. Note that in most cases the real dimensions of the
glyphs in a font are not related to its type size! For example, the standard PostScript
font families ‘Times Roman’, ‘Helvetica’, and ‘Courier’ can’t be used together at 10 pt;
to get acceptable output, the size of ‘Helvetica’ has to be reduced by one point, and
the size of ‘Courier’ must be increased by one point.
128 The GNU Troff Manual
normally, this is about 20% larger than the current type size. Ratios smaller
than this can result in hard-to-read text; larger than this, it spreads the
text out more vertically (useful for term papers). By default, gtroff uses
10 point type on 12 point spacing.
The difference between type size and vertical spacing is known, by type-
setters, as leading (this is pronounced ‘ledding’).
• Move the current point vertically by the extra post-vertical line space.
This is the maximum value of all \x escapes with a positive argument
in the line that has just been output.
• Move the current point vertically by the post-vertical line spacing as
set with the pvs request.
It is usually better to use vs or pvs instead of ls to produce double-
spaced documents: vs and pvs have a finer granularity for the inserted
vertical space compared to ls; furthermore, certain preprocessors assume
single-spacing.
See Section 5.9 [Manipulating Spacing], page 89, for more details on the
\x escape and the ls request.
scaling indicator other than ‘z’ or ‘u’ in a numeric expression whose default
scale indicator was ‘z’, and so gtroff disallows this as well.
There is also new scale indicator ‘s’, which multiplies by the number of
units in a scaled point. So, for example, ‘\n[.ps]s’ is equal to ‘1m’. Be sure
not to confuse the ‘s’ and ‘z’ scale indicators.
\n[.ps] [Register]
A read-only number register returning the point size in scaled points.
.ps is associated with the current environment (see Section 5.26 [Envi-
ronments], page 166).
\n[.psr] [Register]
\n[.sr] [Register]
The last-requested point size in scaled points is contained in the .psr
read-only number register. The last requested point size in points as a
decimal fraction can be found in .sr. This is a string-valued read-only
number register.
Note that the requested point sizes are device-independent, whereas the
values returned by the .ps and .s registers are not. For example, if a
point size of 11 pt is requested, and a sizes request (or a sizescale line
in a DESC file) specifies 10.95 pt instead, this value is actually used.
Both registers are associated with the current environment (see
Section 5.26 [Environments], page 166).
The \s escape has the following syntax for working with fractional type
sizes:
\s[n]
\s’n’ Set the point size to n scaled points; n is a numeric expression
with a default scale indicator of ‘z’.
\s[+n]
\s[-n]
\s+[n]
\s-[n]
\s’+n’
\s’-n’
\s+’n’
\s-’n’ Increase or decrease the point size by n scaled points; n is a
numeric expression (which may start with a minus sign) with a
default scale indicator of ‘z’.
See Section 8.2 [Font Files], page 212.
5.19 Strings
gtroff has string variables, which are entirely for user convenience (i.e.
there are no built-in strings except .T, but even this is a read-write string
variable).
132 The GNU Troff Manual
.di xxx
a \fItest\fR
.br
.di
.ds yyy This is \*[xxx]\c
\*[yyy].
⇒ This is a test.
As the previous example shows, it is possible to store formatted output
in strings. The \c escape prevents the insertion of an additional blank
line in the output.
Copying diversions longer than a single output line produces unexpected
results.
.di xxx
a funny
.br
test
.br
.di
.ds yyy This is \*[xxx]\c
\*[yyy].
⇒ test This is a funny.
Usually, it is not predictable whether a diversion contains one or more
output lines, so this mechanism should be avoided. With Unix troff,
this was the only solution to strip off a final newline from a diversion.
Another disadvantage is that the spaces in the copied string are already
formatted, making them unstretchable. This can cause ugly results.
A clean solution to this problem is available in GNU troff, using the
requests chop to remove the final newline of a diversion, and unformat
to make the horizontal spaces stretchable again.
.box xxx
a funny
.br
test
.br
.box
.chop xxx
.unformat xxx
This is \*[xxx].
⇒ This is a funny test.
See Section 5.32 [Gtroff Internals], page 178, for more information.
.as name [string] [Request]
.as1 name [string] [Request]
The as request is similar to ds but appends string to the string stored as
name instead of redefining it. If name doesn’t exist yet, it is created.
Chapter 5: gtroff Reference 135
to the object pool, adds its name to the name pool, and creates a link
between them. When als creates an alias, it adds a new name to the
name pool that gets linked to the same object as the old name.
Now consider this example.
.de foo
..
.
.als bar foo
.
.de bar
. foo
..
.
.bar
⇒ input stack limit exceeded
The definition of macro bar replaces the old object this name is linked to.
However, the alias to foo is still active! In other words, foo is still linked
to the same object as bar, and the result of calling bar is an infinite,
recursive loop that finally leads to an error.
To undo an alias, simply call rm on the aliased name. The object itself is
not destroyed until there are no more aliases.
.chop xx [Request]
Remove (chop) the last character from the macro, string, or diversion
named xx. This is useful for removing the newline from the end of diver-
sions that are to be interpolated as strings. This command can be used
repeatedly; see Section 5.32 [Gtroff Internals], page 178, for details on
nodes inserted additionally by gtroff.
See Section 5.4 [Identifiers], page 65, and Section 5.5.3.1 [Comments],
page 71.
5.20.2 if-else
gtroff has if-then-else constructs like other languages, although the format-
ting can be painful.
.if expr anything [Request]
Evaluate the expression expr, and executes anything (the remainder of
the line) if expr evaluates to a value greater than zero (true). anything is
15
The name of this conditional operator is a misnomer since it tests names of output
glyphs.
Chapter 5: gtroff Reference 139
5.20.3 while
gtroff provides a looping construct using the while request, which is used
much like the if (and related) requests.
.while expr anything [Request]
Evaluate the expression expr, and repeatedly execute anything (the re-
mainder of the line) until expr evaluates to 0.
.nr a 0 1
.while (\na < 9) \{\
\n+a,
.\}
\n+a
⇒ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
140 The GNU Troff Manual
Some remarks.
• The body of a while request is treated like the body of a de request:
gtroff temporarily stores it in a macro that is deleted after the loop
has been exited. It can considerably slow down a macro if the body
of the while request (within the macro) is large. Each time the
macro is executed, the while body is parsed and stored again as a
temporary macro.
.de xxx
. nr num 10
. while (\\n[num] > 0) \{\
. \" many lines of code
. nr num -1
. \}
..
The traditional and often better solution (Unix troff doesn’t have
the while request) is to use a recursive macro instead that is parsed
only once during its definition.
.de yyy
. if (\\n[num] > 0) \{\
. \" many lines of code
. nr num -1
. yyy
. \}
..
.
.de xxx
. nr num 10
. yyy
..
Note that the number of available recursion levels is set to 1000 (this
is a compile-time constant value of gtroff).
• The closing brace of a while body must end a line.
.if 1 \{\
. nr a 0 1
. while (\n[a] < 10) \{\
. nop \n+[a]
.\}\}
⇒ unbalanced \{ \}
.break [Request]
Break out of a while loop. Be sure not to confuse this with the br request
(causing a line break).
.continue [Request]
Finish the current iteration of a while loop, immediately restarting the
next iteration.
Chapter 5: gtroff Reference 141
16
While it is possible to define and call a macro ‘.’ with
.de .
. tm foo
..
.
.. \" This calls macro ‘.’!
you can’t use this as the end-of-macro macro: during a macro definition, ‘..’ is never
handled as a call to ‘.’, even if you say ‘.de foo .’ explicitly.
142 The GNU Troff Manual
See Section 5.19 [Strings], page 131, for the als and rn request to create
an alias and rename a macro, respectively.
The de, am, di, da, ds, and as requests (together with their variants)
only create a new object if the name of the macro, diversion or string is
currently undefined or if it is defined to be a request; normally they modify
the value of an existing object.
5.21.2 Parameters
The arguments to a macro or string can be examined using a variety of
escapes.
\n[.$] [Register]
The number of arguments passed to a macro or string. This is a read-only
number register.
Note that the shift request can change its value.
Any individual argument can be retrieved with one of the following es-
capes:
\$n [Escape]
\$(nn [Escape]
\$[nnn] [Escape]
Retrieve the n th, nn th or nnn th argument. As usual, the first form
only accepts a single number (larger than zero), the second a two-digit
number (larger or equal to 10), and the third any positive integer value
(larger than zero). Macros and strings can have an unlimited number of
arguments. Note that due to copy-in mode, use two backslashes on these
in actual use to prevent interpolation until the macro is actually invoked.
.shift [n] [Request]
Shift the arguments 1 position, or as many positions as specified by its
argument. After executing this request, argument i becomes argument
i − n; arguments 1 to n are no longer available. Shifting by negative
amounts is currently undefined.
Chapter 5: gtroff Reference 145
\$* [Escape]
\$@ [Escape]
In some cases it is convenient to use all of the arguments at once (for
example, to pass the arguments along to another macro). The \$* escape
concatenates all the arguments separated by spaces. A similar escape
is \$@, which concatenates all the arguments with each surrounded by
double quotes, and separated by spaces. If not in compatibility mode,
the input level of double quotes is preserved (see Section 5.5.1.1 [Request
and Macro Arguments], page 68).
\$^ [Escape]
Handle the parameters of a macro as if they were an argument to the ds
or similar requests.
.de foo
. tm $1=‘\\$1’
. tm $2=‘\\$2’
. tm $*=‘\\$*’
. tm $@=‘\\$@’
. tm $^=‘\\$^’
..
.foo " This is a "test"
⇒ $1=‘ This is a ’
⇒ $2=‘test"’
⇒ $*=‘ This is a test"’
⇒ $@=‘" This is a " "test""’
⇒ $^=‘" This is a "test"’
This escape is useful mainly for macro packages like trace.tmac, which
redefines some requests and macros for debugging purposes.
\$0 [Escape]
The name used to invoke the current macro. The als request can make
a macro have more than one name.
If a macro is called as a string (within another macro), the value of \$0
isn’t changed.
.de foo
. tm \\$0
..
.als foo bar
.
146 The GNU Troff Manual
.de aaa
. foo
..
.de bbb
. bar
..
.de ccc
\\*[foo]\\
..
.de ddd
\\*[bar]\\
..
.
.aaa
⇒ foo
.bbb
⇒ bar
.ccc
⇒ ccc
.ddd
⇒ ddd
.de 2c
. br
. mk
. ll \\n[column-length]u
. wh -\\n[bottom-margin]u 2c-trap
. nr right-side 0
..
.
.de 2c-trap
. ie \\n[right-side] \{\
. nr right-side 0
. po -(\\n[column-length]u + \\n[column-gap]u)
. \" remove trap
. wh -\\n[bottom-margin]u
. \}
. el \{\
. \" switch to right side
. nr right-side 1
. po +(\\n[column-length]u + \\n[column-gap]u)
. rt
. \}
..
.
.pl 1.5i
.ll 4i
This is a small test that shows how the
rt request works in combination with mk.
.2c
Starting here, text is typeset in two columns.
Note that this implementation isn’t robust
and thus not suited for a real two-column
macro.
Result:
148 The GNU Troff Manual
The following escapes give fine control of movements about the page.
\v’e’ [Escape]
Move vertically, usually from the current location on the page (if no
absolute position operator ‘|’ is used). The argument e specifies the
distance to move; positive is downwards and negative upwards. The
default scaling indicator for this escape is ‘v’. Beware, however, that
gtroff continues text processing at the point where the motion ends,
so you should always balance motions to avoid interference with text
processing.
\v doesn’t trigger a trap. This can be quite useful; for example, consider
a page bottom trap macro that prints a marker in the margin to indicate
continuation of a footnote or something similar.
\r [Escape]
Move upwards 1 v.
\u [Escape]
Move upwards .5 v.
\d [Escape]
Move down .5 v.
\h’e’ [Escape]
Move horizontally, usually from the current location (if no absolute po-
sition operator ‘|’ is used). The expression e indicates how far to move:
positive is rightwards and negative leftwards. The default scaling indica-
tor for this escape is ‘m’.
This horizontal space is not discarded at the end of a line. To insert
discardable space of a certain length use the ss request.
\SP [Escape]
An unbreakable and unpaddable (i.e. not expanded during filling) space.
(Note: This is a backslash followed by a space.)
Chapter 5: gtroff Reference 149
\~ [Escape]
An unbreakable space that stretches like a normal inter-word space when
a line is adjusted.
\| [Escape]
A 1/6 th em space. Ignored for TTY output devices (rounded to zero).
However, if there is a glyph defined in the current font file with name \|
(note the leading backslash), the width of this glyph is used instead (even
for TTYs).
\^ [Escape]
A 1/12 th em space. Ignored for TTY output devices (rounded to zero).
However, if there is a glyph defined in the current font file with name \^
(note the leading backslash), the width of this glyph is used instead (even
for TTYs).
\0 [Escape]
A space the size of a digit.
The following string sets the TEX logo:
.ds TeX T\h’-.1667m’\v’.224m’E\v’-.224m’\h’-.125m’X
\w’text’ [Escape]
\n[st] [Register]
\n[sb] [Register]
\n[rst] [Register]
\n[rsb] [Register]
\n[ct] [Register]
\n[ssc] [Register]
\n[skw] [Register]
Return the width of the specified text in basic units. This allows hori-
zontal movement based on the width of some arbitrary text (e.g. given as
an argument to a macro).
The length of the string ‘abc’ is \w’abc’u.
⇒ The length of the string ‘abc’ is 72u.
Font changes may occur in text, which don’t affect current settings.
After use, \w sets several registers:
st
sb The highest and lowest point of the baseline, respectively, in
text.
rst
rsb Like the st and sb registers, but takes account of the heights
and depths of glyphs. In other words, this gives the high-
est and lowest point of text. Values below the baseline are
negative.
150 The GNU Troff Manual
\l’l’ [Escape]
\l’lg’ [Escape]
Draw a line horizontally. l is the length of the line to be drawn. If it
is positive, start the line at the current location and draw to the right;
its end point is the new current location. Negative values are handled
differently: The line starts at the current location and draws to the left,
but the current location doesn’t move.
l can also be specified absolutely (i.e. with a leading ‘|’), which draws
back to the beginning of the input line. Default scaling indicator is ‘m’.
The optional second parameter g is a glyph to draw the line with. If
this second argument is not specified, gtroff uses the underscore glyph,
\[ru].
To separate the two arguments (to prevent gtroff from interpreting a
drawing glyph as a scaling indicator if the glyph is represented by a single
character) use \&.
Here a small useful example:
.de box
\[br]\\$*\[br]\l’|0\[rn]’\l’|0\[ul]’
..
Note that this works by outputting a box rule (a vertical line), then the
text given as an argument and then another box rule. Finally, the line
drawing escapes both draw from the current location to the beginning of
the input line – this works because the line length is negative, not moving
the current point.
\L’l’ [Escape]
\L’lg’ [Escape]
Draw vertical lines. Its parameters are similar to the \l escape, except
that the default scaling indicator is ‘v’. The movement is downwards
for positive values, and upwards for negative values. The default glyph
is the box rule glyph, \[br]. As with the vertical motion escapes, text
processing blindly continues where the line ends.
This is a \L’3v’test.
Here is the result, produced with grotty.
152 The GNU Troff Manual
This is a
|
|
|test.
5.24 Traps
Traps are locations that, when reached, call a specified macro. These traps
can occur at a given location on the page, at a given location in the current
diversion, at a blank line, after a certain number of input lines, or at the end
of input.
Setting a trap is also called planting. It is also said that a trap is sprung
if the associated macro is executed.
.de a
. nop a
..
.de b
. nop b
..
.de c
. nop c
..
.
.wh 1i a
.wh 2i b
.wh 3i c
.bp
⇒ a b c
.ch b 1i
.ch c 1i
.bp
⇒ a
.ch a 0.5i
.bp
⇒ a b
\n[.t] [Register]
A read-only number register holding the distance to the next trap.
If there are no traps between the current position and the bottom of the
page, it contains the distance to the page bottom. In a diversion, the
distance to the page bottom is infinite (the returned value is the biggest
integer that can be represented in groff) if there are no diversion traps.
.ch macro [dist] [Request]
Change the location of a trap. The first argument is the name of the
macro to be invoked at the trap, and the second argument is the new
location for the trap (note that the parameters are specified in opposite
order as in the wh request). This is useful for building up footnotes in a
diversion to allow more space at the bottom of the page for them.
Default scaling indicator for dist is ‘v’. If dist is missing, the trap is
removed.
\n[.ne] [Register]
The read-only number register .ne contains the amount of space that was
needed in the last ne request that caused a trap to be sprung. Useful in
conjunction with the .trunc register. See Section 5.16 [Page Control],
page 107, for more information.
Since the .ne register is only set by traps it doesn’t make much sense to
use it outside of trap macros.
158 The GNU Troff Manual
\n[.trunc] [Register]
A read-only register containing the amount of vertical space truncated
from an sp request by the most recently sprung vertical position trap,
or, if the trap was sprung by an ne request, minus the amount of vertical
motion produced by the ne request. In other words, at the point a trap
is sprung, it represents the difference of what the vertical position would
have been but for the trap, and what the vertical position actually is.
Since the .trunc register is only set by traps it doesn’t make much sense
to use it outside of trap macros.
\n[.pe] [Register]
A read-only register that is set to 1 while a page is ejected with the bp
request (or by the end of input).
Outside of traps this register is always zero. In the following example,
only the second call to x is caused by bp.
.de x
\&.pe=\\n[.pe]
.br
..
.wh 1v x
.wh 4v x
A line.
.br
Another line.
.br
⇒ A line.
.pe=0
Another line.
.pe=1
An important fact to consider while designing macros is that diversions
and traps do not interact normally. For example, if a trap invokes a header
macro (while outputting a diversion) that tries to change the font on the
current page, the effect is not visible before the diversion has completely
been printed (except for input protected with \! or \?) since the data in
the diversion is already formatted. In most cases, this is not the expected
behaviour.
the horizontal space that would be emitted if there was no leading space
macro is stored in register lss. Note that lsn and lss are available even
if no leading space macro has been set.
The first thing a leading space macro sees is a token. However, some
escapes like \f or \m are handled on the fly (see Section 5.32 [Gtroff
Internals], page 178, for a complete list) without creating a token at all.
Consider that a line starts with two spaces followed by \fIfoo. While
skipping the spaces \fI is handled too so that groff’s current font is
properly set to ‘I’, but the leading space macro only sees foo, without
the preceding \fI. If the macro should see the font escape you have
to ‘protect’ it with something that creates a token, for example with
\&\fIfoo.
happen. In the above example, the call of the ne request assures that
the remaining code stays on the same page, so we have to insert \c only
once.
The next example shows how to append three lines, then starting a new
page unconditionally. Since ‘.ne 1’ doesn’t give the desired effect – there
is always one line available or we are already at the beginning of the next
page – we temporarily increase the page length by one line so that we can
use ‘.ne 2’.
.de EM
.pl +1v
\c
.ne 2
line one
.br
\c
.ne 2
line two
.br
\c
.ne 2
line three
.br
.pl -1v
\c
’bp
..
.em EM
Note that this specific feature affects only the first potential page break
caused by the end macro; further page breaks emitted by the end macro
are handled normally.
.de adjust-page-length
. br
. pl \\n[nl]u \" \n[nl] holds the current vert. position
..
.
.de single-page-mode
. pl 99999
. em adjust-page-length
..
.
.\" activate the above code
.single-page-mode
Since only one end-of-input trap does exist and other macro packages may
already use it, care must be taken not to break the mechanism. A simple
solution would be to append the above macro to the macro package’s
end-of-input macro using the .am request.
5.25 Diversions
In gtroff it is possible to divert text into a named storage area. Due to the
similarity to defining macros it is sometimes said to be stored in a macro.
This is used for saving text for output at a later time, which is useful for
keeping blocks of text on the same page, footnotes, tables of contents, and
indices.
For orthogonality it is said that gtroff is in the top-level diversion if no
diversion is active (i.e., the data is diverted to the output device).
Although the following requests can be used to create diversions, sim-
ply using an undefined diversion will cause it to be defined as empty. See
Section 5.4 [Identifiers], page 65.
.di macro [Request]
.da macro [Request]
Begin a diversion. Like the de request, it takes an argument of a macro
name to divert subsequent text into. The da macro appends to an existing
diversion.
di or da without an argument ends the diversion.
The current partially filled line is included into the diversion. See the box
request below for an example. Note that switching to another (empty)
environment (with the ev request) avoids the inclusion of the current
partially filled line.
.box macro [Request]
.boxa macro [Request]
Begin (or append to) a diversion like the di and da requests. The dif-
ference is that box and boxa do not include a partially filled line in the
diversion.
Chapter 5: gtroff Reference 163
Compare this:
Before the box.
.box xxx
In the box.
.br
.box
After the box.
.br
⇒ Before the box. After the box.
.xxx
⇒ In the box.
with this:
Before the diversion.
.di yyy
In the diversion.
.br
.di
After the diversion.
.br
⇒ After the diversion.
.yyy
⇒ Before the diversion. In the diversion.
box or boxa without an argument ends the diversion.
\n[.z] [Register]
\n[.d] [Register]
Diversions may be nested. The read-only number register .z contains
the name of the current diversion (this is a string-valued register). The
read-only number register .d contains the current vertical place in the
diversion. If not in a diversion it is the same as register nl.
\n[.h] [Register]
The high-water mark on the current page or in the current diversion. It
corresponds to the text baseline of the lowest line on the page. This is a
read-only register.
.tm .h==\n[.h], nl==\n[nl]
⇒ .h==0, nl==-1
This is a test.
.br
.sp 2
.tm .h==\n[.h], nl==\n[nl]
⇒ .h==40, nl==120
As can be seen in the previous example, empty lines are not considered
in the return value of the .h register.
164 The GNU Troff Manual
\n[dn] [Register]
\n[dl] [Register]
After completing a diversion, the read-write number registers dn and dl
contain the vertical and horizontal size of the diversion. Note that only
the just processed lines are counted: For the computation of dn and dl,
the requests da and boxa are handled as if di and box had been used –
lines that have been already stored in a macro are not taken into account.
.\" Center text both horizontally & vertically
.
.\" Enclose macro definitions in .eo and .ec
.\" to avoid the doubling of the backslash
.eo
.\" macro .(c starts centering mode
.de (c
. br
. ev (c
. evc 0
. in 0
. nf
. di @c
..
.\" macro .)c terminates centering mode
.de )c
. br
. ev
. di
. nr @s (((\n[.t]u - \n[dn]u) / 2u) - 1v)
. sp \n[@s]u
. ce 1000
. @c
. ce 0
. sp \n[@s]u
. br
. fi
. rr @s
. rm @c
..
.\" End of macro definitions, restore escape mechanism
.ec
\! [Escape]
\?anything\? [Escape]
Prevent requests, macros, and escapes from being interpreted when read
into a diversion. Both escapes take the given text and transparently
embed it into the diversion. This is useful for macros that shouldn’t be
invoked until the diverted text is actually output.
Chapter 5: gtroff Reference 165
some escape sequences that were formatted and diverted are treated like
ordinary input characters when the diversion is reread. It can be also
used for gross hacks; for example, the following sets register n to 1.
.tr @.
.di x
@nr n 1
.br
.di
.tr @@
.asciify x
.x
Note that asciify cannot return all items in a diversion back to their
source equivalent, nodes such as \N[...] will still remain as nodes, so
the result cannot be guaranteed to be a pure string.
See Section 5.21.1 [Copy-in Mode], page 144.
5.26 Environments
It happens frequently that some text should be printed in a certain format
regardless of what may be in effect at the time, for example, in a trap
invoked macro to print headers and footers. To solve this gtroff processes
text in environments. An environment contains most of the parameters that
control text processing. It is possible to switch amongst these environments;
by default gtroff processes text in environment 0. The following is the
information kept in an environment.
• font parameters (size, family, style, glyph height and slant, space and
sentence space size)
• page parameters (line length, title length, vertical spacing, line spacing,
indentation, line numbering, centering, right-justifying, underlining, hy-
phenation data)
• fill and adjust mode
• tab stops, tab and leader characters, escape character, no-break and
hyphen indicators, margin character data
• partially collected lines
• input traps
• drawing and fill colours
Chapter 5: gtroff Reference 167
These environments may be given arbitrary names (see Section 5.4 [Iden-
tifiers], page 65, for more info). Old versions of troff only had environments
named ‘0’, ‘1’, and ‘2’.
.ev [env] [Request]
\n[.ev] [Register]
Switch to another environment. The argument env is the name of the
environment to switch to. With no argument, gtroff switches back to
the previous environment. There is no limit on the number of named
environments; they are created the first time that they are referenced.
The .ev read-only register contains the name or number of the current
environment. This is a string-valued register.
Note that a call to ev (with argument) pushes the previously active en-
vironment onto a stack. If, say, environments ‘foo’, ‘bar’, and ‘zap’ are
called (in that order), the first ev request without parameter switches
back to environment ‘bar’ (which is popped off the stack), and a second
call switches back to environment ‘foo’.
Here is an example:
.ev footnote-env
.fam N
.ps 6
.vs 8
.ll -.5i
.ev
...
.ev footnote-env
\(dg Note the large, friendly letters.
.ev
.evc env [Request]
Copy the environment env into the current environment.
The following environment data is not copied:
• Partially filled lines.
• The status whether the previous line was interrupted.
• The number of lines still to center, or to right-justify, or to underline
(with or without underlined spaces); they are set to zero.
• The status whether a temporary indentation is active.
• Input traps and its associated data.
• Line numbering mode is disabled; it can be reactivated with ‘.nm +0’.
• The number of consecutive hyphenated lines (set to zero).
\n[.w] [Register]
\n[.cht] [Register]
168 The GNU Troff Manual
\n[.cdp] [Register]
\n[.csk] [Register]
The \n[.w] register contains the width of the last glyph added to the
current environment.
The \n[.cht] register contains the height of the last glyph added to the
current environment.
The \n[.cdp] register contains the depth of the last glyph added to
the current environment. It is positive for glyphs extending below the
baseline.
The \n[.csk] register contains the skew (how far to the right of the
glyph’s center that gtroff should place an accent) of the last glyph added
to the current environment.
\n[.n] [Register]
The \n[.n] register contains the length of the previous output line in the
current environment.
‘\O4’ End a nesting level. The current level is contained within the
read-only register .O. See Section 5.6.5 [Built-in Registers],
page 77.
‘\O[5Pfilename]’
This escape is grohtml specific. Provided that this escape oc-
curs at the outer nesting level write the filename to stderr.
The position of the image, P, must be specified and must be
one of l, r, c, or i (left, right, centered, inline). filename is
associated with the production of the next inline image.
5.28 Colors
.color [n] [Request]
\n[.color] [Register]
If n is missing or non-zero, activate colors (this is the default); otherwise,
turn it off.
The read-only number register .color is 1 if colors are active, 0 otherwise.
Internally, color sets a global flag; it does not produce a token. Similar
to the cp request, you should use it at the beginning of your document
to control color output.
Colors can be also turned off with the -c command-line option.
.defcolor ident scheme color components [Request]
Define color with name ident. scheme can be one of the following val-
ues: rgb (three components), cmy (three components), cmyk (four com-
ponents), and gray or grey (one component).
Color components can be given either as a hexadecimal string or as posi-
tive decimal integers in the range 0–65535. A hexadecimal string contains
all color components concatenated. It must start with either # or ##; the
former specifies hex values in the range 0–255 (which are internally mul-
tiplied by 257), the latter in the range 0–65535. Examples: #FFC0CB
(pink), ##ffff0000ffff (magenta). The default color name value is
device-specific (usually black). It is possible that the default color for
\m and \M is not identical.
A new scaling indicator f has been introduced, which multiplies its value
by 65536; this makes it convenient to specify color components as fractions
in the range 0 to 1 (1f equals 65536u). Example:
.defcolor darkgreen rgb 0.1f 0.5f 0.2f
Note that f is the default scaling indicator for the defcolor request, thus
the above statement is equivalent to
.defcolor darkgreen rgb 0.1 0.5 0.2
.gcolor [color] [Request]
\mc [Escape]
170 The GNU Troff Manual
\m(co [Escape]
\m[color] [Escape]
\n[.m] [Register]
Set (glyph) drawing color. The following examples show how to turn the
next four words red.
.gcolor red
these are in red
.gcolor
and these words are in black.
\m[red]these are in red\m[] and these words are in black.
The escape \m[] returns to the previous color, as does a call to gcolor
without an argument.
The name of the current drawing color is available in the read-only, string-
valued number register ‘.m’.
The drawing color is associated with the current environment (see
Section 5.26 [Environments], page 166).
Note that \m doesn’t produce an input token in gtroff. As a conse-
quence, it can be used in requests like mc (which expects a single character
as an argument) to change the color on the fly:
.mc \m[red]x\m[]
5.29 I/O
gtroff has several requests for including files:
Chapter 5: gtroff Reference 171
ently copied through to the output. In Unix troff, the contents of file
is immediately copied through to the output regardless of whether there
is a current diversion; this behaviour is so anomalous that it must be
considered a bug.
While cf copies the contents of file completely unprocessed, trf disallows
characters such as NUL that are not valid gtroff input characters (see
Section 5.4 [Identifiers], page 65).
For cf, within a diversion, ‘completely unprocessed’ means that each line
of a file to be inserted is handled as if it were preceded by \!\\!.
Both requests cause a line break.
Using the nx and rd requests, it is easy to set up form letters. The form
letter template is constructed like this, putting the following lines into a file
called repeat.let:
.ce
\*(td
.sp 2
.nf
.rd
.sp
.rd
.fi
Body of letter.
.bp
.nx repeat.let
When this is run, a file containing the following lines should be redirected
in. Note that requests included in this file are executed as though they were
part of the form letter. The last block of input is the ex request, which tells
Chapter 5: gtroff Reference 173
groff to stop processing. If this was not there, groff would not know when
to stop.
Trent A. Fisher
708 NW 19th Av., #202
Portland, OR 97209
Dear Trent,
Len Adollar
4315 Sierra Vista
San Diego, CA 92103
.ex
Note that this works by having the perl script (run by sy) print out the
nr requests that set the number registers H, M, and S, and then reads
those commands in with the so request.
For most practical purposes, the number registers seconds, minutes, and
hours, which are initialized at start-up of gtroff, should be sufficient.
Use the af request to get a formatted output:
.af hours 00
.af minutes 00
.af seconds 00
\n[hours]:\n[minutes]:\n[seconds]
The systat read-write number register contains the return value of the
system() function executed by the last sy request.
drivers that do not know about this extension (see Section 8.1.2.4
[Device Control Commands], page 207).
See Chapter 7 [Output Devices], page 191.
5.31 Miscellaneous
This section documents parts of gtroff that cannot (yet) be categorized
elsewhere in this manual.
.nm [start [inc [space [indent]]]] [Request]
Print line numbers. start is the line number of the next output line.
inc indicates which line numbers are printed. For example, the value 5
means to emit only line numbers that are multiples of 5; this defaults
to 1. space is the space to be left between the number and the text; this
defaults to one digit space. The fourth argument is the indentation of
the line numbers, defaulting to zero. Both space and indent are given
as multiples of digit spaces; they can be negative also. Without any
arguments, line numbers are turned off.
gtroff reserves three digit spaces for the line number (which is printed
right-justified) plus the amount given by indent; the output lines are con-
catenated to the line numbers, separated by space, and without reducing
the line length. Depending on the value of the horizontal page offset (as
set with the po request), line numbers that are longer than the reserved
space stick out to the left, or the whole line is moved to the right.
Parameters corresponding to missing arguments are not changed; any
non-digit argument (to be more precise, any argument starting with a
character valid as a delimiter for identifiers) is also treated as missing.
If line numbering has been disabled with a call to nm without an argu-
ment, it can be reactivated with ‘.nm +0’, using the previously active line
numbering parameters.
The parameters of nm are associated with the current environment (see
Section 5.26 [Environments], page 166). The current output line number
is available in the number register ln.
.po 1m
.ll 2i
This test shows how line numbering works with groff.
.nm 999
This test shows how line numbering works with groff.
.br
.nm xxx 3 2
.ll -\w’0’u
This test shows how line numbering works with groff.
.nn 2
This test shows how line numbering works with groff.
And here the result:
Chapter 5: gtroff Reference 177
.ll 3i
.mc |
This paragraph is highlighted with a margin
character.
.sp
Note that vertical space isn’t marked.
.br
\&
.br
But we can fake it with ‘\&’.
Result:
This paragraph is highlighted |
with a margin character. |
18
Except the escapes \f, \F, \H, \m, \M, \R, \s, and \S, which are processed immediately
if not in copy-in mode.
Chapter 5: gtroff Reference 179
very reason why not all characters are valid input. See Section 5.4 [Identi-
fiers], page 65, for more on this topic.
For example, the input string ‘fi\[:u]’ is converted into a character
token ‘f’, a character token ‘i’, and a special token ‘:u’ (representing u um-
laut). Later on, the character tokens ‘f’ and ‘i’ are merged to a single output
node representing the ligature glyph ‘fi’ (provided the current font has a
glyph for this ligature); the same happens with ‘:u’. All output glyph nodes
are ‘processed’, which means that they are invariably associated with a given
font, font size, advance width, etc. During the formatting process, gtroff
itself adds various nodes to control the data flow.
Macros, diversions, and strings collect elements in two chained lists: a
list of input tokens that have been passed unprocessed, and a list of output
nodes. Consider the following the diversion.
.di xxx
a
\!b
c
.br
.di
It contains these elements.
node list token list element number
5.33 Debugging
gtroff is not easy to debug, but there are some useful features and strategies
for debugging.
.lf line [filename] [Request]
Change the line number and optionally the file name gtroff shall use
for error and warning messages. line is the input line number of the next
line.
Without argument, the request is ignored.
This is a debugging aid for documents that are split into many files,
then put together with soelim and other preprocessors. Usually, it isn’t
invoked manually.
Note that other troff implementations (including the original AT&T
version) handle lf differently. For them, line changes the line number of
the current line.
Chapter 5: gtroff Reference 181
causes a warning if gtroff must add 0.2 m or more for each interword
space in a line.
This request is active only if text is justified to both margins (using
‘.ad b’).
gtroff has command-line options for printing out more warnings (-w)
and for printing backtraces (-b) when a warning or an error occurs. The
most verbose level of warnings is -ww.
.warn [flags] [Request]
\n[.warn] [Register]
Control the level of warnings checked for. The flags are the sum of the
numbers associated with each warning that is to be enabled; all other
warnings are disabled. The number associated with each warning is listed
below. For example, .warn 0 disables all warnings, and .warn 1 disables
all warnings except that about missing glyphs. If no argument is given,
all warnings are enabled.
The read-only number register .warn contains the current warning level.
5.33.1 Warnings
The warnings that can be given to gtroff 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.
‘char’
‘1’ Non-existent glyphs.19 This is enabled by default.
‘number’
‘2’ Invalid numeric expressions. This is enabled by default. See
Section 5.3 [Expressions], page 63.
‘break’
‘4’ In fill mode, lines that could not be broken so that their length
was less than the line length. This is enabled by default.
‘delim’
‘8’ Missing or mismatched closing delimiters.
‘el’
‘16’ Use of the el request with no matching ie request. See
Section 5.20.2 [if-else], page 138.
‘scale’
‘32’ Meaningless scaling indicators.
‘range’
‘64’ Out of range arguments.
19
char is a misnomer since it reports missing glyphs – there aren’t missing input char-
acters, only invalid ones.
184 The GNU Troff Manual
‘syntax’
‘128’ Dubious syntax in numeric expressions.
‘di’
‘256’ Use of di or da without an argument when there is no current
diversion.
‘mac’
‘512’ Use of undefined strings, macros and diversions. When an unde-
fined string, macro, or diversion is used, that string is automat-
ically defined as empty. So, in most cases, at most one warning
is given for each name.
‘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 is given for
use of a particular name.
‘tab’
‘2048’ Use of a tab character where a number was expected.
‘right-brace’
‘4096’ Use of \} where a number was expected.
‘missing’
‘8192’ Requests that are missing non-optional arguments.
‘input’
‘16384’ Invalid input characters.
‘escape’
‘32768’ Unrecognized escape sequences. When an unrecognized escape
sequence \X is encountered, the escape character is ignored, and
X is printed.
‘space’
‘65536’ Missing space between a request or macro and its argument.
This warning is 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 is not in-
voked. When this warning is given, no macro is automatically
defined. This is enabled by default. This warning never occurs
in compatibility mode.
‘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.
Chapter 5: gtroff Reference 185
‘color’
‘524288’ Color related warnings.
‘file’
‘1048576’ Missing files. The mso request gives this warning when the re-
quested macro file does not exist. This is enabled by default.
‘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.
.ds xx ’
\w’abc\*(xxdef’
In compatibility mode, the string ‘72def’’ is returned; without -C the re-
sulting string is ‘168’ (assuming a TTY output device).
Finally, the escapes \f, \H, \m, \M, \R, \s, and \S are transparent for
recognizing the beginning of a line only in compatibility mode (this is a
rather obscure feature). For example, the code
.de xx
Hello!
..
\fB.xx\fP
prints ‘Hello!’ in bold face if in compatibility mode, and ‘.xx’ in bold face
otherwise.
GNU troff does not allow the use of the escape sequences \|, \^, \&,
\{, \}, \SP, \’, \‘, \-, \_, \!, \%, and \c in names of strings, macros,
diversions, number registers, fonts or environments; Unix troff does. The
\A escape sequence (see Section 5.4 [Identifiers], page 65) may be helpful in
avoiding use of these escape sequences in names.
Fractional point sizes cause one noteworthy incompatibility. In Unix
troff the ps request ignores scale indicators and thus
.ps 10u
sets the point size to 10 points, whereas in GNU troff it sets the point size
to 10 scaled points. See Section 5.18.2 [Fractional Type Sizes], page 130, for
more information.
In GNU troff there is a fundamental difference between (unformatted)
input characters and (formatted) output glyphs. Everything that affects how
a glyph is output is stored with the glyph node; once a glyph node has been
constructed it is unaffected by any subsequent requests that are executed,
including bd, cs, tkf, tr, or fp requests. Normally glyphs are constructed
from input characters at the moment immediately before the glyph is added
to the current output line. Macros, diversions and strings are all, in fact, the
same type of object; they contain lists of input characters and glyph nodes
in any combination. A glyph node does not behave like an input character
for the purposes of macro processing; it does not inherit any of the special
properties that the input character from which it was constructed might
have had. For example,
.di x
\\\\
.br
.di
.x
prints ‘\\’ in GNU troff; each pair of input backslashes is turned into one
output backslash and the resulting output backslashes are not interpreted
as escape characters when they are reread. Unix troff would interpret
Chapter 5: gtroff Reference 187
them as escape characters when they were reread and would end up printing
one ‘\’. The correct way to obtain a printable backslash is to use the \e
escape sequence: This always prints a single instance of the current escape
character, regardless of whether or not it is used in a diversion; it also works
in both GNU troff and Unix troff.20 To store, for some reason, an escape
sequence in a diversion that is interpreted when the diversion is reread, either
use the traditional \! transparent output facility, or, if this is unsuitable,
the new \? escape sequence.
See Section 5.25 [Diversions], page 162, and Section 5.32 [Gtroff Inter-
nals], page 178, for more information.
20
To be completely independent of the current escape character, use \(rs, which repre-
sents a reverse solidus (backslash) glyph.
189
6 Preprocessors
This chapter describes all preprocessors that come with groff or which are
freely available.
6.1 geqn
6.1.1 Invoking geqn
6.2 gtbl
6.2.1 Invoking gtbl
6.3 gpic
6.3.1 Invoking gpic
6.4 ggrn
6.4.1 Invoking ggrn
6.5 grap
A free implementation of grap, written by Ted Faber, is available as an extra
package from the following address:
http://www.lunabase.org/~faber/Vault/software/grap/
6.6 gchem
6.6.1 Invoking gchem
6.7 grefer
6.7.1 Invoking grefer
6.8 gsoelim
6.8.1 Invoking gsoelim
190 The GNU Troff Manual
6.9 preconv
6.9.1 Invoking preconv
191
7 Output Devices
7.2 grotty
The postprocessor grotty translates the output from GNU troff into a
form suitable for typewriter-like devices. It is fully documented on its manual
page, grotty(1).
7.3 grops
The postprocessor grops translates the output from GNU troff into a form
suitable for Adobe PostScript devices. It is fully documented on its man-
ual page, grops(1).
7.4 gropdf
The postprocessor gropdf translates the output from GNU troff into a
form suitable for Adobe PDF devices. It is fully documented on its manual
page, gropdf(1).
7.5 grodvi
The postprocessor grodvi translates the output from GNU troff into the
DVI output format compatible with the TEX document preparation system.
It is fully documented on its manual page, grodvi(1).
7.6 grolj4
The postprocessor grolj4 translates the output from GNU troff into the
PCL5 output format suitable for printing on a HP LaserJet 4 printer. It is
fully documented on its manual page, grolj4(1).
-Fdir Put the directory dir/devname in front of the search path for the
font and device description files, given the target device name,
usually lj4.
-psize Set the page dimensions. Valid values for size are: letter,
legal, executive, a4, com10, monarch, c5, b5, d1.
-wn Set the line thickness to n/1000 em. Overrides the default value
n = 40.
The special drawing command \D’R dh dv’ draws a horizontal rectangle
from the current position to the position at offset (dh,dv).
7.7 grolbp
The postprocessor grolbp translates the output from GNU troff into the
LBP output format suitable for printing on Canon CAPSL printers. It is
fully documented on its manual page, grolbp(1).
-Fdir Put the directory dir/devname in front of the search path for
the font, prologue and device description files, given the target
device name, usually lbp.
-oorientation
Use the orientation specified: portrait or landscape.
-ppapersize
Set the page dimensions. See groff font(5) manual page for de-
tails.
-wn Set the line thickness to n/1000 em. Overrides the default value
n = 40.
7.8 grohtml
The grohtml front end (which consists of a preprocessor, pre-grohtml,
and a device driver, post-grohtml) translates the output of GNU troff
to HTML. Users should always invoke grohtml via the groff command
with a \-Thtml option. If no files are given, grohtml will read the standard
input. A filename of - will also cause grohtml to read the standard input.
HTML output is written to the standard output. When grohtml is run by
groff, options can be passed to grohtml using groff’s -P option.
grohtml invokes groff twice. In the first pass, pictures, equations, and
tables are rendered using the ps device, and in the second pass HTML output
is generated by the html device.
grohtml always writes output in UTF-8 encoding and has built-in entities
for all non-composite unicode characters. In spite of this, groff may issue
warnings about unknown special characters if they can’t be found during the
first pass. Such warnings can be safely ignored unless the special characters
appear inside a table or equation, in which case glyphs for these characters
must be defined for the ps device as well.
This output device is fully documented on its manual page, grohtml(1).
7.9 gxditview
7.9.1 Invoking gxditview
199
8 File formats
All files read and written by gtroff are text files. The following two sections
describe their format.
1
The parser and postprocessor for intermediate output can be found in the file
groff-source-dir/src/libs/libdriver/input.cpp.
200 The GNU Troff Manual
8.1.1.1 Separation
AT&T troff output has strange requirements on whitespace. The gtroff
output parser, however, is smart about whitespace by making it maximally
optional. The whitespace characters, i.e., the tab, space, and newline char-
acters, always have a syntactical meaning. They are never printable because
spacing within the output is always done by positioning commands.
Any sequence of space or tab characters is treated as a single syntactical
space. It separates commands and arguments, but is only required when
there would occur a clashing between the command code and the arguments
without the space. Most often, this happens when variable-length command
names, arguments, argument lists, or command clusters meet. Commands
and arguments with a known, fixed length need not be separated by syntac-
tical space.
A line break is a syntactical element, too. Every command argument
can be followed by whitespace, a comment, or a newline character. Thus a
syntactical line break is defined to consist of optional syntactical space that
is optionally followed by a comment, and a newline character.
The normal commands, those for positioning and text, consist of a sin-
gle letter taking a fixed number of arguments. For historical reasons, the
parser allows stacking of such commands on the same line, but fortunately,
in gtroff’s intermediate output, every command with at least one argument
is followed by a line break, thus providing excellent readability.
The other commands – those for drawing and device controlling – have
a more complicated structure; some recognize long command names, and
some take a variable number of arguments. So all ‘D’ and ‘x’ commands
were designed to request a syntactical line break after their last argument.
Only one command, ‘x X’, has an argument that can stretch over several
lines; all other commands must have all of their arguments on the same line
as the command, i.e., the arguments may not be split by a line break.
Empty lines (these are lines containing only space and/or a comment),
can occur everywhere. They are just ignored.
Da h1 v1 h2 v2hline breaki
Draw arc from current position to (h1,v1)+(h2,v2) with center
at (h1,v1); then move the current position to the final point of
the arc.
DC dhline breaki
DC d dummy-arghline breaki
Draw a solid circle using the current fill color with diameter d
(integer in basic units ‘u’) with leftmost point at the current po-
sition; then move the current position to the rightmost point of
the circle. An optional second integer argument is ignored (this
allows the formatter to generate an even number of arguments).
This command is a gtroff extension.
Dc dhline breaki
Draw circle line with diameter d (integer in basic units ‘u’) with
leftmost point at the current position; then move the current
position to the rightmost point of the circle.
DE h vhline breaki
Draw a solid ellipse in the current fill color with a horizontal
diameter of h and a vertical diameter of v (both integers in
basic units ‘u’) with the leftmost point at the current position;
then move to the rightmost point of the ellipse. This command
is a gtroff extension.
De h vhline breaki
Draw an outlined ellipse with a horizontal diameter of h and a
vertical diameter of v (both integers in basic units ‘u’) with the
leftmost point at current position; then move to the rightmost
point of the ellipse.
DFdhline breaki
Set fill color for solid drawing objects to the default
fill color value (black in most cases). No component
arguments.
DFg grayhline breaki
Set fill color for solid drawing objects to the shade
of gray given by the argument, an integer between
0 (black) and 65536 (white).
DFk cyan magenta yellow blackhline breaki
Set fill color for solid drawing objects using the
CMYK color scheme, having the 4 color components
cyan, magenta, yellow, and black.
DFr red green bluehline breaki
Set fill color for solid drawing objects using the RGB
color scheme, having the 3 color components red,
green, and blue.
Df nhline breaki
The argument n must be an integer in the range −32767 to
32767.
0 ≤ n ≤ 1000
Set the color for filling solid drawing objects to a
shade of gray, where 0 corresponds to solid white,
1000 (the default) to solid black, and values in be-
tween to intermediate shades of gray; this is obso-
leted by command ‘DFg’.
n < 0 or n > 1000
Set the filling color to the color that is currently be-
ing used for the text and the outline, see command
‘m’. For example, the command sequence
mg 0 0 65536
Df -1
sets all colors to blue.
No position changing. This command is a gtroff extension.
Dl h vhline breaki
Draw line from current position to offset (h,v) (integers in basic
units ‘u’); then set current position to the end of the drawn line.
Dp h1 v1 h2 v2 ... hn vnhline breaki
Draw a polygon line from current position to offset (h1,v1), from
there to offset (h2,v2), etc. up to offset (hn,vn), and from there
back to the starting position. For historical reasons, the posi-
tion is changed by adding the sum of all arguments with odd
Chapter 8: File formats 207
index to the actual horizontal position and the even ones to the
vertical position. Although this doesn’t make sense it is kept for
compatibility. This command is a gtroff extension.
DP h1 v1 h2 v2 ... hn vnhline breaki
Draw a solid polygon in the current fill color rather than an
outlined polygon, using the same arguments and positioning as
the corresponding ‘Dp’ command. This command is a gtroff
extension.
Dt nhline breaki
Set the current line thickness to n (an integer in basic units ‘u’)
if n > 0; if n = 0 select the smallest available line thickness; if
n < 0 set the line thickness proportional to the point size (this
is the default before the first ‘Dt’ command was specified). For
historical reasons, the horizontal position is changed by adding
the argument to the actual horizontal position, while the vertical
position is not changed. Although this doesn’t make sense it is
kept for compatibility. This command is a gtroff extension.
xX anythinghline breaki
The ‘x’ stands for X-escape.
Send string anything uninterpreted to the device. If the line
following this command starts with a ‘+’ character this line is
interpreted as a continuation line in the following sense. The ‘+’
is ignored, but a newline character is sent instead to the device,
the rest of the line is sent uninterpreted. The same applies to
all following lines until the first character of a line is not a ‘+’
character. This command is generated by the gtroff escape
sequence \X. The line-continuing feature is a gtroff extension.
ddg Move right dd (exactly two decimal digits) basic units ‘u’, then
print glyph g (represented as a single character).
In gtroff, arbitrary syntactical space around and within this
command is allowed to be added. Only when a preceding com-
mand on the same line ends with an argument of variable length
a separating space is obligatory. In AT&T troff, large clusters
of these and other commands are used, mostly without spaces;
this made such output almost unreadable.
For modern high-resolution devices, this command does not make sense
because the width of the glyphs can become much larger than two decimal
digits. In gtroff, this is only used for the devices X75, X75-12, X100, and
X100-12. For other devices, the commands ‘t’ and ‘u’ provide a better
functionality.
High-resolution device ps
This is the standard output of gtroff if no -T option is given.
210 The GNU Troff Manual
x T ps
x res 72000 1 1
x init
p1
x font 5 TR
f5
s10000
V12000
H72000
thell
wh2500
tw
H96620
torld
n12000 0
x trailer
V792000
x stop
This output can be fed into grops to get its representation as a
PostScript file.
Low-resolution device latin1
This is similar to the high-resolution device except that the posi-
tioning is done at a minor scale. Some comments (lines starting
with ‘#’) were added for clarification; they were not generated
by the formatter.
shell> echo "hell world" | groff -Z -T latin1
# prologue
x T latin1
x res 240 24 40
x init
# begin a new page
p1
# font setup
x font 1 R
f1
s10
# initial positioning on the page
V40
H0
# write text ‘hell’
thell
# inform about space, and issue a horizontal jump
Chapter 8: File formats 211
wh24
# write text ‘world’
tworld
# announce line break, but do nothing because ...
n40 0
# ... the end of the document has been reached
x trailer
V2640
x stop
This output can be fed into grotty to get a formatted text
document.
AT&T troff output
Since a computer monitor has a very low resolution compared
to modern printers the intermediate output for the X Window
devices can use the jump-and-write command with its 2-digit
displacements.
shell> echo "hell world" | groff -Z -T X100
x T X100
x res 100 1 1
x init
p1
x font 5 TR
f5
s10
V16
H100
# write text with jump-and-write commands
ch07e07l03lw06w11o07r05l03dh7
n16 0
x trailer
V1100
x stop
This output can be fed into xditview or gxditview for display-
ing in X.
Due to the obsolete jump-and-write command, the text clusters
in the AT&T troff output are almost unreadable.
fonts n F1 F2 F3 ... Fn
Fonts F1 . . . Fn are mounted in the font positions m+1, . . . ,
m+n where m is the number of styles. This command may extend
over more than one line. A font name of 0 means no font is
mounted on the corresponding font position.
hor n The horizontal resolution is n machine units. All horizontal
quantities are rounded to be multiples of this value.
image_generator string
Needed for grohtml only. It specifies the program to generate
PNG images from PostScript input. Under GNU/Linux this
is usually gs but under other systems (notably cygwin) it might
be set to another name.
paperlength n
The physical vertical dimension of the output medium in ma-
chine units. This isn’t used by troff itself but by output de-
vices. Deprecated. Use papersize instead.
papersize string ...
Select a paper size. Valid values for string are the ISO pa-
per types A0–A7, B0–B7, C0–C7, D0–D7, DL, and the US paper
types letter, legal, tabloid, ledger, statement, executive,
com10, and monarch. Case is not significant for string if it holds
predefined paper types. Alternatively, string can be a file name
(e.g. /etc/papersize); if the file can be opened, groff reads the
first line and tests for the above paper sizes. Finally, string can
be a custom paper size in the format length,width (no spaces
before and after the comma). Both length and width must have
a unit appended; valid values are ‘i’ for inches, ‘c’ for centime-
ters, ‘p’ for points, and ‘P’ for picas. Example: 12c,235p. An
argument that starts with a digit is always treated as a custom
paper format. papersize sets both the vertical and horizontal
dimension of the output medium.
More than one argument can be specified; groff scans from left
to right and uses the first valid paper specification.
paperwidth n
The physical horizontal dimension of the output medium in ma-
chine units. This isn’t used by troff itself but by output de-
vices. Deprecated. Use papersize instead.
pass_filenames
Tell gtroff to emit the name of the source file currently being
processed. This is achieved by the intermediate output com-
mand ‘F’. Currently, this is only used by the grohtml output
device.
214 The GNU Troff Manual
postpro program
Call program as a postprocessor. For example, the line
postpro grodvi
in the file devdvi/DESC makes groff call grodvi if option -Tdvi
is given (and -Z isn’t used).
prepro program
Call program as a preprocessor. Currently, this keyword is used
by groff with option -Thtml or -Txhtml only.
print program
Use program as a spooler program for printing. If omitted, the
-l and -L options of groff are ignored.
res n There are n machine units per inch.
sizes s1 s2 ... sn 0
This means that the device has fonts at s1, s2, . . . sn scaled
points. The list of sizes must be terminated by 0 (this is digit
zero). Each si can also be a range of sizes m–n. The list can
extend over more than one line.
sizescale n
The scale factor for point sizes. By default this has a value of 1.
One scaled point is equal to one point/n. The arguments to
the unitwidth and sizes commands are given in scaled points.
See Section 5.18.2 [Fractional Type Sizes], page 130, for more
information.
styles S1 S2 ... Sm
The first m font positions are associated with styles S1 . . . Sm.
tcommand This means that the postprocessor can handle the ‘t’ and ‘u’
intermediate output commands.
unicode Indicate that the output device supports the complete Unicode
repertoire. Useful only for devices that produce character enti-
ties instead of glyphs.
If unicode is present, no charset section is required in the font
description files since the Unicode handling built into groff is
used. However, if there are entries in a charset section, they
either override the default mappings for those particular charac-
ters or add new mappings (normally for composite characters).
This is used for -Tutf8, -Thtml, and -Txhtml.
unitwidth n
Quantities in the font files are given in machine units for fonts
whose point size is n scaled points.
Chapter 8: File formats 215
unscaled_charwidths
Make the font handling module always return unscaled character
widths. Needed for the grohtml device.
use_charnames_in_special
This command indicates that gtroff should encode special char-
acters inside special commands. Currently, this is only used by
the grohtml output device. See Section 5.30 [Postprocessor Ac-
cess], page 175.
vert n The vertical resolution is n machine units. All vertical quantities
are rounded to be multiples of this value.
The res, unitwidth, fonts, and sizes lines are mandatory. Other com-
mands are ignored by gtroff but may be used by postprocessors to store
arbitrary information about the device in the DESC file.
Here a list of obsolete keywords that are recognized by groff but com-
pletely ignored: spare1, spare2, biggestfont.
subsections can appear in any order. Each subsection starts with a word on
a line by itself.
The word charset starts the character set subsection.4 The charset line
is followed by a sequence of lines. Each line gives information for one glyph.
A line comprises a number of fields separated by blanks or tabs. The format
is
name metrics type code [entity-name] [-- comment]
name identifies the glyph name5 : If name is a single character c then it
corresponds to the gtroff input character c; if it is of the form ‘\c’ where
c is a single character, then it corresponds to the special character \[c];
otherwise it corresponds to the special character ‘\[name]’. If it is exactly
two characters xx it can be entered as ‘\(xx’. Note that single-letter special
characters can’t be accessed as ‘\c’; the only exception is ‘\-’, which is
identical to \[-].
gtroff supports 8-bit input characters; however some utilities have diffi-
culties with eight-bit characters. For this reason, there is a convention that
the entity name ‘charn’ is equivalent to the single input character whose
code is n. For example, ‘char163’ would be equivalent to the character with
code 163, which is the pounds sterling sign in the ISO Latin-1 character
set. You shouldn’t use ‘charn’ entities in font description files since they
are related to input, not output. Otherwise, you get hard-coded connections
between input and output encoding, which prevents use of different (input)
character sets.
The name ‘---’ is special and indicates that the glyph is unnamed; such
glyphs can only be used by means of the \N escape sequence in gtroff.
The type field gives the glyph type:
1 the glyph has a descender, for example, ‘p’;
2 the glyph has an ascender, for example, ‘b’;
3 the glyph has both an ascender and a descender, for example,
‘(’.
The code field gives the code that the postprocessor uses to print the
glyph. The glyph can also be input to gtroff using this code by means
of the \N escape sequence. code can be any integer. If it starts with ‘0’
it is interpreted as octal; if it starts with ‘0x’ or ‘0X’ it is interpreted as
hexadecimal. Note, however, that the \N escape sequence only accepts a
decimal integer.
The entity-name field gives an ASCII string identifying the glyph that the
postprocessor uses to print the gtroff glyph name. This field is optional
4
This keyword is misnamed since it starts a list of ordered glyphs, not characters.
5
The distinction between input, characters, and output, glyphs, is not clearly separated
in the terminology of groff; for example, the char request should be called glyph since
it defines an output entity.
217
and has been introduced so that the grohtml device driver can encode its
character set. For example, the glyph ‘\[Po]’ is represented as ‘£’ in
HTML 4.0.
Anything on the line after the entity-name field resp. after ‘--’ is ignored.
The metrics field has the form:
width[,height[,depth[,italic-correction
[,left-italic-correction[,subscript-correction]]]]]
There must not be any spaces between these subfields (it has been split here
into two lines for better legibility only). Missing subfields are assumed to
be 0. The subfields are all decimal integers. Since there is no associated
binary format, these values are not required to fit into a variable of type
‘char’ as they are in ditroff. The width subfield gives the width of the
glyph. The height subfield gives the height of the glyph (upwards is positive);
if a glyph does not extend above the baseline, it should be given a zero
height, rather than a negative height. The depth subfield gives the depth of
the glyph, that is, the distance from the baseline to the lowest point below
the baseline to which the glyph extends (downwards is positive); if a glyph
does not extend below the baseline, it should be given a zero depth, rather
than a negative depth. The italic-correction subfield gives the amount of
space that should be added after the glyph when it is immediately to be
followed by a glyph from a roman font. The left-italic-correction subfield
gives the amount of space that should be added before the glyph when it is
immediately to be preceded by a glyph from a roman font. The subscript-
correction gives the amount of space that should be added after a glyph
before adding a subscript. This should be less than the italic correction.
A line in the charset section can also have the format
name "
This indicates that name is just another name for the glyph mentioned in
the preceding line.
The word kernpairs starts the kernpairs section. This contains a se-
quence of lines of the form:
c1 c2 n
This means that when glyph c1 appears next to glyph c2 the space between
them should be increased by n. Most entries in the kernpairs section have a
negative value for n.
219
9 Installation
221
B Request Index
Requests appear without the leading control character (normally either ‘.’
or ‘’’).
A D
ab. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 da. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
ad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 de. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
af . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 de1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
aln. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 defcolor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
als . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 dei . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
am. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 dei1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
am1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
ami . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 devicem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
ami1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 di. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
as. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 do. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
as1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 ds. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
asciify . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 ds1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
dt. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
B E
backtrace. . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
bd. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 ec . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
blm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 ecr. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 ecs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
boxa . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 el. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
bp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 em. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
br . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 eo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
break . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 ev. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
brp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 evc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
ex. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
C F
c2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 fam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
cc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 fc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
ce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 fchar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
cf. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 fcolor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
cflags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 fi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
ch. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 fl. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
char . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 fp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
chop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 fschar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 fspecial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
close . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 ft . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109, 113
color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 ftr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
composite. . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 fzoom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
continue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
cp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
cs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 G
cu. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 gcolor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
232 The GNU Troff Manual
H N
hc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 na . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
hcode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 ne. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
hla. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 nf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
hlm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 nh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
hpf. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 nm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
hpfa . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 nn. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
hpfcode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 nop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
hw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 nr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73, 75
hy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 nroff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
hym. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 ns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
hys. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 nx. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
O
I open . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
ie. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 opena . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
if. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 os. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
ig . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
in. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
it. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
itc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 P
pc. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
pev . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
K pi. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
pl. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
kern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 pm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
pn. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
pnr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
L po. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
ps. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
lc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 psbb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 pso . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
lf. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 ptr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
lg. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 pvs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
linetabs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
ll. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
ls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 R
lsm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
lt. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 rchar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
rd. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
return . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
rfschar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
M rj . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
mc. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 rm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
mk. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 rn. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
mso . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 rnn. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
rr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
rs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
rt. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
B: Request Index 233
S tr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
schar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 trf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
shc. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 trin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
shift . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 trnt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
sizes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 troff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
so. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
sp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 U
special . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
spreadwarn . . . . . . . . . . . . . . . . . . . . . . . . . . 182 uf. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
ul. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
ss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
unformat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
sty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
substring. . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
sv. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 V
sy. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
vpt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
vs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
T
ta . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 W
tc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 warn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
ti. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 warnscale. . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
tkf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 wh. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
tl. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 while . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
tm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
tm1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 writec . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
tmc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 writem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
235
C Escape Index
Any escape sequence \X with X not in the list below emits a warning, printing
glyph X.
D Operator Index
! –
! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 - . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63, 64
% /
% . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 / . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
& :
& . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
( <
( . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 < . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
<= . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
<? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
)
) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 =
= . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
== . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
*
* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
>
> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
+ >= . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
+ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63, 64 >? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
239
E Register Index
The macro package or program a specific register belongs to is appended in
brackets.
A register name x consisting of exactly one character can be accessed
as ‘\nx’. A register name xx consisting of exactly two characters can be
accessed as ‘\n(xx’. Register names xxx of any length can be accessed as
‘\n[xxx]’.
$ .j . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
$$ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 .k. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
.kern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
.l. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
% .lg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
.linetabs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
% . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
.ll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
.lt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
. .L . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
.m. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
.$. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
.M. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
.a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
.n. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
.A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
.ne . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
.b. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
.br. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 .ns. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
.c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 .o. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
.cdp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 .O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
.ce. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 .p. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
.cht . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 .pe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
.color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 .pn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
.csk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 .ps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
.C. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 .psr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
.d. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 .pvs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
.ev . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 .P . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
.f. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 .rj. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
.fam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 .R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
.fn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 .s. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
.fp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 .slant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
.F . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 .sr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
.g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 .ss. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
.h. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 .sss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
.height . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 .sty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
.hla . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 .t. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
.hlc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 .tabs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
.hlm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 .trunc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
.hy. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 .T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
.hym . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 .u . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
.hys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 .U . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 .v. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
.i. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 .vpt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
.in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 .V . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
.int . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 .w. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
240 The GNU Troff Manual
.warn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 L
.x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 LL [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
.y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 llx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
.Y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 lly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
.z. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 ln . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
.zoom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 lsn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
lss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
LT [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
C
c. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
ct. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 M
MINGW [ms] . . . . . . . . . . . . . . . . . . . . . . . . . 36, 57
minutes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
D mo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
DD [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
dl. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
dn. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 N
dw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 nl. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
dy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
O
F opmaxx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
FAM [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 opmaxy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
FF [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 opminx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
FI [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 opminy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
FL [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
FM [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
FPD [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 P
FPS [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
PD [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
FVS [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
PI [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
PO [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
PORPHANS [ms] . . . . . . . . . . . . . . . . . . . . . . . . . 35
G ps4html [grohtml] . . . . . . . . . . . . . . . . . . . . 197
PS [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
GROWPS [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
PSINCR [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
GS [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Q
H
QI [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
HM [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
HORPHANS [ms] . . . . . . . . . . . . . . . . . . . . . . . . . 35
hours . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
hp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 R
HY [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 rsb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
rst . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
E: Register Index 241
S U
urx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
ury . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
sb. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
seconds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
skw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
V
VS [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
slimit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
ssc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Y
st. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
year . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
systat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 yr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
243
F Macro Index
The macro package a specific macro belongs to is appended in brackets.
They appear without the leading control character (normally ‘.’).
[ D
[ [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 DA [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
De [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
De [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
] DE [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46, 47
] [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 Ds [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Ds [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
DS [ms] . . . . . . . . . . . . . . . . . . . . . . . . . 46, 47, 57
1 DT [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
1C [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
2 E
2C [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 EE [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
EF [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
EH [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
A EN [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
AB [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 EQ [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
AE [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 EX [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
AI [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
AM [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54, 57
AT [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
AU [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 F
FE [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
B FS [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
B [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
B [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
B1 [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 G
B2 [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
BD [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 G [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
BI [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 GL [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
BI [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
BR [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
BT [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
BT [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 H
BX [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 HB [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
HD [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
HP [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
C
CD [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
CT [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
CW [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
CW [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42, 57
244 The GNU Troff Manual
I P
I [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 P [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
I [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 P1 [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
IB [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 PD [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
ID [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 PE [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
IP [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Pn [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
IP [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 PN [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
IR [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 PP [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
IX [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 PP [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
PS [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
PT [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
PT [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
K PX [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
KE [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47, 48
KF [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
KS [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Q
QE [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
QP [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
L QS [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
LD [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
LG [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
LP [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
LP [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 R
R [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
R [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
RB [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
M RD [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
MC [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 RE [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
MS [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 RE [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
RI [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
RN [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
RP [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
N RS [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
ND [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 RS [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
NE [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
NH [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
NL [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
NT [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
S
SB [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
SH [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
SH [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
O SM [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
OF [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 SM [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
OH [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 SS [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
F: Macro Index 245
T V
TA [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 VE [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
TB [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 VS [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
TC [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
TE [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
TH [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 X
TL [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 XA [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
TP [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 XE [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
TS [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 XP [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
XS [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
U
UC [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
UL [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
247
G String Index
The macro package or program a specific string belongs to is appended in
brackets.
A string name x consisting of exactly one character can be accessed as
‘\*x’. A string name xx consisting of exactly two characters can be accessed
as ‘\*(xx’. String names xxx of any length can be accessed as ‘\*[xxx]’.
! ‘
! [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 ‘ [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
’ {
’ [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 { [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
* }
* [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 } [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
, ~
, [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
~ [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
–
- [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3
3 [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
.
. [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 8
.T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 8 [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
: A
: [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 ABSTRACT [ms] . . . . . . . . . . . . . . . . . . . . . . . . . 53
Ae [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
ae [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
?
? [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
C
CF [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
^ CH [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
^ [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
D
d- [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
_ [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 D- [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
248 The GNU Troff Manual
H R
HF [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 R [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
REFERENCES [ms] . . . . . . . . . . . . . . . . . . . . . . . 53
RF [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
L RH [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
rq [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
LF [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
LH [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
lq [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 S
S [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
SN [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
M SN-DOT [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
MONTH1 [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 SN-NO-DOT [ms] . . . . . . . . . . . . . . . . . . . . . . . . 41
MONTH10 [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 SN-STYLE [ms] . . . . . . . . . . . . . . . . . . . . . . . . . 41
MONTH11 [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
MONTH12 [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
MONTH2 [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 T
MONTH3 [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 th [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
MONTH4 [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Th [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
MONTH5 [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Tm [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
MONTH6 [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 TOC [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
MONTH7 [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
MONTH8 [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
MONTH9 [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 U
U [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
O
o [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 V
v [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Q
q [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 W
Q [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 www-image-template [grohtml] . . . . . . . 197
249
# P
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 paperlength . . . . . . . . . . . . . . . . . . . . . . . . . 213
papersize. . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
paperwidth . . . . . . . . . . . . . . . . . . . . . . . . . . 213
– pass_filenames . . . . . . . . . . . . . . . . . . . . . . 213
--- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 postpro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
prepro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
print . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
B
biggestfont . . . . . . . . . . . . . . . . . . . . . . . . . 215
R
C res . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
charset . . . . . . . . . . . . . . . . . . . . . . . . . 212, 216
S
F sizes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
sizescale. . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
family . . . . . . . . . . . . . . . . . . . . . 109, 114, 212
slant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
fonts . . . . . . . . . . . . . . . . . . . . . . . 114, 122, 213
spacewidth . . . . . . . . . . . . . . . . . . . . . . . . . . 215
spare1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
H spare2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
special . . . . . . . . . . . . . . . . . . . . . . . . . 124, 215
hor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 styles . . . . . . . . . . . . . . . . . 109, 112, 114, 214
I
image_generator . . . . . . . . . . . . . . . . . . . . . 213
T
tcommand . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
K
kernpairs. . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
U
unicode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
unitwidth. . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
L unscaled_charwidths . . . . . . . . . . . . . . . . 215
ligatures. . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 use_charnames_in_special. . . . . . 175, 215
N V
name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 vert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
253
A H
an.tmac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 hyphen.us . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
hyphenex.us . . . . . . . . . . . . . . . . . . . . . . . . . . 87
C
changebar. . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 L
composite.tmac . . . . . . . . . . . . . . . . . . . . . . 117 latin1.tmac . . . . . . . . . . . . . . . . . . . . . . . . . . 61
cp1047.tmac . . . . . . . . . . . . . . . . . . . . . . . . . . 61 latin2.tmac . . . . . . . . . . . . . . . . . . . . . . . . . . 61
latin5.tmac . . . . . . . . . . . . . . . . . . . . . . . . . . 61
latin9.tmac . . . . . . . . . . . . . . . . . . . . . . . . . . 61
D less . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
DESC . . . . . . . . . . . . . . 109, 112, 114, 118, 122
DESC file format . . . . . . . . . . . . . . . . . . . . . . 212
DESC, and font mounting. . . . . . . . . . . . . . 113 M
DESC, and makeindex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
use_charnames_in_special . . . . . . . . 175 man, invocation of preprocessors . . . . . . . . 29
ditroff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 man-old.tmac . . . . . . . . . . . . . . . . . . . . . . . . . 23
man.local . . . . . . . . . . . . . . . . . . . . . . . . . 24, 29
man.tmac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
E man.ultrix . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
ec.tmac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
eqn. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
N
nrchbar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
F
freeeuro.pfa . . . . . . . . . . . . . . . . . . . . . . . . . 61
P
papersize.tmac . . . . . . . . . . . . . . . . . . . . . . . 14
G perl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
pic. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
gchem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
post-grohtml . . . . . . . . . . . . . . . . . . . . . . . . . 11
geqn. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
pre-grohtml . . . . . . . . . . . . . . . . . . . . . . . . . . 11
geqn, invocation in manual pages . . . . . . 29
preconv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
ggrn. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
gpic. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
grap. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
grefer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
R
grefer, invocation in manual pages . . . . 29 refer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
groff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
grog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
grohtml . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
S
gsoelim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 soelim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
gtbl. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
gtbl, invocation in manual pages . . . . . . 29
gtroff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
T
tbl. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
trace.tmac . . . . . . . . . . . . . . . . . . . . . . . . . . 143
troffrc. . . . . . . . . . . 10, 14, 87, 89, 101, 102
troffrc-end . . . . . . . . . . . . . . 10, 87, 89, 101
tty.tmac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
255
K Concept Index
" .
", at end of sentence . . . . . . . . . . . . . . 60, 119 ., as delimiter . . . . . . . . . . . . . . . . . . . . . . . . . 71
", in a macro argument . . . . . . . . . . . . . . . . 68 .h register, difference to nl . . . . . . . . . . . 163
.ps register, in
comparison with .psr . . . . . . . . . . . . . . 131
% .s register, in comparison with .sr . . . 131
.S register, Plan 9 alias for .tabs . . . . . . 94
%, as delimiter . . . . . . . . . . . . . . . . . . . . . . . . . 71
.t register, and diversions . . . . . . . . . . . . 158
.tabs register, Plan 9 alias (.S) . . . . . . . 94
.V register, and vs . . . . . . . . . . . . . . . . . . . 129
&
&, as delimiter . . . . . . . . . . . . . . . . . . . . . . . . . 71
/
/, as delimiter . . . . . . . . . . . . . . . . . . . . . . . . . 71
’
’, as a comment . . . . . . . . . . . . . . . . . . . . . . . 71
’, at end of sentence . . . . . . . . . . . . . . 60, 119 :
’, delimiting arguments . . . . . . . . . . . . . . . . 70 :, as delimiter . . . . . . . . . . . . . . . . . . . . . . . . . 71
( <
(, as delimiter . . . . . . . . . . . . . . . . . . . . . . . . . 71 <, as delimiter . . . . . . . . . . . . . . . . . . . . . . . . . 71
(, starting a
two-character identifier . . . . . . . . . . 66, 70
=
=, as delimiter . . . . . . . . . . . . . . . . . . . . . . . . . 71
)
), as delimiter . . . . . . . . . . . . . . . . . . . . . . . . . 71
), at end of sentence . . . . . . . . . . . . . . 60, 119 >
>, as delimiter . . . . . . . . . . . . . . . . . . . . . . . . . 71
*
*, as delimiter . . . . . . . . . . . . . . . . . . . . . . . . . 71 [
*, at end of sentence . . . . . . . . . . . . . . 60, 119 [, macro names starting
with, and refer . . . . . . . . . . . . . . . . . . . . . 65
[, starting an identifier . . . . . . . . . . . . . 66, 70
+
+, and page motion . . . . . . . . . . . . . . . . . . . . 64
+, as delimiter . . . . . . . . . . . . . . . . . . . . . . . . . 71 ]
], as part of an identifier . . . . . . . . . . . . . . 65
], at end of sentence . . . . . . . . . . . . . . 60, 119
– ], ending an identifier . . . . . . . . . . . . . . 66, 70
-, and page motion . . . . . . . . . . . . . . . . . . . . 64 ], macro names starting
-, as delimiter . . . . . . . . . . . . . . . . . . . . . . . . . 71 with, and refer . . . . . . . . . . . . . . . . . . . . . 65
256 The GNU Troff Manual
example markup, bulleted list [ms] . . . . . 43 fill colors, unnamed (\D’F...’) . . . . . . . 154
example markup, fill mode . . . . . . . . . . . . . . . . . . . . . . 60, 82, 183
glossary-style list [ms]. . . . . . . . . . . . . . . . 44 fill mode (fi) . . . . . . . . . . . . . . . . . . . . . . . . . . 79
example markup, fill mode, and \c . . . . . . . . . . . . . . . . . . . . . 105
multi-page table [ms] . . . . . . . . . . . . . . . . 49 filling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
example markup, numbered list [ms] . . . 43 filling and adjusting, manipulating . . . . . 79
example markup, title page . . . . . . . . . . . . 38 final newline, stripping in diversions . . 134
examples of invocation . . . . . . . . . . . . . . . . . 15 fl request, causing implicit linebreak . . 79
exiting (ex) . . . . . . . . . . . . . . . . . . . . . . . . . . 181 floating keep . . . . . . . . . . . . . . . . . . . . . . . . . . 20
expansion of strings (\*). . . . . . . . . . . . . . 132 flush output (fl) . . . . . . . . . . . . . . . . . . . . . 182
explicit hyphen (\%) . . . . . . . . . . . . . . . . . . . 85 font description file, format . . . . . . 212, 215
expression, limitation of font directories . . . . . . . . . . . . . . . . . . . . . . . . 14
logical not in . . . . . . . . . . . . . . . . . . . . . . . . 64 font families . . . . . . . . . . . . . . . . . . . . . . . . . . 111
expression, order of evaluation . . . . . . . . . 64 font family, changing (fam, \F) . . . . . . . . 111
expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 font file, format . . . . . . . . . . . . . . . . . . . . . . 215
expressions, and space characters . . . . . . 65 font files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
extra post-vertical line space (\x) . . . . . 130 font files, comments . . . . . . . . . . . . . . . . . . 215
extra post-vertical line space font for underlining (uf) . . . . . . . . . . . . . . 124
register (.a) . . . . . . . . . . . . . . . . . . . . . . . . . 91 font height, changing (\H) . . . . . . . . . . . . 123
extra pre-vertical line space (\x) . . . . . . 129 font path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
extra spaces . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 font position register (.f) . . . . . . . . . . . . . 113
extremum operators (>?, <?) . . . . . . . . . . . 64 font position, changing (\f). . . . . . . . . . . 114
font positions. . . . . . . . . . . . . . . . . . . . . . . . . 113
font selection [man]. . . . . . . . . . . . . . . . . . . . . 26
F font slant, changing (\S) . . . . . . . . . . . . . . 123
f unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 font style, changing (sty) . . . . . . . . . . . . . 112
f unit, and colors. . . . . . . . . . . . . . . . . . . . . 169 font styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
factor, zoom, of a font (fzoom) . . . . . . . . 110 font translation (ftr) . . . . . . . . . . . . . . . . . 110
fallback character, defining (fchar, font, magnification (fzoom) . . . . . . . . . . . 110
fschar, schar) . . . . . . . . . . . . . . . . . . . . . 120 font, mounting (fp) . . . . . . . . . . . . . . . . . . 113
fallback glyph, removing definition font, optical size . . . . . . . . . . . . . . . . . . . . . . 110
(rchar, rfschar) . . . . . . . . . . . . . . . . . . . 121 font, previous (ft, \f[], \fP) . . . . . . . . . 109
fam request, and changing fonts . . . . . . . 109 font, zoom factor (fzoom) . . . . . . . . . . . . . 110
fam request, and font positions . . . . . . . 114 fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
families, font . . . . . . . . . . . . . . . . . . . . . . . . . 111 fonts, artificial . . . . . . . . . . . . . . . . . . . . . . . . 122
features, common . . . . . . . . . . . . . . . . . . . . . . 19 fonts, changing (ft, \f). . . . . . . . . . . . . . . 109
fi request, causing implicit linebreak . . 79 fonts, PostScript . . . . . . . . . . . . . . . . . . . . . 111
field delimiting character (fc) . . . . . . . . . . 95 fonts, searching . . . . . . . . . . . . . . . . . . . . . . . . 14
field padding character (fc) . . . . . . . . . . . . 95 fonts, special . . . . . . . . . . . . . . . . . . . . . . . . . 122
fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 footers . . . . . . . . . . . . . . . . . . . . . . . . . . 106, 156
fields, and tabs . . . . . . . . . . . . . . . . . . . . . . . . 92 footers [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
figures [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 footnotes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
file formats . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 footnotes [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . 49
file, appending to (opena) . . . . . . . . . . . . 174 footnotes, and displays [ms] . . . . . . . . . . . . 49
file, closing (close) . . . . . . . . . . . . . . . . . . . 174 footnotes, and keeps [ms] . . . . . . . . . . . . . . . 49
file, inclusion (so) . . . . . . . . . . . . . . . . . . . . 171 form letters . . . . . . . . . . . . . . . . . . . . . . . . . . 172
file, opening (open) . . . . . . . . . . . . . . . . . . . 174 format of font description file . . . . . . . . . 212
file, processing next (nx) . . . . . . . . . . . . . . 172 format of font description files . . . . . . . . 215
file, writing to (write, writec) . . . . . . . 174 format of font files . . . . . . . . . . . . . . . . . . . . 215
files, font . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 format of register (\g) . . . . . . . . . . . . . . . . . 77
files, macro, searching . . . . . . . . . . . . . . . . . 13 formats, assigning (af) . . . . . . . . . . . . . . . . 76
fill color name register (.M) . . . . . . . . . . . 170 formats, file . . . . . . . . . . . . . . . . . . . . . . . . . . 199
K: Concept Index 263
input line trap, setting (it) . . . . . . . . . . . 159 italic glyph, correction after
input line traps . . . . . . . . . . . . . . . . . . . . . . . 159 roman glyph (\,) . . . . . . . . . . . . . . . . . . 126
input line traps and italic glyph, correction before
interrupted lines (itc) . . . . . . . . . . . . . 159 roman glyph (\/) . . . . . . . . . . . . . . . . . . 126
input line, horizontal position,
register (hp). . . . . . . . . . . . . . . . . . . . . . . . 150
input stack, backtrace (backtrace) . . . 182 J
input stack, setting limit . . . . . . . . . . . . . 182 justifying text . . . . . . . . . . . . . . . . . . . . . . . . . 79
input token . . . . . . . . . . . . . . . . . . . . . . . . . . 178 justifying text (rj) . . . . . . . . . . . . . . . . . . . . 84
input, 8-bit . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
input, standard, reading from (rd) . . . . 172
inserting horizontal space (\h) . . . . . . . . 148
installation . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
K
interactive use of gtroff . . . . . . . . . . . . . 182 keep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
intermediate output . . . . . . . . . . . . . . . . . . 199 keep, floating . . . . . . . . . . . . . . . . . . . . . . . . . . 20
interpolating registers (\n) . . . . . . . . . . . . . 74 keeps [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
interpolation of strings (\*) . . . . . . . . . . . 132 keeps, and footnotes [ms] . . . . . . . . . . . . . . . 49
interrupted line. . . . . . . . . . . . . . . . . . . . . . . 104 kerning and ligatures . . . . . . . . . . . . . . . . . 124
interrupted line register (.int) . . . . . . . 105 kerning enabled register (.kern) . . . . . . 125
interrupted lines and input kerning, activating (kern) . . . . . . . . . . . . 125
line traps (itc) . . . . . . . . . . . . . . . . . . . . 159 kerning, track . . . . . . . . . . . . . . . . . . . . . . . . 125
introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
invalid characters for trf request . . . . . 172
invalid input characters . . . . . . . . . . . . . . . . 65 L
invocation examples . . . . . . . . . . . . . . . . . . . 15 landscape page orientation . . . . . . . . . . . . . 14
invoking gchem . . . . . . . . . . . . . . . . . . . . . . . 189 last glyph, dimensions (.w,
invoking geqn . . . . . . . . . . . . . . . . . . . . . . . . 189 .cht, .cdp, .csk) . . . . . . . . . . . . . . . . . . 168
invoking ggrn . . . . . . . . . . . . . . . . . . . . . . . . 189 last-requested point size
invoking gpic . . . . . . . . . . . . . . . . . . . . . . . . 189 registers (.psr, .sr). . . . . . . . . . . . . . . . 131
invoking grefer . . . . . . . . . . . . . . . . . . . . . . 189 latin-1 (ISO 8859-1), input encoding . . . 61
invoking grodvi . . . . . . . . . . . . . . . . . . . . . . 194 latin-1 (ISO 8859-1),
invoking groff . . . . . . . . . . . . . . . . . . . . . . . . . 7 output encoding . . . . . . . . . . . . . . . . . . . . . 11
invoking grohtml . . . . . . . . . . . . . . . . . . . . . 196 latin-2 (ISO 8859-2), input encoding . . . 61
invoking grolbp . . . . . . . . . . . . . . . . . . . . . . 195 latin-5 (ISO 8859-9), input encoding . . . 61
invoking grolj4 . . . . . . . . . . . . . . . . . . . . . . 194 latin-9 (latin-0, ISO 8859-15),
invoking gropdf . . . . . . . . . . . . . . . . . . . . . . 193 input encoding . . . . . . . . . . . . . . . . . . . . . . 61
invoking grops . . . . . . . . . . . . . . . . . . . . . . . 192 layout, line . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
invoking grotty . . . . . . . . . . . . . . . . . . . . . . 191 layout, page . . . . . . . . . . . . . . . . . . . . . . . . . . 105
invoking gsoelim . . . . . . . . . . . . . . . . . . . . . 189 lc request, and glyph definitions . . . . . . 120
invoking gtbl . . . . . . . . . . . . . . . . . . . . . . . . 189 leader character . . . . . . . . . . . . . . . . . . . . . . . 95
invoking gxditview. . . . . . . . . . . . . . . . . . . 197 leader character, and translations . . . . . . 99
invoking preconv . . . . . . . . . . . . . . . . . . . . . 190 leader character, non-interpreted (\a) . . 95
ISO 6249 SGR . . . . . . . . . . . . . . . . . . . . . . . 191 leader repetition character (lc) . . . . . . . . 95
ISO 8859-1 (latin-1), input encoding . . . 61 leaders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
ISO 8859-1 (latin-1), leading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
output encoding . . . . . . . . . . . . . . . . . . . . . 11 leading spaces . . . . . . . . . . . . . . . . . . . . . . . . . 59
ISO 8859-15 (latin-9, latin-0), leading spaces macro (lsm) . . . . . . . . 60, 159
input encoding . . . . . . . . . . . . . . . . . . . . . . 61 leading spaces traps . . . . . . . . . . . . . . . . . . 159
ISO 8859-2 (latin-2), input encoding . . . 61 leading spaces with ds . . . . . . . . . . . . . . . . 132
ISO 8859-9 (latin-5), input encoding . . . 61 left italic correction (\,) . . . . . . . . . . . . . . 126
italic correction (\/) . . . . . . . . . . . . . . . . . . 126 left margin (po) . . . . . . . . . . . . . . . . . . . . . . 101
italic fonts [man] . . . . . . . . . . . . . . . . . . . . . . . 27 left margin, how to move [man] . . . . . . . . . 26
266 The GNU Troff Manual