Groff
Groff
Trent A. Fisher
Werner Lemberg
G. Branden Robinson
This manual documents GNU troff version 1.23.0.
Copyright c 1994–2023 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, no Front-Cover Texts, and
no Back-Cover Texts. A copy of the license is included in the sec-
tion entitled “GNU Free Documentation License”.
i
Table of Contents
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 What Is groff? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.3 groff Capabilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.4 Macro Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.5 Preprocessors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.6 Output Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.7 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.8 Conventions Used in This Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.9 Credits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2 Invoking groff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3 Macro Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.4 Font Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.5 Paper Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.6 Invocation Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4 Macro Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.1 man . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.1.1 Optional man extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
ii
1 Introduction
GNU roff (or groff) is a programming system for typesetting documents.
It is highly flexible and has been used extensively for over thirty years.
1.1 Background
M. Douglas McIlroy, formerly of AT&T Bell Laboratories and present at
the creation of the Unix operating system, offers an authoritative historical
summary.
The prime reason for Unix was the desire of Ken [Thompson], Den-
nis [Ritchie], and Joe Ossanna to have a pleasant environment for
software development. The fig leaf that got the nod from . . .
management was that an early use would be to develop a “stand-
alone” word-processing system for use in typing pools and secre-
tarial offices. Perhaps they had in mind “dedicated”, as distinct
from “stand-alone”; that’s what eventuated in various cases, most
notably in the legal/patent department and in the AT&T CEO’s
office.
Both those systems were targets of opportunity, not foreseen from
the start. When Unix was up and running on the PDP-11, Joe got
wind of the legal department having installed a commercial word
processor. He went to pitch Unix as an alternative and clinched a
trial by promising to make roff able to number lines by tomorrow
in order to fulfill a patent-office requirement that the commercial
system did not support.
Modems were installed so legal-department secretaries could try the
Research machine. They liked it and Joe’s superb customer service.
Soon the legal department got a system of their own. Joe went
on to create nroff and troff. Document preparation became a
widespread use of Unix, but no stand-alone word-processing system
was ever undertaken.
A history relating groff to its predecessors roff, nroff, and troff is
available in the roff(7) man page.
1.5 Preprocessors
An alternative approach to complexity management, particularly when con-
structing tables, setting mathematics, or drawing diagrams, lies in prepro-
cessing. A preprocessor employs a domian-specific language to ease the
generation of tables, equations, and so forth in terms that are convenient
for human entry. Each preprocessor reads a document and translates the
parts of it that apply to it into GNU troff input. Command-line options
to groff tell it which preprocessors to use.
Chapter 1: Introduction 3
1.7 Installation
Locate installation instructions in the files INSTALL, INSTALL.extra, and
INSTALL.REPO in the groff source distribution. Being a GNU project, groff
supports the familiar ‘./configure && make’ command sequence.
when they arise. References to topics discussed later in the text are frequent;
skip material you don’t understand yet.
We use Texinfo’s “result” (⇒) and error notations to present output
written to the standard output and standard error streams, respectively.
Diagnostic messages from the GNU troff formatter and other programs
are examples of the latter, but the formatter can also be directed to write
user-specified messages to the standard error stream. The notation then
serves to identify the output stream and does not necessarily mean that an
error has occurred.2
$ echo "Twelve o'clock and" | groff -Tascii | sed '/^$/d'
⇒ Twelve o'clock and
$ echo '.tm all is well.' | groff > /dev/null
error all is well.
Sometimes we use ⇒ somewhat abstractly to represent formatted text
that you will need to use a PostScript or PDF viewer program (or a printer)
to observe. While arguably an abuse of notation, we think this preferable
to requiring the reader to understand the syntax of these page description
languages.
We also present diagnostic messages in an abbreviated form, often omit-
ting the name of the program issuing them, the input file name, and line
number or other positional information when such data do not serve to illu-
minate the topic under discussion.
Most examples are of roff language input that would be placed in a text
file. Occasionally, we start an example with a ‘$’ character to indicate a
shell prompt, as seen above.
You are encouraged to try the examples yourself, and to alter them to
better learn groff’s behavior. Our examples frequently need to direct the
formatter to set a line length (with ‘.ll’) that will fit within the page margins
of this manual. We mention this so that you know why it is there before we
discuss the ll request formally.3
1.9 Credits
We adapted portions of this manual from existing documents. James Clark’s
man pages were an essential resource; we have updated them in parallel with
the development of this manual. We based the tutorial for macro users on
Eric Allman’s introduction to his me macro package (which we also provide,
little altered from 4.4BSD). Larry Kollar contributed much of the material
on the ms macro package.
2
Unix and related operating systems distinguish standard output and standard er-
ror streams because of troff: https://minnie.tuhs.org/pipermail/tuhs/
2013-December/006113.html.
3
See Section 5.15 [Line Layout], page 122.
5
2 Invoking groff
This chapter 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 dis-
tinguish them from their original counterparts provided by the host (see
Section 2.2 [Environment], page 10). Thus, for example, geqn is GNU eqn.
On operating systems like GNU/Linux or the Hurd, which don’t contain
proprietary versions of troff, and on MS-DOS/MS-Windows, where troff
and associated programs are not available at all, this prefix is omitted since
GNU troff is the only incarnation of troff used. 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 almost all troff implementations1
(with more or less compatible changes). Similarly, we say ‘gpic’, ‘geqn’,
and so on.
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 documents only options to the groff front end. Many of
the arguments to groff are passed on to gtroff; therefore, those are also
included. Arguments to preprocessors and output drivers can be found in
the man pages gpic(1), geqn(1), gtbl(1), ggrn(1), grefer(1), gchem(1), gsoe-
lim(1), preconv(1), grotty(1), grops(1), gropdf(1), grohtml(1), grodvi(1),
grolj4(1), grolbp(1), and gxditview(1).
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.
gtroff [ -abcivzCERU ] [ -dcs ] [ -ffam ] [ -Fdir ]
[ -mname ] [ -Mdir ] [ -nnum ] [ -olist ]
[ -rcn ] [ -Tname ] [ -wname ] [ -Wname ]
[ files... ]
Obviously, many of the options to groff are actually passed on to gtroff.
1
Besides groff, neatroff is an exception.
6 The GNU Troff Manual
‘-Denc’ Set fallback input encoding used by preconv to enc; implies -k.
‘-e’ Run geqn preprocessor.
‘-E’ Inhibit gtroff error messages. This option does not suppress
messages sent to the standard error stream by documents or
macro packages using tm or related requests.
‘-ffam’ Use fam as the default font family. See Section 5.19.2 [Font
Families], page 132.
‘-Fdir’ Search in directory dir for the selected output device’s directory
of device and font description files. See the description of GROFF_
FONT_PATH in Section 2.2 [Environment], page 10, below for the
default search locations and ordering.
‘-g’ Run ggrn preprocessor.
‘-G’ Run grap preprocessor; implies -p.
‘-h’ Display a usage message and exit.
‘-i’ Read the standard input after all the named input files have
been processed.
‘-Idir’ Search the directory dir for files named in several contexts; im-
plies -g and -s.
• gsoelim replaces so requests with the contents of their file
name arguments.
• gtroff searches for files named as operands in its command
line and as arguments to psbb, so, and soquiet requests.
• Output drivers may search for files; for instance, grops
looks for files named in ‘\X'ps: import . . . '’, ‘\X'ps:
file . . . '’, and ‘\X'pdf: pdfpic . . . '’ device control es-
cape sequences.
This option may be specified more than once; the directories
are searched in the order specified. If you want to search the
current directory before others, add ‘-I .’ at the desired place.
The current working directory is otherwise searched last. -I
works similarly to, and is named for, the “include” option of
Unix C compilers.
-I options are passed to gsoelim, gtroff, and output drivers;
with the flag letter changed to -M, they are also passed to ggrn.
‘-j’ Run gchem preprocessor. Implies -p.
‘-k’ Run preconv preprocessor. Refer to its man page for its behav-
ior if neither of groff’s -K or -D options is also specified.
‘-Kenc’ Set input encoding used by preconv to enc; implies -k.
8 The GNU Troff Manual
‘-l’ Send the output to a spooler for printing. The print directive
in the device description file specifies the default command to
be used; see Section 6.2 [Device and Font Description Files],
page 242. See options -L and -X.
‘-Larg’ Pass arg to the print spooler program. If multiple args are
required, pass each with a separate -L option. groff does not
prefix an option dash to arg before passing it to the spooler
program.
‘-mname’ Process the file name.tmac prior to any input files. If not found,
tmac.name is attempted. name (in both arrangements) is pre-
sumed to be a macro file; see the description of GROFF_TMAC_
PATH in Section 2.2 [Environment], page 10, below for the default
search locations and ordering. This option and its argument are
also passed to geqn, grap, and ggrn.
‘-Mdir’ Search directory dir for macro files; see the description of
GROFF_TMAC_PATH in Section 2.2 [Environment], page 10, be-
low for the default search locations and ordering. This option
and its argument are also passed to geqn, grap, and ggrn.
‘-nnum’ Number the first page num.
‘-N’ Prohibit newlines between eqn delimiters: pass -N to geqn.
‘-olist’ Output only pages in list, which is a comma-separated list of
page ranges; ‘n’ means page n, ‘m-n’ means every page between
m and n, ‘-n’ means every page up to n, ‘n-’ means every page
from n on. gtroff stops processing and exits after formatting
the last page enumerated in list.
‘-p’ Run gpic preprocessor.
‘-Parg’ Pass arg to the postprocessor. If multiple args are required,
pass each with a separate -P option. groff does not prefix an
option dash to arg before passing it to the postprocessor.
‘-rcnumeric-expression’
‘-rregister=expr’
Set roff register c or register to the value numeric-expression
(see Section 5.4 [Numeric Expressions], page 77). c must be
one character; register can be of arbitrary length. Such register
assignments happen before any macro file is loaded, including
the startup file. Due to getopt_long limitations, c cannot be,
and register cannot contain, an equals sign, even though that is
a valid character in a roff identifier.
‘-R’ Run grefer preprocessor. No mechanism is provided for passing
arguments to grefer because most grefer options have equiv-
alent language elements that can be specified within the docu-
ment.
Chapter 2: Invoking groff 9
2.2 Environment
There are also several environment variables (of the operating system, not
within gtroff) that can modify the behavior of groff.
Chapter 2: Invoking groff 11
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 variable is passed to the preconv preproces-
sor’s -e option to select the character encoding of input files.
This variable’s existence implies the groff option -k. If set
but empty, groff calls preconv without an -e option. groff’s
-K option overrides GROFF_ENCODING. See the preconv(7) man
page; type ‘man preconv’ at the command line to view it.
GROFF_FONT_PATH
A list of directories in which to seek the selected output device’s
directory of device and font description files. GNU troff will
search directories given as arguments to any specified -F op-
tions before these, and a built-in list of directories after them.
See Section 2.4 [Font Directories], page 12, and the troff(1) or
gtroff(1) man pages.
GROFF_TMAC_PATH
A list of directories in which to seek macro files. GNU troff
will search directories given as arguments to any specified -M
options before these, and a built-in list of directories after them.
See Section 2.3 [Macro Directories], page 12, and the troff(1) or
gtroff(1) man pages.
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
Sets the default output device. If empty or not set, a build-time
default (often ps) is used. The -Tdev option overrides GROFF_
TYPESETTER.
12 The GNU Troff Manual
SOURCE_DATE_EPOCH
A timestamp (expressed as seconds since the Unix epoch) to
use as the output creation timestamp in place of the current
time. The time is converted to human-readable form using lo-
caltime(3) when the formatter starts up and stored in regis-
ters usable by documents and macro packages (see Section 5.8.5
[Built-in Registers], page 98).
TZ The time zone to use when converting the current time (or value
of SOURCE_DATE_EPOCH) to human-readable form; see tzset(3).
MS-DOS and MS-Windows ports of groff use semicolons, rather than
colons, to separate the directories in the lists described above.
family name and ‘R’, ‘B’, ‘I’, and ‘BI’ to indicate the styles ‘roman’, ‘bold’,
‘italic’, and ‘bold italic’, respectively. Thus the final font names are ‘TR’,
‘TB’, ‘TI’, and ‘TBI’.
Font description files are kept in font directories, which together con-
stitute the font path. The search procedure always appends the directory
devname, where name is the name of the output device. Assuming TEX
DVI output, and /foo/bar as a font directory, the font description files for
grodvi must be in /foo/bar/devdvi. Each directory in the font path is
searched in the following order until the desired font description file is found
or the list is exhausted.
• Directories specified with GNU troff’s or groff’s -f command-line op-
tion. All output drivers (and some preprocessors) support this option as
well, because they require information about the glyphs to be rendered
in the document.
• Directories listed in the GROFF_FONT_PATH environment variable.
• A site-local directory and the main font description directory. The lo-
cations corresponding to your installation are listed in section “Envi-
ronment” of gtroff(1). If not otherwise configured, they are as follows.
/usr/local/share/groff/site-font
/usr/local/share/groff/1.23.0/font
The foregoing assumes that the version of groff is 1.23.0, and that
the installation prefix was /usr/local. It is possible to fine-tune these
locations during the source configuration process.
3.1 Basics
Let us first survey some basic concepts necessary to use a macro package
fruitfully.1 References are made throughout to more detailed information.
GNU troff reads an input file prepared by the user and outputs a for-
matted document suitable for publication or framing. The input consists of
text, or words to be printed, and embedded commands (requests and escape
sequences), which tell GNU troff how to format the output. See Section 5.6
[Formatter Instructions], page 83.
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 (not tabs). See Section 5.6.2 [Invoking
Requests], page 84.
The primary function of GNU troff is to collect words from input lines,
fill output lines with those words, adjust the line to the right-hand margin
by widening spaces, 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.
1
The remainder of this chapter is based on Writing Papers with nroff using -me by
Eric P. Allman, which is distributed with groff as meintro.me.
16 The GNU Troff Manual
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 force a break, starting a new output line. Some requests cause
a break automatically, as do (normally) blank input lines and input lines
beginning with a space or tab.
Not all input lines are text lines—words to be formatted. Some are
control lines that tell a macro package (or GNU troff directly) how to
format the text. Control lines start with a dot (‘.’) or an apostrophe (‘'’)
as the first character, and can be followed by a macro call.
The formatter also does more complex things, such as automatically num-
bering 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 GNU troff.
• First, keep the input lines short. Short input lines are easier to edit,
and GNU troff 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. GNU troff recognizes characters that usually end a sentence,
and inserts inter-sentence space accordingly.
• Do not hyphenate words at the end of lines—GNU troff 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”.
We offer further advice in Section 5.1.10 [Input Conventions], page 71.
GNU troff permits alteration of the distance between lines of text. This
is termed vertical spacing and is expressed in the same units as the type
size—the point. The default is 10-point type on 12-point spacing. To get
double-spaced text you would set the vertical spacing to 24 points. Some,
but not all, macro packages expose a macro or register to configure the
vertical spacing.
A number of requests allow you to change the way the output is arranged
on the page, sometimes called the layout of the output page. Most macro
packages don’t supply macros for performing these (at least not without per-
forming other actions besides), as they are such basic operations. The macro
packages for writing man pages, man and mdoc, don’t encourage explicit use
of these requests at all.
The request ‘.sp N’ leaves N lines of blank space. N can be omitted
(skipping a single line) or can be of the form N i (for N inches) or N c (for
N centimeters). For example, the input:
Chapter 3: Tutorial for Macro Users 17
.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.3 [Measurements], page 75).
If you seek precision in spacing, be advised when using a macro package
that it might not honor sp requests as you expect; it can use a formatter fea-
ture called no-space mode to prevent excess space from accumulating. Macro
packages typically offer registers to control spacing between paragraphs, be-
fore section headings, and around displays (discussed below); use these fa-
cilities preferentially. See Section 5.11 [Manipulating Spacing], page 112.
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
‘.ce N’ (where N is the number of lines to center), followed by the N lines.
To center many lines without counting them, type:
.ce 1000
lines to center
.ce 0
The ‘.ce 0’ request tells GNU troff to center zero more lines, in other
words, stop centering.
GNU troff also offers the rj request for right-aligning text. It works
analogously to ce and is convenient for setting epigraphs.
The bp request starts a new page; this necessarily implies an ordinary
(line) break.
All of these requests cause a break; that is, they always start a new line.
To start a new line without performing any other action, use br. If you
invoke them with the apostrophe ‘'’, the no-break control character, the
(initial) break they normally perform is suppressed. ‘'br’ does nothing.
3.2.1 Paragraphs
Paragraphs can be separated and indented in various ways. Some start with
a blank line and have a first-line indentation, like most of the ones in this
manual. Block paragraphs 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.
We also frequently encounter tagged paragraphs, which begin with a tag or
label at the left margin and indent the remaining text.
⇒ one This is the first paragraph. Notice how the
⇒ first line of the resulting paragraph lines
⇒ up with the other lines in the paragraph.
If the tag is too wide for the indentation, the line is broken.
⇒ longlabel
⇒ The label does not align with the subsequent
⇒ lines, but they align with each other.
A variation of the tagged paragraph is the itemized or enumerated para-
graph, which might use punctuation or a digit for a tag, respectively. These
are frequently used to construct lists.
⇒ o This list item starts with a bullet. When
⇒ producing output for a device using the ASCII
⇒ character set, an 'o' is formatted instead.
Often, use of the same macro without a tag continues such a discussion.
⇒ -xyz This option is recognized but ignored.
⇒
⇒ It had a security hole that we don't discuss.
3.2.8 Indexing
An index is similar to a table of contents, in that entry labels and locations
must be collected, but poses a greater challenge because it needs to be sorted
before it is output. Here, processing the document in multiple passes is
inescapable, and tools like the makeindex program are necessary.
3.2.10 Columnation
Macro packages apart from man and mdoc for man page formatting offer a
facility for setting multiple columns on the page.
4 Macro Packages
This chapter surveys the “major” macro packages that come with groff.
One, ms, is presented in detail.
Major macro packages are also sometimes described as full-service due to
the breadth of features they provide and because more than one cannot be
used by the same document; for example
groff -m man foo.man -m ms bar.doc
doesn’t work. 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
Many auxiliary, or “minor”, macro packages are also available. They
may in general be used with any full-service macro package and handle a
variety of tasks from character encoding selection, to language localization,
to inlining of raster images. See the groff tmac(5) man page for a list. Type
‘man groff_tmac’ at the command line to view it.
4.1 man
The man macro package is the most widely used and probably the most
important ever developed for troff. It is easy to use, and a vast majority
of manual pages (“man pages”) are written in it.
groff’s implementation is documented in the groff man(7) man page.
Type ‘man groff_man’ at the command line to view it.
.PT [Macro]
Control the content of the headers. Normally, the header prints the com-
mand name and section number on either side, and the optional fifth
argument to TH in the center.
.BT [Macro]
Control the content of the footers. Normally, the footer prints the page
number and the third and fourth arguments to TH.
Use the FT register to specify the footer position. The default is −0.5 i.
22 The GNU Troff Manual
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 a monospaced typeface (Courier roman), followed
by optional punctuation.
.Pn [punct] path [punct] [Macro]
If called with two arguments, identical to PN. If called with three ar-
guments, set the second argument in a monospaced typeface (Courier
roman), bracketed by the first and third arguments in the current font.
.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 space in front of headings.
.rn SH SH-orig
.de SH
. if t .sp (u;\\n[PD]*2)
. SH-orig \\$*
..
4.2 mdoc
groff’s implementation of the BSD doc package for man pages is docu-
mented in the groff mdoc(7) man page. Type ‘man groff_mdoc’ at the com-
mand line to view it.
24 The GNU Troff Manual
4.3 me
groff’s implementation of the BSD me macro package is documented us-
ing itself. A tutorial, meintro.me, and reference, meref.me, are available
in groff’s documentation directory. A groff me(7) man page is also avail-
able and identifies the installation path for these documents. Type ‘man
groff_me’ at the command line to view it.
A French translation of the tutorial is available as meintro_fr.me and
installed parallel to the English version.
4.4 mm
groff’s implementation of the AT&T memorandum macro package is docu-
mented in the groff mm(7) man page. Type ‘man groff_mm’ at the command
line) to view it.
A Swedish localization of mm is also available; see groff mmse(7).
4.5 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.
4.6 ms
The ms (“manuscript”) package is suitable for the preparation of letters,
memoranda, reports, and books. These groff macros feature cover page
and table of contents generation, automatically numbered headings, several
paragraph styles, a variety of text styling options, footnotes, and multi-
column page layouts. ms supports the tbl, eqn, pic, and refer prepro-
cessors for inclusion of tables, mathematical equations, diagrams, and stan-
dardized bibliographic citations. This implementation is mostly compatible
with the documented interface and behavior of AT&T Unix Version 7 ms.
Many extensions from 4.2BSD (Berkeley) and Tenth Edition Research Unix
have been recreated.
Chapter 4: Macro Packages 25
4.6.1 Introduction
The ms macros are the oldest surviving package for roff systems.1 While the
man package was designed for brief reference documents, the ms macros are
also suitable for longer works intended for printing and possible publication.
1
While manual pages are older, early ones used macros supplanted by the man pack-
age of Seventh Edition Unix (1979). ms shipped with Sixth Edition (1975) and was
documented by Mike Lesk in a Bell Labs internal memorandum.
26 The GNU Troff Manual
i inches
c centimeters
p points (1/72 inch)
P picas (1/6 inch)
v vees; current vertical spacing
m ems; width of an “M” in the current font
n ens; one-half em
Set registers with the nr request and strings with the ds request. Re-
quests are like macro calls; they go on lines by themselves and start with
the control character, a dot (.). The difference is that they directly instruct
the formatter program, rather than the macro package. We’ll discuss a few
as applicable. It is wise to specify a scaling unit when setting any register
that represents a length, size, or distance.
.nr PS 10.5p \" Use 10.5-point type.
.ds FAM P \" Use Palatino font family.
My exposure was \&.5 to \&.6 Sv of neutrons, said Dr.\&
Wallace after the criticality incident.
between the cover page and the body text. Today, page rese-
quencing is more often done in the digital domain. An index
works similarly, but because it typically needs to be sorted after
collection, its preparation requires separate processing.
Margin settings
\n[PO] [Register]
Defines the page offset (i.e., the left margin).
Effective: next page.
Default: Varies by output device and paper format; 1 i is used for type-
setters using U.S. letter paper, and zero for terminals. See Section 2.5
[Paper Format], page 13.
\n[LL] [Register]
Defines the line length (i.e., the width of the body text).
Effective: next paragraph.
Default: Varies by output device and paper format; 6.5 i is used for type-
setters using U.S. letter paper (see Section 2.5 [Paper Format], page 13)
and 65 n on terminals.
\n[LT] [Register]
Defines the title line length (i.e., the header and footer width). This is
usually the same as LL, but need not be.
Effective: next paragraph.
Default: Varies by output device and paper format; 6.5 i is used for type-
setters using U.S. letter paper (see Section 2.5 [Paper Format], page 13)
and 65 n on terminals.
\n[HM] [Register]
Defines the header margin height at the top of the page.
Effective: next page.
Default: 1 i.
Chapter 4: Macro Packages 29
\n[FM] [Register]
Defines the footer margin height at the bottom of the page.
Effective: next page.
Default: 1 i.
\*[CH] [String]
Defines the text displayed in the center header position.
Effective: next header.
Default: ‘-\n[%]-’.
\*[RH] [String]
Defines the text displayed in the right header position.
Effective: next header.
Default: empty.
\*[LF] [String]
Defines the text displayed in the left footer position.
Effective: next footer.
Default: empty.
\*[CF] [String]
Defines the text displayed in the center footer position.
Effective: next footer.
Default: empty.
\*[RF] [String]
Defines the text displayed in the right footer position.
Effective: next footer.
Default: empty.
Text settings
\n[PS] [Register]
Defines the type size of the body text.
Effective: next paragraph.
Default: 10 p.
30 The GNU Troff Manual
\n[VS] [Register]
Defines the vertical spacing (type size plus leading).
Effective: next paragraph.
Default: 12 p.
\n[HY] [Register]
Defines the automatic hyphenation mode used with the hy request. Set-
ting HY to 0 is equivalent to using the nh request. This is a Tenth Edition
Research Unix extension.
Effective: next paragraph.
Default: 6.
\*[FAM] [String]
Defines the font family used to typeset the document. This is a GNU
extension.
Effective: next paragraph.
Default: defined by the output device; often ‘T’ (see Section 4.6.5 [ms
Body Text], page 35)
Paragraph settings
\n[PI] [Register]
Defines the indentation amount used by the PP, IP (unless overridden by
an optional argument), XP, and RS macros.
Effective: next paragraph.
Default: 5 n.
\n[PD] [Register]
Defines the space between paragraphs.
Effective: next paragraph.
Default: 0.3 v (1 v on low-resolution devices).
\n[QI] [Register]
Defines the indentation amount used on both sides of a paragraph set
with the QP or between the QS and QE macros.
Effective: next paragraph.
Default: 5 n.
\n[PORPHANS] [Register]
Defines the minimum number of initial lines of any paragraph that must
be kept together to avoid isolated 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 a page break is forced before the start of the paragraph. This is a
GNU extension.
Effective: next paragraph.
Chapter 4: Macro Packages 31
Default: 1.
Heading settings
\n[PSINCR] [Register]
Defines an increment in type size to be applied to a heading at a lesser
depth than that specified in GROWPS. The value of PSINCR should be
specified in points with the p scaling unit and may include a fractional
component; for example, ‘.nr PSINCR 1.5p’ sets a type size increment of
1.5 p. This is a GNU extension.
Effective: next heading.
Default: 1 p.
\n[GROWPS] [Register]
Defines the heading depth above which the type size increment set by
PSINCR becomes effective. For each heading depth less than the value
of GROWPS, the type size is increased by PSINCR. Setting GROWPS to any
value less than 2 disables the incremental heading size feature. This is a
GNU extension.
Effective: next heading.
Default: 0.
\n[HORPHANS] [Register]
Defines the minimum number of lines of an immediately succeeding para-
graph that should be kept together with any heading introduced by the
NH or SH macros. If a 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. This is a GNU
extension.
Effective: next paragraph.
Default: 1.
\*[SN-STYLE] [String]
Defines the style used to print numbered headings. See Section 4.6.5.4
[Headings in ms], page 38. This is a GNU extension.
Effective: next heading.
Default: alias of SN-DOT
Footnote settings
\n[FI] [Register]
Defines the footnote indentation. This is a Berkeley extension.
Effective: next footnote.
Default: 2 n.
32 The GNU Troff Manual
\n[FF] [Register]
Defines the format of automatically numbered footnotes, and those for
which the FS request is given a marker argument, at the bottom of a
column or page. This is a Berkeley extension.
0 Set an automatic number2 as a superscript (on typesetter de-
vices) or surrounded by square brackets (on terminals). The
footnote paragraph is indented as with PP if there is an FS
argument or an automatic number, and as with LP otherwise.
This is the default.
1 As 0, but set the marker as regular text and follow an auto-
matic number with a period.
2 As 1, but without indentation (like LP).
3 As 1, but set the footnote paragraph with the marker hanging
(like IP).
Effective: next footnote.
Default: 0.
\n[FPS] [Register]
Defines the footnote type size.
Effective: next footnote.
Default: \n[PS] - 2p.
\n[FVS] [Register]
Defines the footnote vertical spacing.
Effective: next footnote.
Default: \n[FPS] + 2p.
\n[FPD] [Register]
Defines the footnote paragraph spacing. This is a GNU extension.
Effective: next footnote.
Default: \n[PD] / 2.
\*[FR] [String]
Defines the ratio of the footnote line length to the current line length.
This is a GNU extension.
Effective: next footnote in single-column arrangements, next page other-
wise.
Default: 11/12.
2
defined in Section 4.6.5.10 [ms Footnotes], page 49
Chapter 4: Macro Packages 33
Display settings
\n[DD] [Register]
Sets the display distance—the vertical spacing before and after a display,
a tbl table, an eqn equation, or a pic image. This is a Berkeley extension.
Effective: next display boundary.
Default: 0.5 v (1 v on low-resolution devices).
\n[DI] [Register]
Sets the default amount by which to indent a display started with DS and
ID without arguments, to ‘.DS I’ without an indentation argument, and
to equations set with ‘.EQ I’. This is a GNU extension.
Effective: next indented display.
Default: 0.5 i.
Other settings
\n[MINGW] [Register]
Defines the default minimum width between columns in a multi-column
document. This is a GNU extension.
Effective: next page.
Default: 2 n.
\n[TC-MARGIN] [Register]
Defines the width of the field in which page numbers are set in a table
of contents entry; the right margin thus moves inboard by this amount.
This is a GNU extension.
Effective: next PX call.
Default: \w'000'
.TL [Macro]
Specify the document title. ms collects text on input lines following this
call into the title until reaching AU, AB, or a heading or paragraphing
macro call.
.AU [Macro]
Specify an author’s name. ms collects text on input lines following this call
into the author’s name until reaching AI, AB, another AU, or a heading or
paragraphing macro call. Call it repeatedly to specify multiple authors.
.AI [Macro]
Specify the preceding author’s institution. An AU call is usefully followed
by at most one AI call; if there are more, the last AI call controls. ms
collects text on input lines following this call into the author’s institution
until reaching AU, AB, or a heading or paragraphing macro call.
.DA [x . . . ] [Macro]
Typeset the current date, or any arguments x, in the center footer, and,
if RP is also called, left-aligned at the end of the description information
on the cover page.
.ND [x . . . ] [Macro]
Typeset the current date, or any arguments x, if RP is also called, left-
aligned at the end of the document description on the cover page. This
is groff ms’s default.
.AE [Macro]
End the abstract.
.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 more in line with user demand.
.AE
output driver documents its font repertoire. Consult the groff(1) man page
for lists of available output devices and their drivers.
The hyphenation mode (as used by the hy request) is set from the HY
register. Setting HY to ‘0’ is equivalent to using the nh request. This is a
Tenth Edition Research Unix extension.
\*[-] [String]
Interpolate an em dash.
\*[Q] [String]
\*[U] [String]
Interpolate typographer’s quotation marks where available, and neutral
double quotes otherwise. \*Q is the left quote and \*U the right.
4.6.5.3 Paragraphs
Paragraphing macros break, or terminate, any pending output line so that
a new paragraph can begin. Several paragraph types are available, differing
in how indentation applies to them: to left, right, or both margins; to the
first output line of the paragraph, all output lines, or all but the first. All
paragraphing macro calls cause the insertion of vertical space in the amount
stored in the PD register, except at page or column breaks. Alternatively, a
blank input line breaks the output line and vertically spaces by one vee.
.LP [Macro]
Set a paragraph without any (additional) indentation.
.PP [Macro]
Set a paragraph with a first-line left indentation in the amount stored in
the PI register.
.QP [Macro]
Set a paragraph indented from both left and right margins by the amount
stored in the QI register.
Chapter 4: Macro Packages 37
.QS [Macro]
.QE [Macro]
Begin (QS) and end (QE) a region where each paragraph is indented from
both margins by the amount stored in the QI register. The text between
QS and QE can be structured further by use of other paragraphing macros.
.XP [Macro]
Set an “exdented” paragraph—one with a left indentation in the amount
stored in the PI register on every line except the first (also known as a
hanging indent). This is a Berkeley extension.
4.6.5.4 Headings
Use headings to create a sequential or hierarchical structure for your doc-
ument. The ms macros print headings in bold using the same font family
and, by default, type size as the body text. Headings are available with and
without automatic numbering. Text on input lines following the macro call
becomes the heading’s title. Call a paragraphing macro to end the heading
text and start the section’s content.
The above results in numbering as follows; the vertical space that nor-
mally precedes each heading is omitted.
Chapter 4: Macro Packages 39
1. Animalia
1.1. Arthropoda
1.1.1. Crustacea
1.2. Chordata
6.6.6. Daimonia
7. Plantae
\*[SN-STYLE] [String]
\*[SN-DOT] [String]
\*[SN-NO-DOT] [String]
\*[SN] [String]
After NH is called, the assigned number is made available in the strings
SN-DOT (as it appears in a printed heading with default formatting, fol-
lowed by a terminating period) and SN-NO-DOT (with the terminating
period omitted). These are GNU extensions.
You can control the style used to print numbered headings by defining an
appropriate alias for the string SN-STYLE. By default, SN-STYLE is aliased
to SN-DOT. If you prefer to omit the terminating period from numbers
appearing in numbered headings, you may define the alias as follows.
.als SN-STYLE SN-NO-DOT
Any such change in numbering style becomes effective from the next use
of NH following redefinition of the alias for SN-STYLE. The formatted
number of the current heading is available in the SN string (a feature first
documented by Berkeley), which facilitates its inclusion in, for example,
table captions, equation labels, and XS/XA/XE table of contents entries.
If the GROWPS register is set to a value greater than the level argument
to NH or SH, the type size of a heading produced by these macros increases
by PSINCR units over the size specified by PS multiplied by the difference of
GROWPS and level. The value stored in PSINCR is interpreted in groff basic
units; the p scaling unit should be employed when assigning a value specified
in points. For example, the sequence
40 The GNU Troff Manual
.nr PS 10
.nr GROWPS 3
.nr PSINCR 1.5p
.NH 1
Carnivora
.NH 2
Felinae
.NH 3
Felis catus
.SH 2
Machairodontinae
4
This idiosyncrasy arose through feature accretion; for example, the B macro in Version 6
Unix ms (1975) accepted only one argument, the text to be set in boldface. By Version 7
(1979) it recognized a second argument; in 1990, groff ms added a “pre” argument,
placing it third to avoid breaking support for older documents.
Chapter 4: Macro Packages 41
The CS course’s students found one C language keyword (static)
most troublesome.
You can use the output line continuation escape sequence \c to achieve
the same result (see Section 5.16 [Line Continuation], page 125). It is also
portable to older ms implementations.
The CS course's students found one C language keyword
\%(\c
.CW \%static )
most troublesome.
groff ms also offers strings to begin and end super- and subscripting.
These are GNU extensions.
\*[{] [String]
\*[}] [String]
Begin and end superscripting, respectively.
\*[<] [String]
\*[>] [String]
Begin and end subscripting, respectively.
Rather than calling the CW macro, in groff ms you might prefer to change
the font family to Courier by setting the FAM string to ‘C’. You can then
use all four style macros above, returning to the default family (Times) with
‘.ds FAM T’. Because changes to FAM take effect only at the next paragraph,
CW remains useful to “inline” a change to the font family, similarly to the
practice of this document in noting syntactical elements of ms and groff.
4.6.5.6 Lists
The marker argument to the IP macro can be employed to present a variety
of lists; for instance, you can use a bullet glyph (\[bu]) for unordered lists,
a number (or auto-incrementing register) for numbered lists, or a word or
phrase for glossary-style or definition lists. If you set the paragraph inden-
tation register PI before calling IP, you can later reorder the items in the
list without having to ensure that a width argument remains affixed to the
first call.
The following is an example of a bulleted list.
Chapter 4: Macro Packages 43
.nr PI 2n
A bulleted list:
.IP \[bu]
lawyers
.IP \[bu]
guns
.IP \[bu]
money
A bulleted list:
• lawyers
• guns
• money
The following is an example of a numbered list.
.nr step 0 1
.nr PI 3n
A numbered list:
.IP \n+[step]
lawyers
.IP \n+[step]
guns
.IP \n+[step]
money
A numbered list:
1. lawyers
2. guns
3. money
Here we have employed the nr request to create a register of our own,
‘step’. We initialized it to zero and assigned it an auto-increment of 1.
Each time we use the escape sequence ‘\n+[PI]’ (note the plus sign), the
formatter applies the increment just before interpolating the register’s value.
Preparing the PI register as well enables us to rearrange the list without the
tedium of updating macro calls.
The next example illustrates a glossary-style list.
44 The GNU Troff Manual
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!
A glossary-style list:
lawyers
Two or more attorneys.
money
Gotta pay for those lawyers and guns!
In the previous example, observe how the IP macro places the definition
on the same line as the term if it has enough space. If this is not what
you want, there are a few workarounds we will illustrate by modifying the
example. First, you can use a br request to force a break after printing the
term or label.
.IP guns
.br
Firearms,
Second, you could apply the \p escape sequence to force a break. The
space following the escape sequence is important; if you omit it, groff prints
the first word of the paragraph text on the same line as the term or label (if
it fits) then breaks the line.
.IP guns
\p Firearms,
Finally, you may append a horizontal motion to the marker with the \h
escape sequence; using the same amount as the indentation will ensure that
the marker is too wide for groff to treat it as “fitting” on the same line as
the paragraph text.
Chapter 4: Macro Packages 45
.IP guns\h'0.4i'
Firearms,
lawyers
Two or more attorneys.
guns
Firearms, preferably large-caliber.
money
Gotta pay for those lawyers and guns!
• Lawyers:
• Dewey,
• Cheatham, and
• Howe.
• Guns
If you want a boxed keep to float, you will need to enclose the B1 and B2
calls within a pair of KF and KE calls.
Displays turn off filling; lines of verse or program code are shown with
their lines broken as in the source document without requiring br requests
between lines. Displays can be kept on a single page or allowed to break
across pages. The DS macro begins a kept display of the layout specified
in its first argument; non-kept displays are begun with dedicated macros
corresponding to their layout.
.DS L [Macro]
.LD [Macro]
Begin (DS: kept) left-aligned display.
.DS [I [indent]] [Macro]
.ID [indent] [Macro]
Begin (DS: kept) display indented by indent if specified, and by the
amount of the DI register otherwise.
.DS B [Macro]
.BD [Macro]
Begin a (DS: kept) a block display: the entire display is left-aligned, but
indented such that the longest line in the display is centered on the page.
.DS C [Macro]
.CD [Macro]
Begin a (DS: kept) centered display: each line in the display is centered.
.DS R [Macro]
.RD [Macro]
Begin a (DS: kept) right-aligned display. This is a GNU extension.
.DE [Macro]
End any display.
The distance stored in the DD register is inserted before and after each
pair of display macros; this is a Berkeley extension. In groff ms, this dis-
tance replaces any adjacent inter-paragraph distance or subsequent spacing
48 The GNU Troff Manual
.TS H
allbox;
Cb | Cb .
Part→Description
_
.TH
.T&
GH-1978→Fribulating gonkulator
. . . the rest of the table follows. . .
.TE
4.6.5.10 Footnotes
A footnote is typically anchored to a place in the text with a marker, which
is a small integer, a symbol such as a dagger, or arbitrary user-specified text.
\*[*] [String]
Place an automatic number, an automatically generated numeric footnote
marker, in the text. Each time this string is interpolated, the number it
produces increments by one. Automatic numbers start at 1. This is a
Berkeley extension.
Enclose the footnote text in FS and FE macro calls to set it at the nearest
available “foot”, or bottom, of a text column or page.
5
“Portable Document Format Publishing with GNU Troff”, pdfmark.ms in the groff
distribution, uses this technique.
6
Unix Version 7 ms, its descendants, and GNU ms prior to groff version 1.23.0
7
You could reset it after each call to .1C, .2C, or .MC.
Chapter 4: Macro Packages 51
\*[REFERENCES] [String]
Contains the string printed at the beginning of a references (bibliography)
page produced with GNU refer(1). The default is ‘References’.
\*[ABSTRACT] [String]
Contains the string printed at the beginning of the abstract. The default
is ‘\f[I]ABSTRACT\f[]’; it includes font selection escape sequences to set
the word in italics.
\*[TOC] [String]
Contains the string printed at the beginning of the table of contents. The
default is ‘Table of Contents’.
\*[MONTH1] [String]
\*[MONTH2] [String]
\*[MONTH3] [String]
\*[MONTH4] [String]
\*[MONTH5] [String]
\*[MONTH6] [String]
\*[MONTH7] [String]
\*[MONTH8] [String]
\*[MONTH9] [String]
\*[MONTH10] [String]
\*[MONTH11] [String]
\*[MONTH12] [String]
Contain the full names of the calendar months. The defaults are in En-
glish: ‘January’, ‘February’, and so on.
.P1 [Macro]
Typeset the header even on page 1. To be effective, this macro must
be called before the header trap is sprung on any page numbered “1”;
in practice, unless your page numbering is unusual, this means that you
should call it early, before TL or any heading or paragraphing macro. This
is a Berkeley extension.
.TA [Macro]
Reset the tab stops to the ms default (every 5 ens). Redefine this macro
to create a different set of default tab stops.
4.6.6.3 Margins
Control margins using the registers summarized in “Margin settings” in Sec-
tion 4.6.3 [ms Document Control Settings], page 28, above. There is no
setting for the right margin; the combination of page offset \n[PO] and line
length \n[LL] determines it.
to fit or because style dictates that page numbers not be repeated. You may
wish to indent the text thus wrapped to correspond to its heading depth; this
can be done in the entry text by prefixing it with tabs or horizontal motion
escape sequences, or by providing a second argument to the XA macro. XS
and XA automatically associate the page number where they are called with
the text following them, but they accept arguments to override this behavior.
At the end of the document, call TC or PX to emit the table of contents; TC
resets the page number to ‘i’ (Roman numeral one), and then calls PX. All
of these macros are Berkeley extensions.
.XS [page-number] [Macro]
.XA [page-number [indentation]] [Macro]
.XE [Macro]
Begin, supplement, and end a table of contents entry. Each entry is as-
sociated with page-number (otherwise the current page number); a page-
number of ‘no’ prevents a leader and page number from being emitted
for that entry. Use of XA within XS/XE is optional; it can be repeated. If
indentation is present, a supplemental entry is indented by that amount;
ens are assumed if no unit is indicated. Text on input lines between XS
and XE is stored for later recall by PX.
.PX [no] [Macro]
Switch to single-column layout. Unless no is specified, center and inter-
polate the TOC string in bold and two points larger than the body text.
Emit the table of contents entries.
.TC [no] [Macro]
Set the page number to 1, the page number format to lowercase Roman
numerals, and call PX (with a no argument, if present).
Here’s an example of typical ms table of contents preparation. We employ
horizontal escape sequences \h to indent the entries by sectioning depth.
Chapter 4: Macro Packages 55
.NH 1
Introduction
.XS
Introduction
.XE
...
.NH 2
Methodology
.XS
\h'2n'Methodology
.XA
\h'4n'Fassbinder's Approach
\h'4n'Kahiu's Approach
.XE
...
.NH 1
Findings
.XS
Findings
.XE
...
.TC
.XN-INIT [Macro]
.XH-UPDATE-TOC depth heading-text [Macro]
The XN-INIT hook macro does nothing by default. XH-UPDATE-TOC brack-
ets heading-text with XS and XE calls, indenting it by 2 ens per level of
depth beyond the first.
56 The GNU Troff Manual
To get the section number of the numbered headings into the table of
contents entries, we might define XN-REPLACEMENT as follows. (We obtain
the heading depth from groff ms’s internal register nh*hl.)
.de XN-REPLACEMENT
.XN-INIT
.XH-UPDATE-TOC \\n[nh*hl] \\$@
\&\\*[SN] \\$*
..
You can change the style of the leader that bridges each table of contents
entry with its page number; define the TC-LEADER special character by using
the char request. A typical leader combines the dot glyph ‘.’ with a hor-
izontal motion escape sequence to spread the dots. The width of the page
number field is stored in the TC-MARGIN register.
9
Register values are converted to and stored as basic units. See Section 5.3 [Measure-
ments], page 75.
58 The GNU Troff Manual
• groff ms supports the PN register, but it is not necessary; you can access
the page number via the usual % register and invoke the af request to
assign a different format to it if desired.10
• The AT&T ms manual documents registers CW and GW as setting the
default column width and “intercolumn gap”, respectively, and which
applied when MC was called with fewer than two arguments. groff
ms instead treats MC without arguments as synonymous with 2C; there
is thus no occasion for a default column width register. Further, the
MINGW register and the second argument to MC specify a minimum space
between columns, not the fixed gutter width of AT&T ms.
• The AT&T ms manual did not document the QI register; Berkeley and
groff ms do.
\n[GS] [Register]
The register GS is set to 1 by the groff ms macros, but is not used by the
AT&T ms package. Documents that need to determine whether they are
being formatted with groff ms or another implementation should test
this register.
10
If you redefine the ms PT macro and desire special treatment of certain page numbers
(like ‘1’), you may need to handle a non-Arabic page number format, as groff ms’s PT
does; see the macro package source. groff ms aliases the PN register to %.
11
The removal beforehand is necessary because groff ms aliases these macros to a diag-
nostic macro, and you want to redefine the aliased name, not its target.
Chapter 4: Macro Packages 59
\*[~] [String]
Apply tilde accent to preceding glyph.
\*[,] [String]
Apply cedilla to preceding glyph.
\*[/] [String]
Apply stroke (slash) to preceding glyph.
\*[v] [String]
Apply caron to preceding glyph.
\*[_] [String]
Apply macron to preceding glyph.
\*[.] [String]
Apply underdot to preceding glyph.
\*[o] [String]
Apply ring accent to preceding glyph.
\*[?] [String]
Interpolate inverted question mark.
\*[!] [String]
Interpolate inverted exclamation mark.
\*[8] [String]
Interpolate small letter sharp s.
\*[q] [String]
Interpolate small letter o with hook accent (ogonek).
\*[3] [String]
Interpolate small letter yogh.
\*[d-] [String]
Interpolate small letter eth.
\*[D-] [String]
Interpolate capital letter eth.
\*[th] [String]
Interpolate small letter thorn.
\*[Th] [String]
Interpolate capital letter thorn.
\*[ae] [String]
Interpolate small æ ligature.
Chapter 4: Macro Packages 61
\*[Ae] [String]
Interpolate capital Æ ligature.
\*[oe] [String]
Interpolate small oe ligature.
\*[OE] [String]
Interpolate capital OE ligature.
This chapter covers all of the facilities of the GNU troff formatting engine.
Users of macro packages may skip it if not interested in details.
5.1 Text
AT&T troff was designed to take input as it would be composed on a type-
writer, including the teletypewriters used as early computer terminals, and
relieve the user drafting a document of concern with details like line length,
hyphenation breaking, and the achievement of straight margins. Early in
its development, the program gained the ability to prepare output for a
phototypesetter; a document could then be prepared for output to either
a teletypewriter, a phototypesetter, or both. GNU troff continues this
tradition of permitting an author to compose a single master version of a
document which can then be rendered for a variety of output formats or
devices.
roff input files contain text interspersed with instructions to control
the formatter. Even in the absence of such instructions, GNU troff still
processes its input in several ways, by filling, hyphenating, breaking, and
adjusting it, and supplementing it with inter-sentence space.
5.1.1 Filling
When GNU troff starts up, it obtains information about the device for
which it is preparing output.1 An essential property is the length of the
output line, such as “6.5 inches”.
GNU troff interprets plain text files employing the Unix line-ending
convention. It reads input a character at a time, collecting words as it goes,
and fits as many words together on an output line as it can—this is known
as filling. To GNU troff, a word is any sequence of one or more characters
that aren’t spaces or newlines. The exceptions separate words.2 To disable
filling, see Section 5.9 [Manipulating Filling and Adjustment], page 99.
It is a truth universally acknowledged
that a single man in possession of a
good fortune must be in want of a wife.
⇒ It is a truth universally acknowledged that a
⇒ single man in possession of a good fortune must
⇒ be in want of a wife.
1
See Section 6.2 [Device and Font Description Files], page 242.
2
Tabs and leaders also separate words. Escape sequences can function as word charac-
ters, word separators, or neither—the last simply have no effect on GNU troff’s idea
of whether an input character is within a word. We’ll discuss all of these in due course.
64 The GNU Troff Manual
5.1.2 Sentences
A passionate debate has raged for decades among writers of the English lan-
guage over whether more space should appear between adjacent sentences
than between words within a sentence, and if so, how much, and what other
circumstances should influence this spacing.3 GNU troff follows the exam-
ple of AT&T troff; it attempts to detect the boundaries between sentences,
and supplies additional inter-sentence space between them.
Hello, world!
Welcome to groff.
⇒ Hello, world! Welcome to groff.
GNU troff flags certain characters (normally ‘!’, ‘?’, and ‘.’) as poten-
tially ending a sentence. When GNU troff encounters one of these end-of-
sentence characters at the end of an input line, or one of them is followed
by two (unescaped) spaces on the same input line, it appends an inter-word
space followed by an inter-sentence space in the output.
R. Harper subscribes to a maxim of P. T. Barnum.
⇒ R. Harper subscribes to a maxim of P. T. Barnum.
In the above example, inter-sentence space is not added after ‘P.’ or ‘T.’
because the periods do not occur at the end of an input line, nor are they
followed by two or more spaces. Let’s imagine that we’ve heard something
about defamation from Mr. Harper’s attorney, recast the sentence, and re-
flowed it in our text editor.
I submit that R. Harper subscribes to a maxim of P. T.
Barnum.
⇒ I submit that R. Harper subscribes to a maxim of
⇒ P. T. Barnum.
“Barnum” doesn’t begin a sentence! What to do? Let us meet our first
escape sequence, a series of input characters that give instructions to GNU
troff instead of being used to construct output device glyphs.4 An escape
sequence begins with the backslash character \ by default, an uncommon
character in natural language text, and is always followed by at least one
other character, hence the term “sequence”.
The dummy character escape sequence \& can be used after an end-
of-sentence character to defeat end-of-sentence detection on a per-instance
basis. We can therefore rewrite our input more defensively.
3
A well-researched jeremiad appreciated by groff contributors on both sides of the
sentence-spacing debate can be found at https://web.archive.org/web/
20171217060354/http://www.heracliteanriver.com/?p=324.
4
This statement oversimplifies; there are escape sequences whose purpose is precisely to
produce glyphs on the output device, and input characters that aren’t part of escape
sequences can undergo a great deal of processing before getting to the output.
Chapter 5: GNU troff Reference 65
5.1.3 Hyphenation
When an output line is nearly full, it is uncommon for the next word collected
from the input to exactly fill it—typically, there is room left over only for part
of the next word. The process of splitting a word so that it appears partially
on one line (with a hyphen to indicate to the reader that the word has been
broken) with its remainder on the next is hyphenation. Hyphenation points
can be manually specified; GNU troff also uses a hyphenation algorithm
and language-specific pattern files (based on those used in TEX) to decide
which words can be hyphenated and where.
5
The mnemonics for the special characters shown here are “dagger”, “double dagger”,
“right (double) quote”, and “closing (single) quote”. See the groff char(7) man page.
66 The GNU Troff Manual
Hyphenation does not always occur even when the hyphenation rules for
a word allow it; it can be disabled, and when not disabled there are several
parameters that can prevent it in certain circumstances. See Section 5.10
[Manipulating Hyphenation], page 105.
5.1.4 Breaking
Once an output line is full, the next word (or remainder of a hyphenated
one) is placed on a different output line; this is called a break. In this manual
and in roff discussions generally, a “break” if not further qualified always
refers to the termination of an output line. When the formatter is filling
text, it introduces breaks automatically to keep output lines from exceeding
the configured line length. After an automatic break, GNU troff adjusts
the line if applicable (see below), and then resumes collecting and filling text
on the next output line.
Sometimes, a line cannot be broken automatically. This usually does
not happen with natural language text unless the output line length has
been manipulated to be extremely short, but it can with specialized text
like program source code. We can use perl at the shell prompt to contrive
an example of failure to break the line. We also employ the -z option to
suppress normal output.
$ perl -e 'print "#" x 80, "\n";' | nroff -z
error warning: cannot break line
The remedy for these cases is to tell GNU troff where the line may
be broken without hyphens. This is done with the non-printing break point
escape sequence ‘\:’; see Section 5.10 [Manipulating Hyphenation], page 105.
What if the document author wants to stop filling lines temporarily, for
instance to start a new paragraph? There are several solutions. A blank
input line not only causes a break, but by default it also outputs a one-
line vertical space (effectively a blank output line). This behavior can be
modified; see Section 5.28.3 [Blank Line Traps], page 193. Macro packages
may discourage or disable the blank line method of paragraphing in favor of
their own macros.
A line that begins with one or more spaces causes a break. The spaces are
output at the beginning of the next line without being adjusted (see below);
however, this behavior can be modified (see Section 5.28.4 [Leading Space
Traps], page 193). Again, macro packages may provide other methods of
producing indented paragraphs. Trailing spaces on text lines are discarded.6
What if the file ends before enough words have been collected to fill an
output line? Or the output line is exactly full but not yet broken, and
there is no more input? GNU troff interprets the end of input as a break.
Certain requests also cause breaks, implicitly or explicitly. This is discussed
in Section 5.9 [Manipulating Filling and Adjustment], page 99.
6
“Text lines” are defined in Section 5.1.7 [Requests and Macros], page 67.
Chapter 5: GNU troff Reference 67
5.1.5 Adjustment
After GNU troff performs an automatic break, it may then adjust the
line, widening inter-word spaces until the text reaches the right margin.
Extra spaces between words are preserved. Leading and trailing spaces are
handled as noted above. Text can be aligned to the left or right margin only,
or centered; see Section 5.9 [Manipulating Filling and Adjustment], page 99.
Requests often take arguments, words (separated from the request name
and each other by spaces) that specify details of the action GNU troff is
expected to perform. If a request is meaningless without arguments, it is
typically ignored.
GNU troff’s requests and escape sequences comprise the control lan-
guage of the formatter. Of key importance are the requests that define
macros. Macros are invoked like requests, enabling the request repertoire to
be extended or overridden.9
A macro can be thought of as an abbreviation you can define for a col-
lection of control and text lines. When the macro is called by giving its
name after a control character, it is replaced with what it stands for. The
process of textual replacement is known as interpolation.10 Interpolations
are handled as soon as they are recognized, and once performed, a roff for-
matter scans the replacement for further requests, macro calls, and escape
sequences.
In roff systems, the de request defines a macro.11
.de DATE
2020-11-14
..
The foregoing input produces no output by itself; all we have done is store
some information. Observe the pair of dots that ends the macro definition.
This is a default; you can specify your own terminator for the macro defini-
tion as the second argument to the de request.
.de NAME ENDNAME
Heywood Jabuzzoff
.ENDNAME
In fact, the ending marker is itself the name of a macro to be called, or
a request to be invoked, if it is defined at the time its control line is read.
.de END
Big Rip
..
.de START END
Big Bang
.END
.START
⇒ Big Rip Big Bang
In the foregoing example, “Big Rip” printed before “Big Bang” because its
macro was called first. Consider what would happen if we dropped END from
the ‘.de START’ line and added .. after .END. Would the order change?
9
Argument handling in macros is more flexible but also more complex. See Section 5.6.3
[Calling Macros], page 86.
10
Some escape sequences undergo interpolation as well.
11
GNU troff offers additional ones. See Section 5.24 [Writing Macros], page 167.
Chapter 5: GNU troff Reference 69
.NOTICE
.NOTICE
⇒ Insert tedious regulatory compliance paragraph here.
⇒
⇒ Approved: 2020-10-05 by D. Kruger, J. Peterman
⇒
⇒ Insert tedious liability disclaimer paragraph here.
⇒
⇒ Approved: 2020-10-05 by D. Kruger, J. Peterman
The above document started with a series of control lines. Three macros were
defined, with a de request declaring each macro’s name, and the “body” of
the macro starting on the next line and continuing until a line with two
dots ‘..’ marked its end. The text proper began only after the macros
were defined; this is a common pattern. Only the NOTICE macro was called
“directly” by the document; DATE and BOSS were called only by NOTICE itself.
Escape sequences were used in BOSS, two levels of macro interpolation deep.
The advantage in typing and maintenance economy may not be obvious
from such a short example, but imagine a much longer document with dozens
of such paragraphs, each requiring a notice of managerial approval. Consider
what must happen if you are in charge of generating a new version of such
a document with a different date, for a different boss. With well-chosen
macros, you only have to change each datum in one place.
70 The GNU Troff Manual
cp1047 The code page 1047 input encoding works only on EBCDIC plat-
forms (and conversely, the other input encodings don’t work with
EBCDIC); the file cp1047.tmac is loaded at startup.
12
Macro files and packages frequently define registers and strings as well.
Chapter 5: GNU troff Reference 71
valid ISO Latin-1 document; the standards are interchangeable in their first
128 code points.13
Other encodings are supported by means of macro packages.
latin2 To use ISO Latin-2, an encoding for Central and Eastern Euro-
pean languages, invoke ‘.mso latin2.tmac’ at the beginning of
your document or supply ‘-mlatin2’ as a command-line argu-
ment to groff.
latin5 To use ISO Latin-5, an encoding for the Turkish language, in-
voke ‘.mso latin5.tmac’ at the beginning of your document or
supply ‘-mlatin5’ as a command-line argument to groff.
latin9 ISO Latin-9 succeeds Latin-1; it includes a Euro sign and bet-
ter glyph coverage for French. To use this encoding, invoke
‘.mso latin9.tmac’ at the beginning of your document or sup-
ply ‘-mlatin9’ as a command-line argument to groff.
Some characters from an input encoding may not be available with a
particular output driver, or their glyphs may not have representation in
the font used. For terminal devices, fallbacks are defined, like ‘EUR’ for the
Euro sign and ‘(C)’ for the copyright sign. For typesetter devices, you may
need to “mount” fonts that support glyphs required by the document. See
Section 5.19.3 [Font Positions], page 134.
Because a Euro glyph was not historically defined in PostScript fonts,
groff comes with a font called freeeuro.pfa that provides the Euro in
several styles. Standard PostScript fonts contain the glyphs from Latin-5
and Latin-9 that Latin-1 lacks, so these encodings are supported for the ps
and pdf output devices as groff ships, while Latin-2 is not.
Unicode supports characters from all other input encodings; the utf8
output driver for terminals therefore does as well. The DVI output driver
supports the Latin-2 and Latin-9 encodings if the command-line option -mec
is used as well.14
• Follow sentence endings in the input with newlines to ease their recogni-
tion (see Section 5.1.2 [Sentences], page 64). It is frequently convenient
to end text lines after colons and semicolons as well, as these typically
precede independent clauses. Consider doing so after commas; they
often occur in lists that become easy to scan when itemized by line,
or constitute supplements to the sentence that are added, deleted, or
updated to clarify it. Parenthetical and quoted phrases are also good
candidates for placement on text lines by themselves.
• Set your text editor’s line length to 72 characters or fewer.15 This
limit, combined with the previous item of advice, makes it less common
that an input line will wrap in your text editor, and thus will help
you perceive excessively long constructions in your text. Recall that
natural languages originate in speech, not writing, and that punctuation
is correlated with pauses for breathing and changes in prosody.
• Use \& after ‘!’, ‘?’, and ‘.’ if they are followed by space, tab, or newline
characters and don’t end a sentence.
• In filled text lines, use \& before ‘.’ and ‘'’ if they are preceded by
space, so that reflowing the input doesn’t turn them into control lines.
• Do not use spaces to perform indentation or align columns of a table.
Leading spaces are reliable when text is not being filled.
• Comment your document. It is never too soon to apply comments
to record information of use to future document maintainers (including
your future self). We thus introduce another escape sequence, \", which
causes GNU troff to ignore the remainder of the input line.
• Use the empty request—a control character followed immediately by a
newline—to visually manage separation of material in input files. Many
of the groff project’s own documents use an empty request between
sentences, after macro definitions, and where a break is expected, and
two empty requests between paragraphs or other requests or macro calls
that will introduce vertical space into the document.
You can combine the empty request with the comment escape sequence
to include whole-line comments in your document, and even “comment
out” sections of it.
15
Emacs: fill-column: 72; Vim: textwidth=72
Chapter 5: GNU troff Reference 73
.\" nroff this_file.roff | less
.\" groff -T ps this_file.roff > this_file.ps
→The theory of relativity is intimately connected with
the theory of space and time.
.
I shall therefore begin with a brief investigation of
the origin of our ideas of space and time,
although in doing so I know that I introduce a
controversial subject. \" remainder of paragraph elided
.
.
16
groff does not yet support right-to-left scripts.
17
groff’s terminal output devices have page offsets of zero.
Chapter 5: GNU troff Reference 75
instruct the output driver to eject the page, start a new one, and again set
the drawing position to one vee below the page top; this is a page break.
When the last line of input text corresponds to the last output line that
fits on the page, the break caused by the end of input will also break the page,
producing a useless blank one. Macro packages keep users from having to
confront this difficulty by setting “traps” (see Section 5.28 [Traps], page 186);
moreover, all but the simplest page layouts tend to have headers and footers,
or at least bear vertical margins larger than one vee.
5.3 Measurements
The formatter sometimes requires the input of numeric parameters to specify
measurements. These are specified as integers or decimal fractions with an
optional scaling unit suffixed. A scaling unit is a letter that immediately
follows the last digit of a number. Digits after the decimal point are optional.
Measurement expressions include ‘10.5p’, ‘11i’, and ‘3.c’.
Measurements are scaled by the scaling unit and stored internally (with
any fractional part discarded) in basic units. The device resolution can
therefore be obtained by storing a value of ‘1i’ to a register. The only
constraint on the basic unit is that it is at least as small as any other unit.
u Basic unit.
i Inch; defined as 2.54 centimeters.
c Centimeter; a centimeter is about 0.3937 inches.
p Point; a typesetter’s unit used for measuring type size. There
are 72 points to an inch.
P Pica; another typesetter’s unit. There are 6 picas to an inch and
12 points to a pica.
s
z See Section 5.20.3 [Using Fractional Type Sizes], page 152, for a
discussion of these units.
f GNU troff defines this unit to scale decimal fractions in the
interval [0, 1] to 16-bit unsigned integers. It multiplies a quantity
by 65,536. See Section 5.21 [Colors], page 154, for usage.
The magnitudes of other scaling units depend on the text formatting
parameters in effect. These are useful when specifying measurements that
need to scale with the typeface or vertical spacing.
m Em; an em is equal to the current type size in points. It is named
thus because it is approximately the width of the letter ‘M’.
n En; an en is one-half em.
v Vee; recall Section 5.2 [Page Geometry], page 74.
M Hundredth of an em.
76 The GNU Troff Manual
18
Provision is made for interpreting and reporting decimal fractions in certain cases.
19
If that’s not enough, see the groff tmac(5) man page for the 62bit.tmac macro package.
78 The GNU Troff Manual
20
See Section 5.23 [Conditionals and Loops], page 160.
Chapter 5: GNU troff Reference 79
.nr X 3+5*4
.nr Y (3+5)*4
.nr Z 3+(5*4)
X=\n[X] Y=\n[Y] Z=\n[Z]
⇒ X=32 Y=32 Z=23
For many requests and escape sequences that cause motion on the page,
the unary operators + and - work differently when leading a numeric expres-
sion. They then indicate a motion relative to the drawing position: positive
is down in vertical contexts, right in horizontal ones.
+ and - are also treated differently by the following requests and escape
sequences: bp, in, ll, lt, nm, nr, pl, pn, po, ps, pvs, rt, ti, \H, \R,
and \s. Here, leading plus and minus signs serve as incrementation and
decrementation operators, respectively. To negate an expression, subtract it
from zero or include the unary minus in parentheses with its argument. See
Section 5.8.1 [Setting Registers], page 92, for examples.
A leading | operator indicates a motion relative not to the drawing posi-
tion but to a boundary. For horizontal motions, the measurement specifies
a distance relative to a drawing position corresponding to the beginning of
the input line. By default, tab stops reckon movements in this way. Most
escape sequences do not; | tells them to do so.
Mind the \h'1.2i'gap.
.br
Mind the \h'|1.2i'gap.
.br
Mind the
\h'|1.2i'gap.
⇒ Mind the gap.
⇒ Mind the gap.
⇒ Mind the gap.
One use of this feature is to define macros whose scope is limited to the
output they format.
.\" underline word $1 with trailing punctuation $2
.de Underline
. nop \\$1\l'|0\[ul]'\\$2
..
Typographical emphasis is best used
.Underline sparingly .
In the above example, ‘|0’ specifies a negative motion from the current
position (at the end of the argument just emitted, \$1) to the beginning
of the input line. Thus, the \l escape sequence in this case draws a line
from right to left. A macro call occurs at the beginning of an input line;21
21
Control structure syntax creates an exception to this rule, but is designed to remain
useful: recalling our example, ‘.if 1 .Underline this’ would underline only “this”,
precisely. See Section 5.23 [Conditionals and Loops], page 160.
80 The GNU Troff Manual
if the | operator were omitted, then the underline would be drawn at zero
distance from the current position, producing device-dependent, and likely
undesirable, results. On the ‘ps’ output device, it underlines the period.
For vertical motions, the | operator specifies a distance from the first text
baseline on the page or in the current diversion,22 using the current vertical
spacing.
A
.br
B \Z'C'\v'|0'D
⇒ A D
⇒ B C
In the foregoing example, we’ve used the \Z escape sequence (see Sec-
tion 5.25 [Page Motions], page 176) to restore the drawing position after
formatting ‘C’, then moved vertically to the first text baseline on the page.
\B'anything' [Escape sequence]
Interpolate 1 if anything is a valid numeric expression, and 0 otherwise.
The delimiter need not be a neutral apostrophe; see Section 5.6.5 [Delim-
iters], page 89.
You might use \B along with the if request to filter out invalid macro or
string arguments. See Section 5.23 [Conditionals and Loops], page 160.
.\" Indent by amount given in first argument; assume ens.
.de Indent
. if \B'\\$1' .in (n;\\$1)
..
A register interpolated as an operand in a numeric expression must have
an Arabic format; luckily, this is the default. See Section 5.8.4 [Assigning
Register Formats], page 96.
Because spaces separate arguments to requests, spaces are not allowed
in numeric expressions unless the (sub)expression containing them is sur-
rounded by parentheses. See Section 5.6.2 [Invoking Requests], page 84, and
Section 5.23 [Conditionals and Loops], page 160.
.nf
.nr a 1+2 + 2+1
\na
error expected numeric expression, got a space
⇒ 3
.nr a 1+(2 + 2)+1
\na
⇒ 6
The nr request (see Section 5.8.1 [Setting Registers], page 92) expects
its second and optional third arguments to be numeric expressions; a bare +
does not qualify, so our first attempt got a warning.
22
See Section 5.29 [Diversions], page 196.
Chapter 5: GNU troff Reference 81
5.5 Identifiers
An identifier labels a GNU troff datum such as a register, name (macro,
string, or diversion), typeface, color, special character, character class, envi-
ronment, or stream. Valid identifiers consist of one or more ordinary char-
acters. An ordinary character is an input character that is not the escape
character, a leader, tab, newline, or invalid as GNU troff input.
Invalid input characters are a subset of control characters (from the sets
“C0 Controls” and “C1 Controls” as Unicode describes them). When GNU
troff encounters one in an identifier, it produces a warning in category
‘input’ (see Section 5.37.1 [Warnings], page 221). They are removed during
interpretation: an identifier ‘foo’, followed by an invalid character and then
‘bar’, is processed as ‘foobar’.
On a machine using the ISO 646, 8859, or 10646 character encodings,
invalid input characters are 0x00, 0x08, 0x0B, 0x0D–0x1F, and 0x80–0x9F.
On an EBCDIC host, they are 0x00–0x01, 0x08, 0x09, 0x0B, 0x0D–0x14,
0x17–0x1F, and 0x30–0x3F.23 Some of these code points are used by GNU
troff internally, making it non-trivial to extend the program to accept
UTF-8 or other encodings that use characters from these ranges.24
Thus, the identifiers ‘br’, ‘PP’, ‘end-list’, ‘ref*normal-print’, ‘|’, ‘@_’,
and ‘!"#$%'()*+,-./’ are all valid. Discretion should be exercised to pre-
vent confusion. Identifiers starting with ‘(’ or ‘[’ require care.
.nr x 9
.nr y 1
.nr (x 2
.nr [y 3
.nr sum1 (\n(x + \n[y])
error a space character is not allowed in an escape
error sequence parameter
A:2+3=\n[sum1]
.nr sum2 (\n((x + \n[[y])
B:2+3=\n[sum2]
.nr sum3 (\n[(x] + \n([y)
C:2+3=\n[sum3]
⇒ A:2+3=1 B:2+3=5 C:2+3=5
23
Historically, control characters like ASCII STX, ETX, and BEL (Control+B,
Control+C, and Control+G) have been observed in roff documents, particularly in
macro packages employing them as delimiters with the output comparison operator
to try to avoid collisions with the content of arbitrary user-supplied parameters (see
Section 5.23.1 [Operators in Conditionals], page 160). We discourage this expedient;
in GNU troff it is unnecessary (outside of compatibility mode) because delimited
arguments are parsed at a different input level than the surrounding context. See
Section 5.38 [Implementation Differences], page 223.
24
Consider what happens when a C1 control 0x80–0x9F is necessary as a continuation
byte in a UTF-8 sequence.
82 The GNU Troff Manual
An identifier with a closing bracket (‘]’) in its name can’t be accessed with
bracket-form escape sequences that expect an identifier as a parameter. For
example, ‘\[foo]]’ accesses the glyph ‘foo’, followed by ‘]’ in whatever the
surrounding context is, whereas ‘\C'foo]'’ formats a glyph named ‘foo]’.
Similarly, the identifier ‘(’ can’t be interpolated except with bracket forms.
If you begin a macro, string, or diversion name with either of the charac-
ters ‘[’ or ‘]’, you foreclose use of the grefer preprocessor, which recognizes
‘.[’ and ‘.]’ as bibliographic reference delimiters.
\A'anything' [Escape sequence]
Interpolate 1 if anything is a valid identifier, and 0 otherwise. The de-
limiter need not be a neutral apostrophe; see Section 5.6.5 [Delimiters],
page 89. Because invalid input characters are removed (see above), invalid
identifiers are empty or contain spaces, tabs, or newlines.
You can employ \A to validate a macro argument before using it to con-
struct another escape sequence or identifier.
.\" usage: .init-coordinate-pair name val1 val2
.\" Create a coordinate pair where name!x=val1 and
.\" name!y=val2.
.de init-coordinate-pair
. if \A'\\$1' \{\
. if \B'\\$2' .nr \\$1!x \\$2
. if \B'\\$3' .nr \\$1!y \\$3
. \}
..
.init-coordinate-pair center 5 10
The center is at (\n[center!x], \n[center!y]).
.init-coordinate-pair "poi→nt" trash garbage \" ignored
.init-coordinate-pair point trash garbage \" ignored
⇒ The center is at (5, 10).
In this example, we also validated the numeric arguments; the registers
‘point!x’ and ‘point!y’ remain undefined. See Section 5.4 [Numeric
Expressions], page 77, for the \B escape sequence.
How GNU troff handles the interpretation of an undefined identifier
depends on the context. There is no way to invoke an undefined request;
such syntax is interpreted as a macro call instead. If the identifier is in-
terpreted as a string, macro, or diversion, GNU troff emits a warning in
category ‘mac’, defines it as empty, and interpolates nothing. If the iden-
tifier is interpreted as a register, GNU troff emits a warning in category
‘reg’, initializes it to zero, and interpolates that value. See Section 5.37.1
[Warnings], page 221, Section 5.8.2 [Interpolating Registers], page 94, and
Section 5.22 [Strings], page 156. Attempting to use an undefined typeface,
special character, color, character class, environment, or stream generally
provokes an error diagnostic.
Chapter 5: GNU troff Reference 83
Identifiers for requests, macros, strings, and diversions share one name
space; special characters and character classes another. No other object
types do.
.de xxx
. nop foo
..
.di xxx
bar
.br
.di
.
.xxx
⇒ bar
The foregoing example shows that GNU troff reuses the identifier ‘xxx’,
changing it from a macro to a diversion. No warning is emitted, and the
previous contents of ‘xxx’ are lost.
The control ‘.’ and no-break control ‘'’ characters can each be changed
to any ordinary character25 with the cc and c2 requests, respectively.
When writing a macro, you might wish to know which control character
was used to call it.
\n[.br] [Register]
This read-only register interpolates 1 if the currently executing macro was
called using the normal control character and 0 otherwise. If a macro is
interpolated as a string, the .br register’s value is inherited from the
context of the string interpolation. See Section 5.22 [Strings], page 156.
Use this register to reliably intercept requests that imply breaks.
.als bp*orig bp
.de bp
. ie \\n[.br] .bp*orig
. el 'bp*orig
..
Testing the .br register outside of a macro definition makes no sense.
25
Recall Section 5.5 [Identifiers], page 81.
Chapter 5: GNU troff Reference 85
is necessary; any excess is ignored. GNU troff does not allow tabs for
argument separation.26
Generally, a space within a request argument is not relevant, not meaning-
ful, or is supported by bespoke provisions, as with the tl request’s delimiters
(see Section 5.17 [Page Layout], page 126). Some requests, like ds, interpret
the remainder of the control line as a single argument. See Section 5.22
[Strings], page 156.
Spaces and tabs immediately after a control character are ignored. Com-
monly, authors structure the source of documents or macro files with them.
.de center
. if \\n[.br] \
. br
. ce \\$1
..
.
.
.de right-align
.→if \\n[.br] \
.→→br
.→rj \\$1
..
If you assign an empty blank line trap, you can separate macro definitions
(or any input lines) with blank lines.
.de do-nothing
..
.blm do-nothing \" activate blank line trap
.de center
. if \\n[.br] \
. br
. ce \\$1
..
.de right-align
.→if \\n[.br] \
.→→br
.→rj \\$1
..
26
In compatibility mode, a space is not necessary after a request or macro name of two
characters’ length. Also, Plan 9 troff allows tabs to separate arguments.
86 The GNU Troff Manual
27
\~ is fairly portable; see Section 5.38.3 [Other Differences], page 226.
28
Strictly, you can neglect to close the last quoted macro argument, relying on the end
of the control line to do so. We consider this lethargic practice poor style.
Chapter 5: GNU troff Reference 87
some escape sequences in source documents may interact poorly with a macro
package you use; consult its documentation to learn of “safe” sequences or
alternative facilities it provides to achieve the desired result.
If an escape character is followed by a character that does not identify
a defined operation, the escape character is ignored (producing a diagnostic
of the ‘escape’ warning category, which is not enabled by default) and the
following character is processed normally.
$ groff -Tps -ww
.nr N 12
.ds co white
.ds animal elephant
I have \fI\nN \*(co \*[animal]s,\f[]
said \P.\&\~Pseudo Pachyderm.
error warning: escape character ignored before 'P'
⇒ I have 12 white elephants, said P. Pseudo Pachyderm.
Escape sequence interpolation is of higher precedence than escape se-
quence argument interpretation. This rule affords flexibility in using escape
sequences to construct parameters to other escape sequences.
.ds family C\" Courier
.ds style I\" oblique
Choice a typeface \f(\*[family]\*[style]wisely.
⇒ Choose a typeface wisely.
In the above, the syntax form ‘\f(’ accepts only two characters for an ar-
gument; the example works because the subsequent escape sequences are
interpolated before the selection escape sequence argument is processed, and
strings family and style interpolate one character each.29
The escape character is nearly always interpreted when encountered; it
is therefore desirable to have a way to interpolate it, disable it, or change it.
\e [Escape sequence]
Interpolate the escape character.
The \[rs] special character escape sequence formats a backslash glyph.
In macro and string definitions, the input sequences \\ and \E defer inter-
pretation of escape sequences. See Section 5.24.2 [Copy Mode], page 173.
.eo [Request]
Disable the escape mechanism except in copy mode. Once this request is
invoked, no input character is recognized as starting an escape sequence
in interpretation mode.
.ec [o] [Request]
Recognize the ordinary character o as the escape character. If o is absent
or invalid, the default escape character ‘\’ is selected.
29
The omission of spaces before the comment escape sequences is necessary; see Sec-
tion 5.22 [Strings], page 156.
Chapter 5: GNU troff Reference 89
.ecs [Request]
.ecr [Request]
The ecs request stores the escape character for recall with ecr. ecr sets
the escape character to ‘\’ if none has been saved.
Use these requests together to temporarily change the escape character.
5.6.5 Delimiters
Some escape sequences that require parameters use delimiters. The neutral
apostrophe ' is a popular choice and shown in this document. The neutral
double quote " is also commonly seen. Letters, numerals, and leaders can
be used. Punctuation characters are likely better choices, except for those
defined as infix operators in numeric expressions; see below.
\l'1.5i\[bu]' \" draw 1.5 inches of bullet glyphs
The following escape sequences don’t take arguments and thus are allowed
as delimiters: \SP, \%, \|, \^, \{, \}, \', \`, \-, \_, \!, \?, \), \/, \,, \&,
\:, \~, \0, \a, \c, \d, \e, \E, \p, \r, \t, and \u. However, using them this
way is discouraged; they can make the input confusing to read.
30
TEX does have such a mechanism.
90 The GNU Troff Manual
A few escape sequences, \A, \b, \o, \w, \X, and \Z, accept a newline as
a delimiter. Newlines that serve as delimiters continue to be recognized as
input line terminators.
A caf\o
e\(aa
in Paris
⇒ A café in Paris
Use of newlines as delimiters in escape sequences is also discouraged.
Finally, the escape sequences \D, \h, \H, \l, \L, \N, \R, \s, \S, \v, and
\x prohibit many delimiters.
• the numerals 0-9 and the decimal point .
• the (single-character) operators ‘+-/*%<>=&:()’
• the space and tab characters
• any escape sequences other than \%, \:, \{, \}, \', \`, \-, \_, \!, \/,
\c, \e, and \p
5.7 Comments
One of the most common forms of escape sequence is the comment.31
\# [Escape sequence]
Start a comment; everything up to and including the next newline is
ignored. This groff extension was introduced to avoid the problems
described above.
Test
\# comment
Test
⇒ Test Test
31
This claim may be more aspirational than descriptive.
32
See Section 5.23.4 [Conditional Blocks], page 164.
92 The GNU Troff Manual
5.8 Registers
In the roff language, numbers can be stored in registers. Many built-in
registers exist, supplying anything from the date to details of formatting
parameters. You can also define your own. See Section 5.5 [Identifiers],
page 81, for information on constructing a valid name for a register.
33
Exception: auto-incrementing registers defined outside the ignored region will be mod-
ified if interpolated with \n± inside it. See Section 5.8.3 [Auto-increment], page 95.
Chapter 5: GNU troff Reference 93
.ll 1.6i
.
aaa bbb ccc ddd eee fff ggg hhh\R':k \n[.k]'
.tm :k == \n[:k]
⇒ :k == 126950
.
.br
.
aaa bbb ccc ddd eee fff ggg hhh\h'0'\R':k \n[.k]'
.tm :k == \n[:k]
⇒ :k == 15000
If you process this with the PostScript device (-Tps), there will be a line
break eventually after ggg in both input lines. However, after processing
the space after ggg, the partially collected line is not overfull yet, so GNU
troff continues to collect input until it sees the space (or in this case, the
newline) after hhh. At this point, the line is longer than the line length,
and the line gets broken.
In the first input line, since the \R escape sequence leaves no traces, the
check for the overfull line hasn’t been done yet at the point where \R gets
handled, and you get a value for the .k register that is even greater than
the current line length.
In the second input line, the insertion of \h'0' to cause a zero-width
motion forces GNU troff to check the line length, which in turn causes
the start of a new output line. Now .k returns the expected value.
.nr a 7
.nr b 3
.nr a -\nb
\na
⇒ 4
.nr a (-\nb)
\na
⇒ -3
.nr a 0-\nb
\na
⇒ -3
If a register’s prior value does not exist (the register was undefined), an
increment or decrement is applied as if to 0.
.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.8.3 Auto-increment
Registers can also be incremented or decremented by a configured amount at
the time they are interpolated. The value of the increment is specified with
a third argument to the nr request, and a special interpolation syntax is
used to alter and then retrieve the register’s value. Together, these features
are called auto-increment.34
34
A negative auto-increment can be considered an “auto-decrement”.
96 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]
⇒ 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 regis-
ter, assign the register’s value to itself by interpolating it, and specify the
desired increment normally. Apply an increment of ‘0’ to disable auto-
incrementation of the register.
.nr a 10
.af a 0 \" the default format
\na,
.af a I
\na,
.af a 321
.nr a (-\na)
\na,
.af a a
\na
⇒ 10, X, -010, -j
The representable extrema in the ‘i’ and ‘I’ formats correspond to Arabic
±39,999. GNU troff uses ‘w’ and ‘z’ to represent 5,000 and 10,000 in
Roman numerals, respectively, following the convention of AT&T troff—
currently, the correct glyphs for Roman numerals five thousand (U+2181)
and ten thousand (U+2182) are not used.
Assigning the format of a read-only register is an error. Instead, copy the
read-only register’s value to, and assign the format of, a writable register.
\gr [Escape sequence]
\g(rg [Escape sequence]
\g[reg] [Escape sequence]
Interpolate the format of the register reg (one-character name r, two-
character name rg). Zeroes represent Arabic formats. If reg is not de-
fined, reg is not created and nothing is interpolated. \g is interpreted
even in copy mode (see Section 5.24.2 [Copy Mode], page 173).
GNU troff interprets only Arabic numerals. The Roman numeral or
alphabetic formats cannot be used as operands to arithmetic operators in
expressions (see Section 5.4 [Numeric Expressions], page 77). For instance,
it may be desirable to test the page number independently of its format.
.af % i \" front matter
.de header-trap
. \" To test the page number, we need it in Arabic.
. ds saved-page-number-format \\g%\"
. af % 0
. nr page-number-in-decimal \\n%
. af % \\*[saved-page-number-format]
. ie \\n[page-number-in-decimal]=1 .do-first-page-stuff
. el \{\
. ie o .do-odd-numbered-page-stuff
. el .do-even-numbered-page-stuff
. \}
. rm saved-page-number-format
..
.wh 0 header-trap
98 The GNU Troff Manual
\n[$$] Process identifier (PID) of the GNU troff program in its oper-
ating environment.
Date- and time-related registers are set per the local time as determined
by localtime(3) when the formatter launches. This initialization can be
overridden by SOURCE_DATE_EPOCH and TZ; see Section 2.2 [Environment],
page 10.
\n[seconds]
Count of seconds elapsed in the minute (0–60).
\n[minutes]
Count of minutes elapsed in the hour (0–59).
\n[hours]
Count of hours elapsed since midnight (0–23).
\n[dw] Day of the week (1–7; 1 is Sunday).
\n[dy] Day of the month (1–31).
\n[mo] Month of the year (1–12).
\n[year] Gregorian year.
\n[yr] Gregorian year minus 1900. This register is incorrectly docu-
mented in the AT&T troff manual as storing the last two digits
of the current year. That claim stopped being true in 2000. Old
troff input that looks like:
'\" The year number is a surprise after 1999.
This document was formatted in 19\n(yr.
can be corrected to:
This document was formatted in \n[year].
or, for portability across many roff programs, to the following.
.nr y4 1900+\n(yr
This document was formatted in \n(y4.
.ll 55n
This line is normally filled and adjusted.
.br
A line's alignment is decided
'ce \" Center the next input line (no break).
when it is output.
This line returns to normal filling and adjustment.
⇒ This line is normally filled and adjusted.
⇒ A line's alignment is decided when it is output.
⇒ This line returns to normal filling and adjustment.
Output line properties like page offset, indentation, adjustment, and even
the location of its text baseline, are not determined until the line has been
broken. An output line is said to be pending if some input has been collected
but an output line corresponding to it has not yet been written; such an
output line is also termed partially collected. If no output line is pending,
it is as if a break has already happened; additional breaks, whether explicit
or implicit, have no effect. If the vertical drawing position is negative—as
it is when the formatter starts up—a break starts a new page (even if no
output line is pending) unless an end-of-input macro is being interpreted.
See Section 5.28.5 [End-of-input Traps], page 194.
.br [Request]
Break the line: emit any pending output line without adjustment.
foo bar
.br
baz
'br
qux
⇒ foo bar
⇒ baz qux
Sometimes you want to prevent a break within a phrase or between a
quantity and its units.
\~ [Escape sequence]
Insert an unbreakable space that is adjustable like an ordinary space. It
is discarded from the end of an output line if a break is forced.
Set the output speed to\~1.
There are 1,024\~bytes in 1\~KiB.
J.\~F.\~Ossanna wrote the original CSTR\~#54.
By default, GNU troff fills text and adjusts it to reach the output line
length. The nf request disables filling; the fi request reënables it.
.fi [Request]
\n[.u] [Register]
Enable filling of output lines; a pending output line is broken. The read-
only register .u is set to 1. The filling enablement status, sometimes
Chapter 5: GNU troff Reference 101
called fill mode, is associated with the environment (see Section 5.31 [En-
vironments], page 203). See Section 5.16 [Line Continuation], page 125,
for interaction with the \c escape sequence.
.nf [Request]
Disable filling of output lines: the output line length (see Section 5.15
[Line Layout], page 122) is ignored and output lines are broken where the
input lines are. A pending output line is broken and adjustment is sup-
pressed. The read-only register .u is set to 0. The filling enablement sta-
tus is associated with the environment (see Section 5.31 [Environments],
page 203). See Section 5.16 [Line Continuation], page 125, for interaction
with the \c escape sequence.
b
n Adjust “normally”: if the output line does not consume the
distance between the indentation and the configured output
line length, GNU troff stretches adjustable spaces within
the line until that length is reached. When the indentation
is zero, this mode spreads the line to both the left and right
margins. This is the GNU troff default.
.ll 48n
.de AD
. br
. ad \\$1
..
.de NA
. br
. na
..
left
.AD r
.nr ad \n(.j
right
.AD c
center
.NA
left
.AD
center
.AD \n(ad
right
⇒ left
⇒ right
⇒ center
⇒ left
⇒ center
⇒ right
.na [Request]
Disable output line adjustment. This produces the same output as left-
alignment, but the value of the adjustment mode register .j is altered
differently. The adjustment mode and enablement status are associated
with the environment (see Section 5.31 [Environments], page 203).
.brp [Request]
\p [Escape sequence]
Break, adjusting the line per the current adjustment mode. \p schedules
a break with adjustment at the next word boundary. The escape sequence
is itself neither a break nor a space of any kind; it can thus be placed in
the middle of a word to cause a break at the end of that word.
Breaking with immediate adjustment can produce ugly results since GNU
troff doesn’t have a sophisticated paragraph-building algorithm, as TEX
has, for example. Instead, GNU troff fills and adjusts a paragraph line
by line.
Chapter 5: GNU troff Reference 103
.ll 4.5i
This is an uninteresting sentence.
This is an uninteresting sentence.\p
This is an uninteresting sentence.
is formatted as follows.
This is an uninteresting sentence. This is
an uninteresting sentence.
This is an uninteresting sentence.
To clearly present the next couple of requests, we must introduce the con-
cept of “productive” input lines. A productive input line is one that directly
produces formatted output. Text lines produce output,36 as do control lines
containing requests like tl or escape sequences like \D. Macro calls are not
directly productive, and thus not counted, but their interpolated contents
can be. Empty requests, and requests and escape sequences that define reg-
isters or strings or alter the formatting environment (as with changes to the
size, face, height, slant, or color of the type) are not productive. We will also
preview the output line continuation escape sequence, \c, which “connects”
two input lines that would otherwise be counted separately.37
.de hello
Hello, world!
..
.ce \" center output of next productive input line
.
.nr junk-reg 1
.ft I
Chorus: \c
.ft
.hello
Went the day well?
⇒ Chorus: Hello, world!
⇒ Went the day well?
.ce [n] [Request]
\n[.ce] [Register]
Break (unless the no-break control character is used), center the output
of the next n productive input lines with respect to the line length and
indentation without filling, then break again regardless of the invoking
control character. If the argument is not positive, centering is disabled.
Omitting the argument implies an n of ‘1’. The count of lines remaining
to be centered is stored in the read-only register .ce and is associated
with the environment (see Section 5.31 [Environments], page 203).
While the ‘.ad c’ request also centers text, it fills the text as well.
36
unless diverted; see Section 5.29 [Diversions], page 196
37
See Section 5.16 [Line Continuation], page 125.
104 The GNU Troff Manual
.de FR
This is a small text fragment that shows the differences
between the `.ce' and the `.ad c' requests.
..
.ll 4i
.ce 1000
.FR
.ce 0
.ad c
.FR
⇒ This is a small text fragment that shows
⇒ the differences
⇒ between the ‘.ce’ and the ‘.ad c’ requests.
⇒
⇒ This is a small text fragment that shows
⇒ the differences between the ‘.ce’ and
⇒ the ‘.ad c’ requests.
The previous example illustrates a common idiom of turning centering on
for a quantity of lines far in excess of what is required, and off again after
the text to be centered. This technique relieves humans of counting lines
for requests that take a count of input lines as an argument.
.rj [n] [Request]
\n[.rj] [Register]
Break (unless the no-break control character is used), align the output
of the next n productive input lines to the right margin without filling,
then break again regardless of the control character. If the argument is
not positive, right-alignment is disabled. Omitting the argument implies
an n of ‘1’. The count of lines remaining to be right-aligned is stored in
the read-only register .rj and is associated with the environment (see
Section 5.31 [Environments], page 203).
.ll 49n
.rj 3
At first I hoped that such a technically unsound
project would collapse but I soon realized it was
doomed to success. \[em] C. A. R. Hoare
⇒ At first I hoped that such a technically unsound
⇒ project would collapse but I soon realized it was
⇒ doomed to success. -- C. A. R. Hoare
Chapter 5: GNU troff Reference 105
.nh [Request]
Disable automatic hyphenation; i.e., set the hyphenation mode to 0 (see
above). The hyphenation mode of the last call to hy is not remembered.
110 The GNU Troff Manual
Only lines output from a given environment count toward the maxi-
mum associated with that environment. Hyphens resulting from \% are
counted; explicit hyphens are not.
The .hlm read-only register stores this maximum. The count of immedi-
ately preceding consecutive hyphenated lines is available in the read-only
register .hlc.
45
See Section 5.28.1.1 [Page Location Traps], page 186.
Chapter 5: GNU troff Reference 113
Without \x, the backslashes on the lines marked ‘(2)’ and ‘(4)’ would be
overprinted.
46
See Section 5.26 [Drawing Geometric Objects], page 181.
Chapter 5: GNU troff Reference 115
.ns [Request]
.rs [Request]
\n[.ns] [Register]
Enable no-space mode. Vertical spacing, whether by sp requests or blank
input lines, is disabled. The bp request to advance to the next page is
also disabled, unless it is accompanied by a page number (see Section 5.18
[Page Control], page 128). No-space mode ends automatically when text47
is formatted for output48 or the rs request is invoked, which ends no-space
mode. The read-only register .ns interpolates a Boolean value indicating
the enablement of no-space mode.
A paragraphing macro might ordinarily insert vertical space to separate
paragraphs. A section heading macro could invoke ns to suppress this
spacing for the first paragraph in a section.
Now we are ready to interpret the full syntax given above. The ta request
sets tabs at positions n1, n2, . . . , nn, then at nn+r1, nn+r2, . . . , nn+rn,
then at nn+rn+r1, nn+rn+r2, . . . , nn+rn+rn, and so on.
For example, ‘4c +6c T 3c 5c 2c’ is equivalent to ‘4c 10c 13c 18c 20c
23c 28c 30c ...’.
Text written to a tab column (i.e., between two tab stops, or between a
tab stop and an output line boundary) may be aligned to the right or left,
or centered in the column. This alignment is determined by appending
‘R’, ‘L’, or ‘C’ to the tab specifier. The default is ‘L’.
The beginning of an output line is not a tab stop; the text that begins
an output line is placed according to the configured alignment and inden-
tation; see Section 5.9 [Manipulating Filling and Adjustment], page 99,
and Section 5.15 [Line Layout], page 122.
.ll 2i
.ds foo a\tb\tc
.ta T 1i
\*[foo]
error warning: cannot break line
⇒ a b c
The above creates a single output line that is a bit longer than two inches
(we use a string to show exactly where the tab stops are). Now consider
the following.
.ll 2i
.ds bar a\tb c\td
.ta T 1i
\*[bar]
error warning: cannot adjust line
⇒ a b
⇒ c d
GNU troff first converts the line’s tab stops into unbreakable horizontal
movements, then breaks after ‘b’. This usually isn’t what you want.
.ds Z foo\tbar\tbaz
.ds ZZ foo\tbar\tbazqux
.ds ZZZ foo\tbar\tbaz\tqux
.ta 2i 4iR
\*[Z]
.br
\*[ZZ]
.br
\*[ZZZ]
.br
⇒ foo bar baz
⇒ foo bar bazqux
⇒ foo bar bazqux
The first line right-aligns “baz” within the second tab stop. The second
line right-aligns “bazqux” within it. The third line right-aligns only “baz”
because of the additional tab character, which marks the end of the text
occupying the last tab stop defined.
Tab stops are associated with the environment (see Section 5.31 [Envi-
ronments], page 203).
The read-only register .tabs contains a string representation of the cur-
rent tab settings suitable for use as an argument to the ta request.49
.ds tab-string \n[.tabs]
\*[tab-string]
⇒ T120u
.linetabs n [Request]
\n[.linetabs] [Register]
If n is missing or non-zero, activate line-tabs; deactivate it otherwise (the
default). Active line-tabs cause GNU troff to compute tab distances
relative to the start of the output line instead of the input line.
49
Plan 9 troff uses the register .S for this purpose.
118 The GNU Troff Manual
.de Tabs
. ds x a\t\c
. ds y b\t\c
. ds z c
. ta 1i 3i
\\*x
\\*y
\\*z
..
.Tabs
.br
.linetabs
.Tabs
⇒ a b c
⇒ a b c
Line-tabs activation is associated with the environment (see Section 5.31
[Environments], page 203). The read-only register .linetabs interpo-
lates 1 if line-tabs are active, and 0 otherwise.
5.12.1 Leaders
Sometimes it is desirable to fill a tab stop with a given glyph, but also use tab
stops normally on the same output line. An example is a table of contents
entry that uses dots to bridge the entry name with its page number, which
is itself aligned between tab stops. The roff language provides leaders for
this purpose.50
A leader character (ISO and EBCDIC code point 1, also known as SOH or
“start of heading”), behaves similarly to a tab character: it moves to the next
tab stop. The difference is that for this movement, the default fill character
is a period ‘.’.
\a [Escape sequence]
Interpolate a leader in copy mode; see Section 5.24.2 [Copy Mode],
page 173.
.lc [c] [Request]
Set the leader repetition character to the ordinary or special character
c. Recall Section 5.1.6 [Tabs and Leaders], page 67: when encountering
a leader character in the input, the formatter writes as many dots ‘.’ as
are necessary until reaching the next tab stop; this is the leader definition
character. Omitting c unsets the leader character. With no argument,
GNU troff treats leaders the same as tabs. The leader repetition charac-
ter is associated with the environment (see Section 5.31 [Environments],
page 203). Only a single c is recognized; any excess is ignored.
50
This is pronounced to rhyme with “feeder”, and refers to how the glyphs “lead” the
eye across the page to the corresponding page number or other datum.
Chapter 5: GNU troff Reference 119
A table of contents, for example, may define tab stops after a section
number, a title, and a gap to be filled with leader dots. The page number
follows the leader, after a right-aligned final tab stop wide enough to house
the largest page number occurring in the document.
.ds entry1 19.\tThe Prophet\a\t98
.ds entry2 20.\tAll Astir\a\t101
.ta .5i 4.5i +.5iR
.nf
\*[entry1]
\*[entry2]
⇒ 19. The Prophet............................. 98
⇒ 20. All Astir............................... 101
5.12.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 an adjustable space similar to TEX’s \hss
command (thus it can even be negative) to make the sum of all substring
lengths plus the adjustable 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).
In contrast to, e.g., the tab repetition character, delimiting and padding
characters are not associated with the environment (see Section 5.31 [En-
vironments], page 203).
.fc # ^
.ta T 3i
#foo^bar^smurf#
.br
#foo^^bar^smurf#
⇒ foo bar smurf
⇒ foo bar smurf
.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 GNU
troff uses a terminal output device; the code for switching to nroff
mode is in the file tty.tmac, which is loaded by the startup file troffrc.
See Section 5.23 [Conditionals and Loops], page 160, for more details on
built-in conditions.
The current indentation (as set by in) can be found in the read-only
register ‘.i’. The indentation is associated with the environment (see
Section 5.31 [Environments], page 203).
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.
\c [Escape sequence]
\n[.int] [Register]
\c continues an output line. Nothing after it on the input line is format-
ted. In contrast to \RET, a line after \c remains a new input line, so a
control character is recognized at its beginning. The visual results depend
on whether filling is enabled; see Section 5.9 [Manipulating Filling and
Adjustment], page 99.
• If filling is enabled, a word interrupted with \c is continued with the
text on the next input text line, without an intervening space.
126 The GNU Troff Manual
This is a te\c
st.
⇒ This is a test.
• If filling is disabled, 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.
An intervening control line that causes a break overrides \c, flushing out
the pending output line in the usual way.
The .int register contains a positive value if the last output line was
continued with \c; this datum is associated with the environment (see
Section 5.31 [Environments], page 203).52
The formatter offers special support for typesetting headers and footers,
collectively termed titles. Titles have an independent line length, and their
placement on the page is not restricted.
55
Terminals and some output devices have fonts that render at only one or two sizes. As
examples of the latter, take the groff lj4 device’s Lineprinter, and lbp’s Courier and
Elite faces.
56
Font designers prepare families such that the styles share esthetic properties.
57
Historically, the fonts troffs dealt with were not Free Software or, as with the Graphic
Systems C/A/T, did not even exist in the digital domain.
58
See Section 6.2.2 [Font Description File Format], page 245.
Chapter 5: GNU troff Reference 131
for instance, and change the default family on the command line (recall
Section 2.1 [Groff Options], page 5).
Fonts for the devices ps, pdf, dvi, lj4, lbp, and the X11 devices support
this mechanism. By default, GNU troff uses the Times family with the four
styles ‘R’, ‘I’, ‘B’, and ‘BI’.
.fam [family] [Request]
\n[.fam] [Register]
\Ff [Escape sequence]
\F(fm [Escape sequence]
\F[family] [Escape sequence]
Set the default font family, used in combination with abstract styles to
construct a resolved font name, to family (one-character name f, two-
character name fm). If no argument is given, GNU troff selects the
previous font family; if there none, is it falls back to the device’s default59
or its own (‘T’).
The \F escape sequence works similarly. In disanalogy to \f, ‘\FP’ makes
‘P’ the default family. Use ‘\F[]’ to select the previous default family.
The default font family is available in the read-only string-valued register
.fam; it is associated with the environment (see Section 5.31 [Environ-
ments], page 203).
spam, \" startup defaults are T (Times) R (roman)
.fam H \" make Helvetica the default family
spam, \" family H + style R = HR
.ft B \" family H + style B = HB
spam,
.ft CR \" Courier roman (default family not changed)
spam,
.ft \" back to Helvetica bold
spam,
.fam T \" make Times the default family
spam, \" family T + style B = TB
.ft AR \" font AR (not a style)
baked beans,
.ft R \" family T + style R = TR
and spam.
\F doesn’t produce an input token in GNU troff. As a consequence, it
can be used in requests like mc (which expects a single character as an
argument) to change the font family on the fly.
.mc \F[P]x\F[]
59
See Section 6.2.1 [DESC File Format], page 242.
134 The GNU Troff Manual
mounted with the fonts keyword in the DESC file are globally available. To
install additional special fonts locally (i.e., for a particular font), use the
fspecial request.
Here are the exact rules how gtroff searches a given symbol:
• If the symbol has been defined with the char request, use it. This hides
a symbol with the same name in the current font.
• Check the current font.
• If the symbol has been defined with the fchar request, use it.
• Check whether the current font has a font-specific list of special fonts;
test all fonts in the order of appearance in the last fspecial call if
appropriate.
• 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. This can sometimes
lead to surprising results since the fonts line in the DESC file often con-
tains 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 6.2 [Device and Font Description Files], page 242, and Sec-
tion 5.19.6 [Special Fonts], page 144, for more details.
The groff char(7) man page houses a complete list of predefined special
character names, but the availability of any as a glyph is device- and font-
dependent. For example, say
man -Tdvi groff_char > groff_char.dvi
Chapter 5: GNU troff Reference 137
to obtain those available with the DVI device and default font configura-
tion.60 If you want to use an additional macro package to change the fonts
used, groff (or gtroff) must be run directly.
groff -Tdvi -mec -man groff_char.7 > groff_char.dvi
Special character names not listed in groff char(7) are derived algorith-
mically, 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 names that can’t be derived algorithmically is called the
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
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 either.
• 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 max-
imally decomposed to NFD;61 for example, u00CA_0301 is not a valid
glyph name since U+00CA (latin capital letter e with circum-
flex) can be further decomposed 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. Ex-
ample: 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.
60
Not all versions of the man program support the -T option; use the subsequent example
for an alternative.
61
This is “Normalization Form D” as documented in Unicode Standard Annex #15
(https://unicode.org/reports/tr15/).
138 The GNU Troff Manual
.cflags n c1 c2 . . . [Request]
Assign properties encoded by the number n to characters c1, c2, and so
on.
Input characters, including special characters introduced by an escape,
have certain properties associated with them.63 These properties can be
modified with this request. The first argument is the sum of the desired
flags and the remaining arguments are the characters to be assigned those
properties. Spaces between the cn arguments are optional. Any argument
cn can be a character class defined with the class request rather than an
individual character. See Section 5.19.5 [Character Classes], page 142.
The non-negative integer n is the sum of any of the following. Some
combinations are nonsensical, such as ‘33’ (1 + 32).
1 Recognize the character as ending a sentence if followed by
a newline or two spaces. Initially, characters ‘.?!’ have this
property.
2 Enable breaks before the character. A line is not broken at
a character with this property unless the characters on each
side both have non-zero hyphenation codes. This exception
can be overridden by adding 64. Initially, no characters have
this property.
4 Enable breaks after the character. A line is not broken at a
character with this property unless the characters on each
side both have non-zero hyphenation codes. This excep-
tion can be overridden by adding 64. Initially, characters
‘\-\[hy]\[em]’ have this property.
8 Mark the glyph associated with this character as overlap-
ping other instances of itself horizontally. Initially, characters
‘\[ul]\[rn]\[ru]\[radicalex]\[sqrtex]’ have this prop-
erty.
16 Mark the glyph associated with this character as overlap-
ping other instances of itself vertically. Initially, the character
‘\[br]’ has this property.
32 Mark the character as transparent for the purpose of
end-of-sentence recognition. In other words, an end-of-
sentence character followed by any number of characters
with this property is treated as the end of a sentence if
followed by a newline or two spaces. This is the same as
having a zero space factor in TEX. Initially, characters
‘"')]*\[dg]\[dd]\[rq]\[cq]’ have this property.
63
Output glyphs don’t—to GNU troff, a glyph is simply a box with an index into a
font, a given height above and depth below the baseline, and a width.
Chapter 5: GNU troff Reference 141
An object defined by these requests can be used just like a normal glyph
provided by the output device. In particular, other characters can be
translated to it with the tr or trin requests; it can be made the leader
character with the lc request; repeated patterns can be drawn with it
using the \l and \L escape sequences; and words containing c can be
hyphenated correctly if the hcode request is used to give the object a
hyphenation code.
There is a special anti-recursion feature: use of the object within its own
definition is handled like a normal character (not defined with char).
The tr and trin requests take precedence if char accesses the same
symbol.
.tr XY
X
⇒ Y
.char X Z
X
⇒ Y
.tr XX
X
⇒ Z
The fchar request defines a fallback glyph: gtroff only checks for glyphs
defined with fchar if it cannot find the glyph in the current font. gtroff
carries out this test before checking special fonts.
fschar defines a fallback glyph for font f : gtroff checks for glyphs
defined with fschar after the list of fonts declared as font-specific special
fonts with the fspecial request, but before the list of fonts declared as
global special fonts with the special request.
Finally, the schar request defines a global fallback glyph: gtroff checks
for glyphs defined with schar after the list of fonts declared as global
special fonts with the special request, but before the already mounted
special fonts.
See Section 5.19.5 [Character Classes], page 142.
.rchar c . . . [Request]
.rfschar f c . . . [Request]
Remove definition of each ordinary or special character c, undoing the
effect of a char, fchar, or schar request. Those supplied by font descrip-
tion files cannot be removed. Spaces and tabs may separate c arguments.
The request rfschar removes glyph definitions defined with fschar for
font f.
than in European languages, and where large sets of characters share the
same properties.
.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).
current ligature mode can be found in the read-only 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 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 6.2.2 [Font Description File Format], page 245.
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 type 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
by n2; if the type 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 type size.
The default scaling unit is ‘z’ for s1 and s2, ‘p’ for n1 and n2.
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.
\s(nn Set the type size to nn points. nn must be exactly two digits.
\s+(nn
\s-(nn
\s(+nn
\s(-nn Alter the type size in points by the two-digit value nn.
See Section 5.20.3 [Using Fractional Type Sizes], page 152, for further syn-
tactical forms of the \s escape sequence that additionally accept decimal
fractions.
snap, snap,
.ps +2
grin, grin,
.ps +2
wink, wink, \s+2nudge, nudge,\s+8 say no more!
.ps 10
The \s escape sequence affects the environment immediately and doesn’t
produce an input token. Consequently, it can be used in requests like mc,
which expects a single character as an argument, to change the type size on
the fly.
.mc \s[20]x\s[0]
.sizes s1 s2 . . . sn [0] [Request]
The DESC file specifies which type sizes are allowed by the output device;
see Section 6.2.1 [DESC File Format], page 242. Use the sizes request to
change this set of permissible sizes. Arguments are in scaled points; see
Section 5.20.3 [Using Fractional Type Sizes], page 152. Each can be a sin-
gle type size (such as ‘12000’), or a range of sizes (such as ‘4000-72000’).
You can optionally end the list with a ‘0’.
\n[.ps] [Register]
This read-only register interpolates the type size in scaled points; it
is associated with the environment (see Section 5.31 [Environments],
page 203).
\n[.psr] [Register]
\n[.sr] [Register]
Output devices may be limited in the type sizes they can employ. The
.s and .ps registers represent the type size selected by the output driver
as it understands a device’s capability. The last requested type size is
interpolated in scaled points by the read-only register .psr and in points
as a decimal fraction by the read-only string-valued register .sr. Both
are associated with the environment (see Section 5.31 [Environments],
page 203).
For example, if a type size of 10.95 points is requested, and the nearest size
permitted by a sizes request (or by the sizes or sizescale directives
in the device’s DESC file) is 11 points, the output driver uses the latter
value.
The \s escape sequence offers the following syntax forms that work with
fractional type sizes and accept scaling units. You may of course give them
integral arguments. The delimited forms need not use the neutral apostro-
phe; see Section 5.6.5 [Delimiters], page 89.
\s[n]
\s'n' Set the type size to n scaled points; n is a numeric expression
with a default scaling unit of ‘z’.
154 The GNU Troff Manual
\s[+n]
\s[-n]
\s+[n]
\s-[n]
\s'+n'
\s'-n'
\s+'n'
\s-'n' Increase or decrease the type size by n scaled points; n is a
numeric expression (which may start with a minus sign) with a
default scaling unit of ‘z’.
5.21 Colors
GNU troff supports color output with a variety of color spaces and up
to 16 bits per channel. Some devices, particularly terminals, may be more
limited. When color support is enabled, two colors are current at any given
time: the stroke color, with which glyphs, rules (lines), and geometric objects
like circles and polygons are drawn, and the fill color, which can be used to
paint the interior of a closed geometric figure.
Each output device has a color named ‘default’, which cannot be rede-
fined. A device’s default stroke and fill colors are not necessarily the same.
For the dvi, html, pdf, ps, and xhtml output devices, GNU troff automat-
ically loads a macro file defining many color names at startup. By the same
mechanism, the devices supported by grotty recognize the eight standard
ISO 6429/EMCA-48 color names.69
.gcolor [color] [Request]
\mc [Escape sequence]
\m(co [Escape sequence]
\m[color] [Escape sequence]
\n[.m] [Register]
Set the stroke color to color.
.gcolor red
The next words
.gcolor
\m[red]are in red\m[]
and these words are in the previous color.
The escape sequence \m[] restores the previous stroke color, as does a
gcolor request without an argument.
The name of the current stroke color is available in the read-only string-
valued register ‘.m’; it is associated with the environment (see Section 5.31
[Environments], page 203). It interpolates nothing when the stroke color
is the default.
\m doesn’t produce an input token in GNU troff (see Section 5.36 [Gtroff
Internals], page 216). It therefore 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[]
.fcolor [color] [Request]
\Mc [Escape sequence]
\M(co [Escape sequence]
\M[color] [Escape sequence]
\n[.M] [Register]
Set the fill color for objects drawn with \D'...' escape sequences. The
escape sequence \M[] restores the previous fill color, as does an fcolor
request without an argument.
The name of the current fill color is available in the read-only string-
valued register ‘.M’; it is associated with the environment (see Section 5.31
[Environments], page 203). It interpolates nothing when the fill color is
the default. \M doesn’t produce an input token in GNU troff.
Create an ellipse with a red interior as follows.
\M[red]\h'0.5i'\D'E 2i 1i'\M[]
69
also known vulgarly as “ANSI colors”
156 The GNU Troff Manual
5.22 Strings
GNU troff supports strings primarily for user convenience. Conventionally,
if one would define a macro only to interpolate a small amount of text,
without invoking requests or calling any other macros, one defines a string
instead. Only one string is predefined by the language.
\*[.T] [String]
Contains the name of the output device (for example, ‘utf8’ or ‘pdf’).
The ds request creates a string with a specified name and contents and the
\* escape sequence dereferences its name, interpolating its contents. If the
string named by the \* escape sequence does not exist, it is defined as empty,
nothing is interpolated, and a warning in category ‘mac’ is emitted. See
Section 5.37.1 [Warnings], page 221, for information about the enablement
and suppression of warnings.
Instead, place the comment on another line or put the comment escape
sequence immediately adjacent to the last character of the string.
.ds H2O H\v'+.3m'\s'-2'2\v'-.3m'\s0O\" water
Ending string definitions (and appendments) with a comment, even an
empty one, prevents unwanted space from creeping into them during
source document maintenance.
.ds author Alice Pleasance Liddell\"
.ds empty \" might be appended to later with .as
An initial neutral double quote " in contents is stripped to allow embed-
ding of leading spaces. Any other " is interpreted literally, but it is wise
to use the special character escape sequence \[dq] instead if the string
might be interpolated as part of a macro argument; see Section 5.6.3
[Calling Macros], page 86.
.ds salutation " Yours in a white wine sauce,\"
.ds c-var-defn " char mydate[]=\[dq]2020-07-29\[dq];\"
Strings are not limited to a single input line of text. \RET works just as it
does elsewhere. The resulting string is stored without the newlines. Care
is therefore required when interpolating strings while filling is disabled.
.ds foo This string contains \
text on multiple lines \
of input.
It is not possible to embed a newline in a string that will be interpreted
as such when the string is interpolated. To achieve that effect, use \* to
interpolate a macro instead; see Section 5.30 [Punning Names], page 201.
Because strings are similar to macros, they too can be defined so as to
suppress AT&T troff compatibility mode when used; see Section 5.24
[Writing Macros], page 167, and Section 5.38.2 [Compatibility Mode],
page 223. The ds1 request defines a string such that compatibility mode
is off when the string is later interpolated. To be more precise, a com-
patibility save input token is inserted at the beginning of the string, and
a compatibility restore input token at the end.
.nr xxx 12345
.ds aa The value of xxx is \\n[xxx].
.ds1 bb The value of xxx is \\n[xxx].
.
.cp 1
.
\*(aa
error warning: register '[' not defined
⇒ The value of xxx is 0xxx].
\*(bb
⇒ The value of xxx is 12345.
158 The GNU Troff Manual
(In practice, we would end the ds request with a comment escape \"
to prevent space from creeping into the definition during source document
maintenance.)
.de foo
..
.
.als bar foo
.
.de bar
. foo
..
.
.bar
error input stack limit exceeded (probable infinite
error loop)
In the above, bar remains an alias—another name for—the object re-
ferred to by foo, which the second de request replaces. Alternatively,
imagine that the de request dereferences its argument before replacing it.
Either way, the result of calling bar is a recursive loop that finally leads
to an error. See Section 5.24 [Writing Macros], page 167.
To remove an alias, call rm on its name. The object itself is not destroyed
until it has no more names.
When a request, macro, string, or diversion is aliased, redefinitions and
appendments “write through” alias names. To replace an alias with a
separately defined object, you must use the rm request on its name first.
The above operators can’t be combined with most others, but a leading
‘!’, not followed immediately by spaces or tabs, complements an expression.
.nr x 1
.ie !r x register x is not defined
.el register x is defined
⇒ register x is defined
Spaces and tabs are optional immediately after the ‘c’, ‘d’, ‘F’, ‘m’, ‘r’, and
‘S’ operators, but right after ‘!’, they end the predicate and the conditional
evaluates true.75
.nr x 1
.ie ! r x register x is not defined
.el register x is defined
⇒ r x register x is not defined
The unexpected ‘r x’ in the output is a clue that our conditional was not
interpreted as we planned, but matters may not always be so obvious.
73
Because formatting of the comparands takes place in a dummy environment, vertical
motions within them cannot spring traps.
74
All of this is to say that the lists of output nodes created by formatting xxx and yyy
must be identical. See Section 5.36 [Gtroff Internals], page 216.
75
This bizarre behavior maintains compatibility with AT&T troff.
Chapter 5: GNU troff Reference 163
5.23.2 if-then
5.23.3 if-else
.nr a 0
.ie \na a is non-zero.
.nr a +1
.el a was not positive but is now \na.
⇒ a was not positive but is now 1.
Another way in which el is an ordinary request is that it does not lexi-
cally “bind” more tightly to its ie counterpart than it does to any other
request. This fact can surprise C programmers.
.nr a 1
.nr z 0
.ie \nz \
. ie \na a is true
. el a is false
.el z is false
error warning: unbalanced 'el' request
⇒ a is false
To conveniently nest conditionals, keep reading.
76
See Section 5.23.5 [while], page 166.
Chapter 5: GNU troff Reference 165
5.23.5 while
groff provides a looping construct: the while request. Its syntax matches
the if request.
.while cond-expr anything [Request]
Evaluate the conditional expression cond-expr, and repeatedly execute
anything unless and until cond-expr evaluates false. anything, which is
often a conditional block, is referred to as the while request’s body.
.nr a 0 1
.while (\na < 9) \{\
\n+a,
.\}
\n+a
⇒ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
GNU troff treats the body of a while request similarly to that of a
de request (albeit one not read in copy mode77 ), but stores it under an
internal name and deletes it when the loop finishes. The operation of a
macro containing a while request can slow significantly if the while body
is large. Each time the macro is executed, the while body is parsed and
stored again.
.de xxx
. nr num 10
. while (\\n[num] > 0) \{\
. \" many lines of code
. nr num -1
. \}
..
An often better solution—and one that is more portable, since AT&T
troff lacked the while request—is to instead write a recursive macro.
It will be parsed only once.78
.de yyy
. if (\\n[num] > 0) \{\
. \" many lines of code
. nr num -1
. yyy
. \}
..
.
.de xxx
. nr num 10
. yyy
..
77
See Section 5.24.2 [Copy Mode], page 173.
78
unless you redefine it
Chapter 5: GNU troff Reference 167
.break [Request]
Exit a while loop. Do not confuse this request with a typographical
break or the br request.
.continue [Request]
Skip the remainder of a while loop’s body, immediately starting the next
iteration.
79
“somewhat less” because things other than macro calls can be on the input stack
80
See Section 5.24.2 [Copy Mode], page 173.
168 The GNU Troff Manual
recognition as the end of a macro definition. The macro end can be called
with arguments.81
Here is a small example macro called ‘P’ that causes a break and inserts
some vertical space. It could be used to separate paragraphs.
.de P
. br
. sp .8v
..
We can define one macro within another. Attempting to nest ‘..’ naı̈vely
will end the outer definition because the inner definition isn’t interpreted
as such until the outer macro is later interpolated. We can use an end
macro instead. Each level of nesting should use a unique end macro.
An end macro need not be defined until it is called. This fact enables a
nested macro definition to begin inside one macro and end inside another.
Consider the following example.82
.de m1
. de m2 m3
you
..
.de m3
Hello,
Joe.
..
.de m4
do
..
.m1
know?
. m3
What
.m4
.m2
⇒ Hello, Joe. What do you know?
A nested macro definition can be terminated with ‘..’ and nested macros
can reuse end macros, but these control lines must be escaped multiple
times for each level of nesting. The necessity of this escaping and the
utility of nested macro definitions will become clearer when we employ
macro parameters and consider the behavior of copy mode in detail.
81
While it is possible to define and call a macro ‘.’, you can’t use it as an end macro:
during a macro definition, ‘..’ is never handled as calling ‘.’, even if ‘.de name .’
explicitly precedes it.
82
Its structure is adapted from, and isomorphic to, part of a solution by Tadziu Hoffman
to the problem of reflowing text multiple times to find an optimal configuration for it.
https://lists.gnu.org/archive/html/groff/2008-12/msg00006.html
Chapter 5: GNU troff Reference 169
Using trace.tmac, you can trace calls to de, de1, am, and am1. You can
also use the backtrace request at any point desired to troubleshoot tricky
spots (see Section 5.37 [Debugging], page 218).
See Section 5.22 [Strings], page 156, for the als, rm, and rn requests to
create an alias of, remove, and rename a macro, respectively.
Macro identifiers share their name space with requests, strings, and di-
versions; see Section 5.5 [Identifiers], page 81. The am, as, da, de, di, and ds
requests (together with their variants) create a new object only if the name
of the macro, diversion, or string is currently undefined or if it is defined as
a request; normally, they modify the value of an existing object. See [the
description of the als request], page 159, for pitfalls when redefining a macro
that is aliased.
5.24.1 Parameters
Macro calls and string interpolations optionally accept a list of arguments;
recall Section 5.6.3 [Calling Macros], page 86. At the time such an interpo-
lation takes place, these parameters can be examined using a register and a
variety of escape sequences starting with ‘\$’. All such escape sequences are
interpreted even in copy mode, a fact we shall motivate and explain below
(see Section 5.24.2 [Copy Mode], page 173).
\n[.$] [Register]
The count of parameters available to a macro or string is kept in this
read-only register. The shift request can change its value.
Chapter 5: GNU troff Reference 171
83
If they were not, parameter interpolations would be similar to command-line
parameters—fixed for the entire duration of a roff program’s run. The advantage
of interpolating \$ escape sequences even in copy mode is that they can interpolate
different contents from one call to the next, like function parameters in a procedural
language. The additional escape character is the price of this power.
172 The GNU Troff Manual
.de foo
. tm $1='\\$1'
. tm $2='\\$2'
. tm $*='\\$*'
. tm $@='\\$@'
. tm $^='\\$^'
..
.foo " This is a "test"
error $1=' This is a '
error $2='test"'
error $*=' This is a test"'
error $@='" This is a " "test""'
error $^='" This is a "test"'
\$* is useful when writing a macro that doesn’t need to distinguish its
arguments, or even to not interpret them; examples include macros that
produce diagnostic messages by wrapping the tm or ab requests. Use \$@
when writing a macro that may need to shift its parameters and/or wrap
a macro or request that finds the count significant. If in doubt, prefer
\$@ to \$*. An application of \$^ is seen in trace.tmac, which redefines
some requests and macros for debugging purposes.
\$0 [Escape sequence]
Interpolate the name by which the macro being interpreted was called.
The als request can cause a macro to have more than one name. Applying
string interpolation to a macro does not change this name.
Chapter 5: GNU troff Reference 173
.de foo
. tm \\$0
..
.als bar foo
.
.de aaa
. foo
..
.de bbb
. bar
..
.de ccc
\\*[foo]\\
..
.de ddd
\\*[bar]\\
..
.
.aaa
error foo
.bbb
error bar
.ccc
error ccc
.ddd
error ddd
\\ [Escape sequence]
The escape character, \ by default, can escape itself. This enables you
to control whether a given \n, \g, \$, \*, \V, or \? escape sequence is
174 The GNU Troff Manual
.de M1
\\$1
. de M2
\\\\$1
. de M3
\\\\\\\\$1
\\\\..
. M3 hand.
\\..
. M2 of
..
This understeer is getting
.M1 out
⇒ This understeer is getting out of hand.
Each escape character is interpreted twice—once in copy mode, when the
macro is defined, and once in interpretation mode, when the macro is called.
As seen above, this fact leads to exponential growth in the quantity of escape
characters required to delay interpolation of \n, \g, \$, \*, \V, and \? at
each nesting level, which can be daunting. GNU troff offers a solution.
\E [Escape sequence]
\E represents an escape character that is not interpreted in copy mode.
You can use it to ease the writing of nested macro definitions.
.de M1
. nop \E$1
. de M2
. nop \E$1
. de M3
. nop \E$1
\\\\..
. M3 better.
\\..
. M2 bit
..
This vehicle handles
.M1 a
⇒ This vehicle handles a bit better.
Observe that because \. is not a true escape sequence, we can’t use \E to
keep ‘..’ from ending a macro definition prematurely. If the multiplicity
of backslashes complicates maintenance, use end macros.
\E is also convenient to define strings containing escape sequences that
need to work when used in copy mode (for example, as macro arguments),
or which will be interpolated at varying macro nesting depths. We might
define strings to begin and end superscripting as follows.85
85
These are lightly adapted from the groff implementation of the ms macros.
176 The GNU Troff Manual
.ds { \v'-.9m\s'\En[.s]*7u/10u'+.7m'
.ds } \v'-.7m\s0+.9m'
When the ec request is used to redefine the escape character, \E also
makes it easier to distinguish the semantics of an escape character from
the other meaning(s) its character might have. Consider the use of an
unusual escape character, ‘-’.
.nr a 1
.ec -
.de xx
--na
..
.xx
⇒ -na
This result may surprise you; some people expect ‘1’ to be output since
register ‘a’ has clearly been defined with that value. What has happened?
The robotic replacement of ‘\’ with ‘-’ has led us astray. You might
recognize the sequence ‘--’ more readily with the default escape character
as ‘\-’, the special character escape sequence for the minus sign glyph.
.nr a 1
.ec -
.de xx
-Ena
..
.xx
⇒ 1
.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.
⇒ This is a small test that shows how the
⇒ rt request works in combination with mk.
⇒
⇒ Starting here, isn't robust
⇒ text is typeset and thus not
⇒ in two columns. suited for a
⇒ Note that this real two-column
⇒ implementation macro.
178 The GNU Troff Manual
Several escape sequences enable fine control of movement about the page.
\v'expr' [Escape sequence]
Vertically move the drawing position. expr indicates the magnitude of
motion: positive is downward and and negative upward. The default
scaling unit is ‘v’. The motion is relative to the current drawing position
unless expr begins with the boundary-relative motion operator ‘|’. See
Section 5.4 [Numeric Expressions], page 77.
Text processing continues at the new drawing position; usually, vertical
motions should be in balanced pairs to avoid a confusing page layout.
\v will not spring a vertical position trap. This can be useful; for example,
consider a page bottom trap macro that prints a marker in the margin to
indicate continuation of a footnote. See Section 5.28 [Traps], page 186.
A few escape sequences that produce vertical motion are unusual. They
are thought to originate early in AT&T nroff history to achieve super-
and subscripting by half-line motions on line printers and teletypewriters
before the phototypesetter made more precise positioning available. They
are reckoned in ems—not vees—to maintain continuity with their original
purpose of moving relative to the size of the type rather than the distance
between text baselines (vees).86
\r [Escape sequence]
\u [Escape sequence]
\d [Escape sequence]
Move upward 1 m, upward .5 m, and downward .5 m, respectively.
Let us see these escape sequences in use.
Obtain 100 cm\u3\d of \ka\d\092\h'|\nau'\r233\dU.
In the foregoing we have paired \u and \d to typeset a superscript, and
later a full em negative (“reverse”) motion to place a superscript above a
subscript. A numeral-width horizontal motion escape sequence aligns the
proton and nucleon numbers, while \k marks a horizontal position to which
\h returns so that we could stack them. (We shall discuss these horizontal
motion escape sequences presently.) In serious applications, we often want
to alter the type size of the -scripts and to fine-tune the vertical motions, as
the groff ms package does with its super- and subscripting string definitions.
\h'expr' [Escape sequence]
Horizontally move the drawing position. expr indicates the magnitude
of motion: positive is rightward and negative leftward. The default scal-
ing unit is ‘m’. The motion is relative to the current drawing position
unless expr begins with the boundary-relative motion operator ‘|’. See
Section 5.4 [Numeric Expressions], page 77.
86
At the grops defaults of 10-point type on 12-point vertical spacing, the difference
between half a vee and half an em can be subtle: large spacings like ‘.vs .5i’ make it
obvious.
Chapter 5: GNU troff Reference 179
87
See Section 5.22 [Strings], page 156, for an explanation of the trailing ‘\"’.
180 The GNU Troff Manual
5.28 Traps
Traps are locations in the output or conditions on the input that, when
reached or fulfilled, call a specified macro. These traps can occur at a given
location on the page, at a given location in the current diversion (together,
these are known as vertical position traps), at a blank line, at a line with
leading space characters, after a quantity of input lines, or at the end of
input. Macros called by traps are passed no arguments. Setting a trap is
also called planting one. It is said that a trap is sprung if its condition is
fulfilled.
89
See Section 5.28.1.2 [The Implicit Page Trap], page 190.
90
A trap planted at ‘20i’ or ‘-30i’ will not be sprung on a page of length ‘11i’.
Chapter 5: GNU troff Reference 187
A macro package might set headers and footers as follows; this example
configures vertical margins of one inch to the body text, and one half-inch
to the titles. Observe the use of the no-break control character with sp
request to position our text baselines, and the page number character ‘%’
used with the tl request.
.\" hdfo.roff
.de hd \" page header
' sp .5i
' tl '\\*(Ti''\\*(Da' \" title and date strings
' sp .5i
..
.de fo \" page footer
' sp .5i
. tl ''%''
. bp
..
.wh 0 hd \" trap at top of the page
.wh -1i fo \" trap 1 inch from bottom
To use these traps, copy the above (or load it from a file with the so or
mso requests), then set up the strings it uses.
.so hdfo.roff
.ds Ti Final Report\"
.ds Da 21 May 2023\"
.ti
On 5 August of last year,
this committee tasked me with the investigation of the
CFIT (controlled flight into terrain) incident of
.\" ...and so on...
A trap above the top or at or below the bottom of the page can be
made visible by either moving it into the page area or increasing the page
length so that the trap is on the page. Negative trap values always use
the current page length; they are not converted to an absolute vertical
position. We can use the ptr request to dump our page location traps to
the standard error stream (see Section 5.37 [Debugging], page 218). Their
positions are reported in basic units; an nroff device example follows.
.pl 5i
.wh -1i xx
.ptr
error xx -240
.pl 100i
.ptr
error xx -240
It is possible to have more than one trap at the same location (although
only one at a time can be visible); to achieve this, the traps must be
defined at different locations, then moved to the same place with the ch
188 The GNU Troff Manual
request. In the following example, the many empty lines caused by the
bp request are not shown in the output.
.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]
The read-only register .t holds the distance to the next vertical position
trap. If there are no traps between the current position and the bottom of
the page, it contains the distance to the page bottom. Within a diversion,
in the absence of a diversion trap, this distance is the largest representable
integer in basic units—effectively infinite.
91
It may help to think of each trap location as maintaining a queue; wh operates on the
head of the queue, and ch operates on its tail. Only the trap at the head of the queue
is visible.
Chapter 5: GNU troff Reference 189
\n[.ne] [Register]
The read-only register .ne contains the amount of space that was needed
in the last ne request that caused a trap to be sprung; it is useful in
conjunction with the .trunc register. See Section 5.18 [Page Control],
page 128. Since the .ne register is set only by traps, it doesn’t make
sense to interpolate it outside of macros called by traps.
190 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 set only by traps, it doesn’t make sense to
interpolate it outside of macros called by traps.
\n[.pe] [Register]
This Boolean-valued, read-only register interpolates 1 while a page is
being ejected, and 0 otherwise.
In the following example, we plant the same trap at the top and the
bottom of the page. We also make the trap report its name and the
vertical drawing position.
.de T
.tm \\$0: page \\n%, nl=\\n[nl] .pe=\\n[.pe]
..
.ll 46n
.wh 0 T
.wh -1v T
Those who can make you believe absurdities can make you
commit atrocities. \[em] Voltaire
error T: page 1, nl=0 .pe=0
error T: page 1, nl=2600 .pe=1
⇒ Those who can make you believe absurdities can
⇒ make you commit atrocities. -- Voltaire
When designing macros, keep in mind that diversions and traps do nor-
mally interact. For example, if a trap calls 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.
This implicit page trap always exists in the top-level diversion;93 it works
like a trap in some ways but not others. Its purpose is to eject the current
page and start the next one. It has no name, so it cannot be moved or
deleted with wh or ch requests. You cannot hide it by placing another trap
at its location, and can move it only by redefining the page length with pl.
Its operation is suppressed when vertical page traps are disabled with GNU
troff’s vpt request.
Unlike the ce and rj requests, it counts lines interrupted with the \c es-
cape sequence separately (see Section 5.16 [Line Continuation], page 125);
itc does not. To see the difference, let’s change the previous example to
use itc instead.
...
. itc \\$2 ES
...
⇒ oblique face obliqueface (second ‘‘face” oblique)
You can think of the ce and rj requests as implicitly creating an input
line trap with itc that schedules a break when the trap is sprung.
.de BR
. br
. internal: disable centering-without-filling
..
.
.de ce
. if \\n[.br] .br
. itc \\$1 BR
. internal: enable centering-without-filling
..
Let us consider in more detail the sorts of input lines that are or are not
“productive”.
.de Trap
TRAP SPRUNG
..
.de Mac
.if r a \l'5n'
..
.it 2 Trap
.
foo
.Mac
bar
baz
.it 1 Trap
.sp \" moves, but does not write or draw
qux
.itc 1 Trap
\h'5n'\c \" moves, but does not write or draw
jat
When ‘Trap’ gets called depends on whether the ‘a’ register is defined;
the control line with the if request may or may not produce written out-
put. We also see that the spacing request sp, while certainly affecting
the output, does not spring the input line trap. Similarly, the horizontal
motion escape sequence \h also affected the output, but was not “writ-
Chapter 5: GNU troff Reference 193
ten”. Observe that we had to follow it with \c and use itc to prevent
the newline at the end of the text line from causing a word break, which,
like an ordinary space character, counts as written output.
$ groff -Tascii input-trap-example.groff
⇒ foo bar TRAP SPRUNG baz
⇒
⇒ qux TRAP SPRUNG jat TRAP SPRUNG
$ groff -Tascii -ra1 input-trap-example.groff
⇒ foo _____ TRAP SPRUNG bar baz
⇒
⇒ qux TRAP SPRUNG jat TRAP SPRUNG
Input line traps are associated with the environment (see Section 5.31
[Environments], page 203); switching to another environment suspends the
current input line trap, and going back resumes it, restoring the count of
qualifying lines enumerated in that environment.
94
While processing an end-of-input macro, the formatter assumes that the next page
break must be the last; it goes into “sudden death overtime”.
Chapter 5: GNU troff Reference 195
.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
This specific feature affects only the first potential page break caused by
the end-of-input macro; further page breaks emitted by the macro are
handled normally.
Another possible use of the em request is to make GNU troff emit a
single large page instead of multiple pages. For example, one may want
to produce a long plain text file for reading in a terminal or emulator
without page footers and headers interrupting the body of the document.
One approach is to set the page length at the beginning of the document
to a very large value to hold all the text,95 and automatically adjust it to
the exact height of the document after the text has been output.
.de adjust-page-length
. br
. pl \\n[nl]u \" \n[nl]: current vertical position
..
.
.de single-page-mode
. pl 99999
. em adjust-page-length
..
.
.\" Activate the above code if configured.
.if \n[do-continuous-rendering] \
. single-page-mode
95
Another, taken by the groff man macros, is to intercept ne requests and wrap bp ones.
196 The GNU Troff Manual
Since only one end-of-input trap exists and another macro package 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.29 Diversions
In roff systems it is possible to format text as if for output, but instead
of writing it immediately, one can divert the formatted text into a named
storage area. It is retrieved later by specifying its name after a control char-
acter. The same name space is used for such diversions as for strings and
macros; see Section 5.5 [Identifiers], page 81. Such text is sometimes said to
be “stored in a macro”, but this coinage obscures the important distinction
between macros and strings on one hand and diversions on the other; the
former store unformatted input text, and the latter capture formatted out-
put. Diversions also do not interpret arguments. Applications of diversions
include “keeps” (preventing a page break from occurring at an inconvenient
place by forcing a set of output lines to be set as a group), footnotes, tables
of contents, and indices. For orthogonality it is said that GNU troff is in
the top-level diversion if no diversion is active (that is, formatted output is
being “diverted” immediately to the output device).
Dereferencing an undefined diversion will create an empty one of that
name and cause a warning in category ‘mac’ to be emitted. See Section 5.37.1
[Warnings], page 221, for information about the enablement and suppression
of warnings. A diversion does not exist for the purpose of testing with the
d conditional operator until its initial definition ends (see Section 5.23.1
[Operators in Conditionals], page 160). The following requests are used to
create and alter diversions.
Apart from pending output line inclusion and the request names that
populate them, boxes are handled exactly as diversions are. All of the fol-
lowing groff language elements can be used with them interchangeably.
\n[.z] [Register]
\n[.d] [Register]
Diversions may be nested. The read-only string-valued register .z con-
tains the name of the current diversion. The read-only register .d contains
the current vertical place in the diversion. If the input text is not being
diverted, .d reports the same location as the register nl.
198 The GNU Troff Manual
\n[.h] [Register]
The read-only register .h stores 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.96
As implied by the example, vertical motion does not produce text base-
lines and thus does not increase the value interpolated by ‘\n[.h]’.
\n[dn] [Register]
\n[dl] [Register]
After completing a diversion, the writable registers dn and dl contain its
vertical and horizontal sizes. Only the lines just processed are counted:
for the computation of dn and dl, the requests da and boxa are handled
as if di and box had been used, respectively—lines that have been already
stored in the diversion (box) are not taken into account.
96
Thus, the “water” gets “higher” proceeding down the page.
Chapter 5: GNU troff Reference 199
.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
..
.ec
\!anything [Escape sequence]
\?anything\? [Escape sequence]
Transparently embed anything into the current diversion, preventing re-
quests, macro calls, and escape sequences from being interpreted when
read into a diversion. This is useful for preventing them from taking ef-
fect until the diverted text is actually output. The \! escape sequence
transparently embeds input up to and including the end of the line. The
\? escape sequence transparently embeds input until its own next occur-
rence.
anything may not contain newlines; use \! by itself to embed newlines in
a diversion. The escape sequence \? is also recognized in copy mode and
turned into a single internal code; it is this code that terminates anything.
Thus the following example prints 4.
.nr x 1
.nf
.di d
\?\\?\\\\?\\\\\\\\nx\\\\?\\?\?
.di
.nr x 2
.di e
.d
.di
.nr x 3
.di f
.e
.di
.nr x 4
.f
Both escape sequences read the data in copy mode.
200 The GNU Troff Manual
97
The backslash is doubled. See Section 5.24.2 [Copy Mode], page 173.
202 The GNU Troff Manual
.di xx
the
.ft I
interpolation system
.ft
.br
.di
.ds yy This is a test of \*(xx\c
\*(yy.
⇒ This is a test of the interpolation system.
As the previous example shows, it is possible to store formatted output
in strings. The \c escape sequence prevents the subsequent newline from
being interpreted as a break (again, see Section 5.16 [Line Continuation],
page 125).
Copying multi-output line diversions 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 AT&T 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,
preventing their adjustment. 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 adjustable again.
.box xxx
a funny
.br
test
.br
.box
.chop xxx
.unformat xxx
This is \*[xxx].
⇒ This is a funny test.
See Section 5.36 [Gtroff Internals], page 216.
Chapter 5: GNU troff Reference 203
5.31 Environments
As discussed in Section 5.27 [Deferring Output], page 185, environments
store most of the parameters that determine the appearance of text. A de-
fault environment named ‘0’ exists when GNU troff starts up; it is modified
by formatting-related requests and escape sequences.
You can create new environments and switch among them. Only one is
current at any given time. Active environments are managed using a stack,
a data structure supporting “push” and “pop” operations. The current
environment is at the top of the stack. The same environment name can
be pushed onto the stack multiple times, possibly interleaved with others.
Popping the environment stack does not destroy the current environment;
it remains accessible by name and can be made current again by pushing
it at any time. Environments cannot be renamed or deleted, and can only
be modified when current. To inspect the environment stack, use the pev
request; see Section 5.37 [Debugging], page 218.
Environments store the following information.
• a partially collected line, if any
• data about the most recently output glyph and line (registers .cdp,
.cht, .csk, .n, .w)
• typeface parameters (size, family, style, height and slant, inter-word and
inter-sentence space sizes)
• page parameters (line length, title length, vertical spacing, line spac-
ing, indentation, line numbering, centering, right-alignment, underlin-
ing, hyphenation parameters)
• filling enablement; adjustment enablement and mode
• tab stops; tab, leader, escape, control, no-break control, hyphenation,
and margin characters
• input line traps
• stroke and fill colors
.ev footnote-env
.fam N
.ps 6
.vs 8
.ll -.5i
.ev
...
.ev footnote-env
\[dg] Observe the smaller text and vertical spacing.
.ev
We can familiarize ourselves with stack behavior by wrapping the ev
request with a macro that reports the contents of the .ev register to the
standard error stream.
.de EV
. ev \\$1
. tm environment is now \\n[.ev]
..
.
.EV foo
.EV bar
.EV
.EV baz
.EV
.EV
.EV
error environment is now foo
error environment is now bar
error environment is now foo
error environment is now baz
error environment is now foo
error environment is now 0
error error: environment stack underflow
error environment is now 0
.evc environment [Request]
Copy the contents of environment to the current environment.
The following environment data are not copied.
• a partially collected line, if present;
• the interruption status of the previous input line (due to use of the
\c escape sequence);
• the count of remaining lines to center, to right-justify, or to underline
(with or without underlined spaces)—these are set to zero;
• the activation status of temporary indentation;
Chapter 5: GNU troff Reference 205
\n[.O] [Register]
Output suppression nesting level applied by \O3 and \O4 escape se-
quences.
5.33 I/O
gtroff has several requests for including files:
The situation is
.so xxx
bar.
⇒ The situation is foobar.
soquiet works the same way, except that no warning diagnostic is issued
if file does not exist.
.ev 1
.di x
.trf f
.di
.ev
The calls to ev prevent the partially collected output line from becoming
part of the diversion (see Section 5.29 [Diversions], page 196).
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. 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 GNU
troff to stop processing. If this were not there, troff would not know
when to stop.
Chapter 5: GNU troff Reference 209
Trent A. Fisher
708 NW 19th Av., #202
Portland, OR 97209
Dear Trent,
Len Adollar
4315 Sierra Vista
San Diego, CA 92103
.ex
98
that is, ISO 646:1991-IRV or, popularly, “US-ASCII”
212 The GNU Troff Manual
tions and special character definitions are ignored.99 The use of any other
escape sequence in \X parameters is normally an error.
If the use_charnames_in_special directive appears in the output de-
vice’s DESC file, the use of special character escape sequences is not
an error; they are simply output verbatim (with the exception of the
seven mapped to Unicode basic Latin characters, discussed above). use_
charnames_in_special is currently employed only by grohtml.
5.35 Miscellaneous
We document here GNU troff features that fit poorly elsewhere.
99
They are bypassed because these parameters are not rendered as glyphs in the output;
instead, they remain abstract characters—in a PDF bookmark or a URL, for example.
100
Recall Section 5.15 [Line Layout], page 122.
Chapter 5: GNU troff Reference 213
numbers wider than the allocated space protrude into the left margin, or
shift the output line to the right.
.po 5n
.ll 44n
Programming,
when stripped of all its circumstantial irrelevancies,
.nm 999 1 1 -4
boils down to no more and no less than
.nm +0 3
very effective thinking so as to avoid unmastered
.nn 2
complexity,
to very vigorous separation of your many
different concerns.
.br
\(em Edsger Dijkstra
.sp
.nm 1 1 1
This guy's arrogance takes your breath away.
.br
\(em John Backus
⇒ Programming, when stripped of all its cir-
⇒ 999 cumstantial irrelevancies, boils down to no
⇒ more and no less than very effective think-
⇒ ing so as to avoid unmastered complexity, to
⇒ very vigorous separation of your many dif-
⇒ ferent concerns.
⇒ 1002 -- Edsger Dijkstra
⇒
⇒ 1 This guy’s arrogance takes your breath away.
⇒ 2 -- John Backus
214 The GNU Troff Manual
.ll 5i
.nf
.mc \[br]
This paragraph is marked with a margin character.
.sp
As seen above, vertical space isn't thus marked.
\&
An output line that is present, but empty, is.
⇒ This paragraph is marked with a margin character. |
⇒
⇒ As seen above, vertical space isn’t thus marked. |
⇒ |
⇒ An output line that is present, but empty, is. |
For compatibility with AT&T troff, a call to mc to set the margin char-
acter can’t be undone immediately; at least one line gets a margin character.
.ll 10n
.nf
.mc |
.mc *
.mc
foo
bar
⇒ foo *
⇒ bar
The margin character mechanism is commonly used to annotate changes
in documents. The groff distribution ships a program, gdiffmk, to assist
with this task.101
102
Except the escape sequences \f, \F, \H, \m, \M, \R, \s, and \S, which are processed
immediately if not in copy mode.
Chapter 5: GNU troff Reference 217
by \x. The br request finishes the pending output line, inserting a newline
input token, which is subsequently converted to a space when the diversion is
reread. Note that the word space node has a fixed width that isn’t adjustable
anymore. To convert horizontal space nodes back to input tokens, use the
unformat request.
Macros only contain elements in the token list (and the node list is
empty); diversions and strings can contain elements in both lists.
The chop request simply reduces the number of elements in a macro,
string, or diversion by one. Exceptions are compatibility save and compat-
ibility ignore input tokens, which are ignored. The substring request also
ignores those input tokens.
Some requests like tr or cflags work on glyph identifiers only; this
means that the associated glyph can be changed without destroying this
association. This can be very helpful for substituting glyphs. In the following
example, we assume that glyph ‘foo’ isn’t available by default, so we provide
a substitution using the fchar request and map it to input character ‘x’.
.fchar \[foo] foo
.tr x \[foo]
Now let us assume that we install an additional special font ‘bar’ that has
glyph ‘foo’.
.special bar
.rchar \[foo]
Since glyphs defined with fchar are searched before glyphs in special fonts,
we must call rchar to remove the definition of the fallback glyph. Anyway,
the translation is still active; ‘x’ now maps to the real glyph ‘foo’.
Macro and request arguments preserve compatibility mode enablement.
.cp 1 \" switch to compatibility mode
.de xx
\\$1
..
.cp 0 \" switch compatibility mode off
.xx caf\[’e]
⇒ café
Since compatibility mode is enabled while de is invoked, the macro xx enables
compatibility mode when it is called. Argument $1 can still be handled
properly because it inherits the compatibility mode enablement status that
was active at the point where xx was called.
After interpolation of the parameters, the compatibility save and restore
tokens are removed.
218 The GNU Troff Manual
5.37 Debugging
Standard troff voodoo, just put a power of two backslashes in
front of it until it works and if you still have problems add a \c.
— Ron Natalie
GNU troff is not the easiest language to debug, in part thanks to its
design features of recursive interpolation and the use of multi-stage pipeline
processing in the surrounding system. Nevertheless there exist several fea-
tures useful for troubleshooting.
Preprocessors use the lf request to preserve the identity of the line num-
bers and names of input files. GNU troff emits a variety of error diagnostics
and supports several categories of warning; the output of these can be se-
lectively suppressed. A trace of the formatter’s input processing stack can
be emitted when errors or warnings occur by means of GNU troff’s -b
option, or produced on demand with the backtrace request. The tm and
related requests can be used to emit customized diagnostic messages or for
instrumentation while troubleshooting. The ex and ab requests cause early
termination with successful and error exit codes respectively, to halt further
processing when continuing would be fruitless. Examine the state of the for-
matter with requests that write lists of defined names (macros, strings, and
diversions), environments, registers, and page location traps to the standard
error stream.
.ex [Request]
Exit GNU troff; that is, stop processing and terminate with a successful
status. To stop processing only the current file, use the nx request; see
Section 5.33 [I/O], page 206.
.pev [Request]
Report the state of the current environment followed by that of all other
environments to the standard error stream.
.pm [Request]
Report, to the standard error stream, the names of all defined macros,
strings, and diversions with their sizes in bytes.
.pnr [Request]
Report the names and contents of all currently defined registers to the
standard error stream.
.ptr [Request]
Report the names and positions of all page location traps to the standard
error stream. Empty slots in the list, where a trap has been planted but
subsequently (re)moved, are printed as well.
.fl [Request]
Instruct gtroff to flush its output immediately. The intent is for inter-
active use, but this behaviour is currently not implemented in gtroff.
Contrary to Unix troff, TTY output is sent to a device driver also
(grotty), making it non-trivial to communicate interactively.
This request causes a line break.
.backtrace [Request]
Write the state of the input stack to the standard error stream.
Consider the following in a file test.
220 The GNU Troff Manual
.de xxx
. backtrace
..
.de yyy
. xxx
..
.
.yyy
error troff: backtrace: 'test':2: macro 'xxx'
error troff: backtrace: 'test':5: macro 'yyy'
error troff: backtrace: file 'test':8
The -b option of GNU troff causes a backtrace to be generated on each
error or warning. Some warnings have to be enabled; See Section 5.37.1
[Warnings], page 221.
\n[slimit] [Register]
If greater than 0, sets the maximum quantity of objects on GNU troff’s
internal input stack. If less than or equal to 0, there is no limit: recursion
can continue until program memory is exhausted. The default is 1,000.
.warnscale su [Request]
Set the scaling unit used in certain warnings to su, which can take the
values ‘u’, ‘i’, ‘c’, ‘p’, and ‘P’. The default is ‘i’.
.spreadwarn [limit] [Request]
Emit a break warning if the additional space inserted for each space
between words in an output line adjusted to both margins with ‘.ad b’
is larger than or equal to limit. A negative value is treated as zero; an
absent argument toggles the warning on and off without changing limit.
The default scaling unit is ‘m’. At startup, spreadwarn is inactive and
limit is 3 m.
For example,
.spreadwarn 0.2m
causes a warning if break warnings are not suppressed and gtroff must
add 0.2 m or more for each inter-word space in a line. See Section 5.37.1
[Warnings], page 221.
GNU troff has command-line options for reporting warnings (-w) and
backtraces (-b) when a warning or an error occurs.
.warn [n] [Request]
\n[.warn] [Register]
Select the categories, or “types”, of reported warnings. n is the sum of
the numeric codes associated with each warning category that is to be
enabled; all other categories are disabled. The categories and their asso-
ciated codes are listed in Section 5.37.1 [Warnings], page 221. For exam-
ple, ‘.warn 0’ disables all warnings, and ‘.warn 1’ disables all warnings
Chapter 5: GNU troff Reference 221
5.37.1 Warnings
Warning diagnostics emitted by GNU troff are divided into named, num-
bered categories. The name associated with each warning category is used
by the -w and -W options. Each category is also assigned a power of two; the
sum of enabled category values is used by the warn request and the .warn
register.
Warnings of each category are produced under the following circum-
stances.
‘char’
‘1’ No mounted font defines a glyph for the requested character.
This category is enabled by default.
‘number’
‘2’ An invalid numeric expression was encountered. This category
is enabled by default. See Section 5.4 [Numeric Expressions],
page 77.
‘break’
‘4’ A filled output line could not be broken such that its length
was less than the output line length ‘\n[.l]’. This category is
enabled by default.
‘delim’
‘8’ The closing delimiter in an escape sequence was missing or mis-
matched.
‘el’
‘16’ The el request was encountered with no prior corresponding ie
request. See Section 5.23.3 [if-else], page 163.
‘scale’
‘32’ A scaling unit inappropriate to its context was used in a numeric
expression.
‘range’
‘64’ A numeric expression was out of range for its context.
‘syntax’
‘128’ A self-contradictory hyphenation mode was requested; an empty
or incomplete numeric expression was encountered; an operand
to a numeric operator was missing; an attempt was made to
define a recursive, empty, or nonsensical character class; or a
groff extension conditional expression operator was used while
in compatibility mode.
222 The GNU Troff Manual
‘di’
‘256’ A di, da, box, or boxa request was invoked without an argument
when there was no current diversion.
‘mac’
‘512’ An undefined string, macro, or diversion was used. When such
an object is dereferenced, an empty one of that name is auto-
matically created. So, unless it is later deleted, at most one
warning is given for each.
This warning is also emitted upon an attempt to move an un-
planted trap macro (see Section 5.28.1.1 [Page Location Traps],
page 186). In such cases, the unplanted macro is not derefer-
enced, so it is not created if it does not exist.
‘reg’
‘1024’ An undefined register was used. When an undefined register is
dereferenced, it is automatically defined with a value of 0. So,
unless it is later deleted, at most one warning is given for each.
‘tab’
‘2048’ A tab character was encountered where a number was expected,
or appeared in an unquoted macro argument.
‘right-brace’
‘4096’ A right brace escape sequence \} was encountered where a num-
ber was expected.
‘missing’
‘8192’ A request was invoked with a mandatory argument absent.
‘input’
‘16384’ An invalid character occurred on the input stream.
‘escape’
‘32768’ An unsupported escape sequence was encountered.
‘space’
‘65536’ A space was missing between a request or macro and its argu-
ment. This warning is produced when an undefined name longer
than two characters is encountered and the first two characters
of the name constitute a defined name. No request is invoked, no
macro called, and an empty macro is not defined. This category
is enabled by default. It never occurs in compatibility mode.
‘font’
‘131072’ A non-existent font was selected, or the selection was ignored
because a font selection escape sequence was used after the out-
put line continuation escape sequence on an input line. This
category is enabled by default.
Chapter 5: GNU troff Reference 223
‘ig’
‘262144’ An invalid escape sequence occurred in input ignored using the
ig request. This warning category diagnoses a condition that is
an error when it occurs in non-ignored input.
‘color’
‘524288’ An undefined color was selected, an attempt was made to define
a color using an unrecognized color space, an invalid component
in a color definition was encountered, or an attempt was made
to redefine a default color.
‘file’
‘1048576’ An attempt was made to load a file that does not exist. This
category is enabled by default.
Two warning names group other warning categories for convenience.
‘all’ All warning categories except ‘di’, ‘mac’ and ‘reg’. This short-
hand is intended to produce all warnings that are useful with
macro packages written for AT&T troff and its descendants,
which have less fastidious diagnostics than GNU troff.
‘w’ All warning categories. Authors of documents and macro pack-
ages targeting groff are encouraged to use this setting.
in the range 4–39. Legacy documents relying upon this quirk of parsing103
should be migrated to another \s form.
103
The Graphic Systems C/A/T phototypesetter (the original device target for AT&T
troff) supported only a few discrete type sizes in the range 6–36 points, so Ossanna
contrived a special case in the parser to do what the user must have meant. Kernighan
warned of this in the 1992 revision of CSTR #54 (§2.3), and more recently, McIlroy
referred to it as a “living fossil”.
104
DWB 3.3, Solaris, Heirloom Doctools, and Plan 9 troff all support it.
Chapter 5: GNU troff Reference 227
would interpret them as escape characters when rereading them and end up
printing one ‘\’.
One correct way to obtain a printable backslash in most documents is to
use the \e escape sequence; this always prints a single instance of the current
escape character,105 regardless of whether or not it is used in a diversion; it
also works in both GNU troff and AT&T troff.
The other correct way, appropriate in contexts independent of the back-
slash’s common use as a troff escape character—perhaps in discussion of
character sets or other programming languages—is the character escape \(rs
or \[rs], for “reverse solidus”, from its name in the ECMA-6 (ISO/IEC 646)
standard.106
To store an escape sequence in a diversion that is interpreted when the
diversion is reread, either use the traditional \! transparent output facil-
ity, or, if this is unsuitable, the new \? escape sequence. See Section 5.29
[Diversions], page 196, and Section 5.36 [Gtroff Internals], page 216.
In the somewhat pathological case where a diversion exists containing a
partially collected line and a partially collected line at the top-level diversion
has never existed, AT&T troff will output the partially collected line at the
end of input; GNU troff will not.
105
Naturally, if you’ve changed the escape character, you need to prefix the e with what-
ever it is—and you’ll likely get something other than a backslash in the output.
106
The rs special character identifier was not defined in AT&T troff’s font description
files, but is in those of its lineal descendant, Heirloom Doctools troff, as of the latter’s
060716 release (July 2006).
229
6 File Formats
All files read and written by gtroff are text files. The following two sections
describe their format.
6.1.1.1 Separation
AT&T troff output has strange requirements regarding whitespace. The
gtroff output parser, however, is more tolerant, making whitespace max-
imally optional. Such characters, i.e., the tab, space, and newline, 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 span several input 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.
commands for positioning and text writing. These commands are tolerant
of whitespace. Optionally, syntactical space can be inserted before, after, and
between the command letter and its arguments. All of these commands are
stackable; i.e., they can be preceded by other simple commands or followed
by arbitrary other commands on the same line. A separating syntactical
space is necessary only when two integer arguments would clash or if the
preceding argument ends with a string argument.
C idwhitespace
Typeset the glyph of the special character id. Trailing syntacti-
cal space is necessary to allow special character names of arbi-
trary length. The drawing position is not advanced.
cg Typeset the glyph of the ordinary character c. The drawing
position is not advanced.
fn Select the font mounted at position n. n cannot be negative.
Hn Horizontally move the drawing position to n basic units from
the left edge of the page. n cannot be negative.
hn Move the drawing position right n basic units. AT&T troff
allowed negative n; GNU troff does not produce such values,
but groff’s output driver library handles them.
m color-scheme [component ...]
Select the stroke color using the components in the color space
scheme. Each component is an integer between 0 and 65535.
The quantity of components and their meanings vary with each
scheme. This command is a groff extension.
mc cyan magenta yellow
Use the CMY color scheme with components cyan,
magenta, and yellow.
md Use the default color (no components; black in most
cases).
mg gray Use a grayscale color scheme with a component
ranging between 0 (black) and 65535 (white).
mk cyan magenta yellow black
Use the CMYK color scheme with components cyan,
magenta, yellow, and black.
mr red green blue
Use the RGB color scheme with components red,
green, and blue.
Nn Typeset the glyph with index n in the current font. n is normally
a non-negative integer. The drawing position is not advanced.
The html and xhtml devices use this command with negative n
Chapter 6: File Formats 233
Dc dline break
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 vline break
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 vline break
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.
DFdline break
Set fill color for solid drawing objects to the default
fill color value (black in most cases). No component
arguments.
Dt nline break
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 type 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.
x T ps
x res 72000 1 1
x init
p1
x font 5 TR
f5
s10000
V12000
H72000
240 The GNU Troff Manual
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
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.
Chapter 6: File Formats 241
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.
• The argument of the commands ‘s’ and ‘x H’ has the implicit unit scaled
point ‘z’ in gtroff, while AT&T troff has point (‘p’). This isn’t an
incompatibility but a compatible extension, for both units coincide for
all devices without a sizescale parameter in the DESC file, including
all postprocessors from AT&T and groff’s text devices. The few groff
devices with a sizescale parameter either do not exist for AT&T troff,
have a different name, or seem to have a different resolution. So conflicts
are very unlikely.
• The position changing after the commands ‘Dp’, ‘DP’, and ‘Dt’ is illogical,
but as old versions of gtroff used this feature it is kept for compatibility
reasons.
may extend over more than one line. A font name of 0 causes
no font to be mounted at the corresponding position.
hor n The horizontal motion quantum is n basic units. All horizontal
quantities are rounded to multiples of n.
image_generator program
Use 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. The grohtml
driver uses this directive.
paperlength n
The vertical dimension of the output medium is n basic units
(deprecated: use papersize instead).
papersize format-or-dimension-pair-or-file-name . . .
The dimensions of the output medium are as according to the
argument, which is either a standard paper format, a pair of
dimensions, or the name of a plain text file containing either of
the foregoing.
Recognized paper formats are the ISO and DIN formats A0–
A7, B0–B7, C0–C7, D0–D7; the U.S. paper types letter, legal,
tabloid, ledger, statement, and executive; and the enve-
lope formats com10, monarch, and DL. Matching is performed
without regard for lettercase.
Alternatively, the argument can be a custom paper format in
the format length,width (with no spaces before or after the
comma). Both length and width must have a unit appended;
valid units are ‘i’ for inches, ‘c’ for centimeters, ‘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.
Finally, the argument can be a file name (e.g., /etc/papersize);
if the file can be opened, the first line is read and a match
attempted against each of the other forms. No comment syntax
is supported.
More than one argument can be specified; each is scanned in
turn and the first valid paper specification used.
paperwidth n
The horizontal dimension of the output medium is n basic units
(deprecated: use papersize instead).
pass_filenames
Direct GNU troff to emit the name of the source file being pro-
cessed. This is achieved with the intermediate output command
‘x F’, which grohtml interprets.
244 The GNU Troff Manual
postpro program
Use program as the postprocessor.
prepro program
Use program as a preprocessor. The html and xhtml output
devices use this directive.
print program
Use program as a spooler program for printing. If omitted, the
-l and -L options of groff are ignored.
res n The device resolution is n basic units per inch.
sizes s1 . . . sn 0
The device has fonts at s1, . . . , sn scaled points (see below).
The list of sizes must be terminated by 0. Each si can also be a
range of sizes m–n. The list can extend over more than one line.
sizescale n
A typographical point is subdivided into n scaled points. The
default is 1. See Section 5.20.3 [Using Fractional Type Sizes],
page 152.
styles S1 . . . Sm
The first m mounting positions are associated with styles S1,
. . . , Sm.
tcommand The postprocessor can handle the ‘t’ and ‘u’ intermediate output
commands.
unicode The output device supports the complete Unicode repertoire.
This directive is useful only for devices that produce character
entities 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 font description file’s
charset section, they either override the default mappings for
those particular characters or add new mappings (normally for
composite characters).
The utf8, html, and xhtml output devices use this directive.
unitwidth n
Quantities in the font description files are in basic units for fonts
whose type size is n scaled points.
unscaled_charwidths
Make the font handling module always return unscaled character
widths. The grohtml driver uses this directive.
use_charnames_in_special
GNU troff should encode special characters inside device
control commands; see Section 5.34 [Postprocessor Access],
page 211. The grohtml driver uses this directive.
Chapter 6: File Formats 245
vert n The vertical motion quantum is n basic units. All vertical quan-
tities are rounded to multiples of n.
charset This line and everything following it in the file are ignored. It is
recognized for compatibility with other troff implementations.
In GNU troff, character set repertoire is described on a per-
font basis.
GNU troff recognizes but ignores the directives spare1, spare2, and
biggestfont.
The res, unitwidth, fonts, and sizes lines are mandatory. Directives
not listed above are ignored by GNU troff but may be used by postproces-
sors to obtain further information about the device.
are not required to fit into the C language data type ‘char’ as they are in
AT&T device-independent troff.
The width subfield gives the width of the glyph. The height subfield
gives the height of the glyph (upward 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
below the baseline to which the glyph extends (downward is positive); if a
glyph does not extend below the baseline, it should be given a zero depth,
rather than a negative depth. Italic corrections are relevant to glyphs in
italic or oblique styles. The italic-correction is the amount of space that
should be added after an oblique glyph to be followed immediately by an
upright glyph. The left-italic-correction is the amount of space that should
be added before an oblique glyph to be preceded immediately by an upright
glyph. The subscript-correction is the amount of space that should be added
after an oblique glyph to be followed by a subscript; it should be less than
the italic correction.
For fonts used with typesetting devices, the type field gives a featural
description of the glyph: it is a bit mask recording whether the glyph is
an ascender, descender, both, or neither. When a \w escape sequence is
interpolated, these values are bitwise or-ed together for each glyph and stored
in the nr register. In font descriptions for terminal devices, all glyphs might
have a type of zero, regardless of their appearance.
0 means the glyph lies entirely between the baseline and a hori-
zontal line at the “x-height” of the font; typical examples are
‘a’, ‘c’, and ‘x’;
1 means the glyph descends below the baseline, like ‘p’;
2 means the glyph ascends above the font’s x-height, like ‘A’ or
‘b’; and
3 means the glyph is both an ascender and a descender—this is
true of parentheses in some fonts.
The code field gives a numeric identifier that the postprocessor uses to
render the glyph. The glyph can be specified to troff using this code by
means of the \N escape sequence. code can be any integer.6
The entity-name field defines an identifier for the glyph that the postpro-
cessor uses to print the GNU troff glyph name. This field is optional; it
was introduced so that the grohtml output driver could encode its character
set. For example, the glyph ‘\[Po]’ is represented by ‘£’ in HTML
4.0. For efficiency, these data are now compiled directly into grohtml. grops
uses the field to build sub-encoding arrays for PostScript fonts containing
more than 256 glyphs. Anything on the line after the entity-name field or
‘--’ is ignored.
6
that is, any integer parsable by the C standard library’s strtol(3) function
248 The GNU Troff Manual
A D
ab. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 da. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
ad. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 de. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
af . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 de1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
aln. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 defcolor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
als . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 dei . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
am. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 dei1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
am1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
ami . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 devicem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
ami1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 di. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
as. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 do. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
as1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 ds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28, 156
asciify . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 ds1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
dt. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
B E
backtrace. . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
bd. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 ec . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
blm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 ecr. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 ecs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
boxa . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 el. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
bp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 em. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
br. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 eo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
break . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 ev. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
brp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 evc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
ex. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
C F
c2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 fam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
cc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 fc. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
ce. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 fchar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
cf. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 fcolor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
cflags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 fi. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
ch. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 fl. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
char . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 fp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
chop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 fschar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 fspecial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
close . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 ft. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 ftr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
composite. . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 fzoom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
continue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
cp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
cs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 G
cu. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 gcolor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
260 The GNU Troff Manual
H N
hc. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 na. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
hcode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 ne. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
hla . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 nf. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
hlm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 nh. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
hpf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 nm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
hpfa . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 nn. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
hpfcode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 nop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
hw. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 nr . . . . . . . . . . . . . . . . . . . . . . . . . . 28, 92, 93, 95
hy. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 nroff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
hym . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 ns. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
hys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 nx. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
O
I open . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
ie. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 opena . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
if. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 os. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
ig . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
in. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
it. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
itc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 P
pc. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
pev . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
K pi. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
kern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 pl. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
pm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
pn. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
pnr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
L po. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
lc. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 ps. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 psbb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
lf. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 pso . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
lg. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 ptr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
linetabs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 pvs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
ll. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
ls. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
lsm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 R
lt. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 rchar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
rd. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
return . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
M rfschar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
rj. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
mc. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 rm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
mk. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 rn. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
mso . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 rnn. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
msoquiet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 rr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
rs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
rt. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Appendix B: Request Index 261
S tm1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
schar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 tmc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
shc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 tr. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
shift . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 trf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
sizes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 trin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
so. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 trnt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
soquiet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 troff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
sp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
special . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
spreadwarn . . . . . . . . . . . . . . . . . . . . . . . . . . 220
U
ss. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 uf. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
stringdown . . . . . . . . . . . . . . . . . . . . . . . . . . 159 ul. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
stringup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 unformat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
sty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
substring. . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
sv. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 V
sy. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 vpt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
vs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
T
ta. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 W
tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 warn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
taga . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 warnscale. . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
tc. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 wh. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
ti. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 while . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
tkf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
tl. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 writec . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
tm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 writem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
263
! /
! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 / . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
% :
% . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
& ;
& . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 ; . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
( <
( . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
< . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
<= . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
) <? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
=
* = . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
== . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
+ >
+ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
+ (unary) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 >= . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
>? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
–
- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 |
- (unary) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 | . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
267
$ .int . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
$$ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 .j. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
.k. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
.kern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
% .l. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
.lg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
% . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127, 128
.linetabs. . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
.ll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
. .lt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
.L. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
.$. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
.m. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
.a. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
.M. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
.A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
.n. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
.b. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
.br. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 .ne . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
.c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 .nm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
.cdp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 .nn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
.ce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 .ns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
.cht . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 .o. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
.color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 .O. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
.cp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 .p. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
.csk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 .pe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
.C. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 .pn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
.d. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 .ps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
.ev . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 .psr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
.f. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 .pvs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
.fam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 .P . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
.fn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 .rj . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
.fp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 .R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
.F . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 .s. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
.g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 .slant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
.h. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 .sr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
.height . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 .ss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
.hla . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 .sss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
.hlc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 .sty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
.hlm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 .t. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
.hy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 .tabs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
.hym . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 .trunc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
.hys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 .T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 .u. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
.i. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 .U . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
.in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 .v. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
268 The GNU Troff Manual
.vpt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 L
.V . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 LL [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
.w. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 llx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
.warn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 lly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
.x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 ln. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
.y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 lsn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
.Y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 lss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
.z. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 LT [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
.zoom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
C M
c. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 MINGW [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
ct. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 minutes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
mo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
D
DD [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
N
DI [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 nl. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
dl. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
dn. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
dw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 O
dy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
opmaxx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
opmaxy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
opminx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
F opminy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
FF [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
FI [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
FM [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 P
FPD [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
PD [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
FPS [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
PI [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
FVS [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
PO [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
PORPHANS [ms] . . . . . . . . . . . . . . . . . . . . . . . . . 30
PS [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
G PSINCR [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
GROWPS [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
GS [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Q
QI [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
H
HM [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
HORPHANS [ms] . . . . . . . . . . . . . . . . . . . . . . . . . 31 R
hours . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
hp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 rsb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
HY [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 rst . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
Appendix E: Register Index 269
S U
sb. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 urx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
seconds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 ury . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
skw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
slimit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
ssc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 V
st. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 VS [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
systat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
Y
T year . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
TC-MARGIN [ms] . . . . . . . . . . . . . . . . . . . . . . . . 33 yr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
271
[ D
[ [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 DA [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
De [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
DE [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
] Ds [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
DS [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
] [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
E
1 EE [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
1C [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 EF [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
EH [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
EN [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
2 EQ [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
EX [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
2C [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
A F
FE [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
AB [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 FS [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
AE [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
AI [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
AM [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 G
AU [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
G [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
GL [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
B
B [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 H
B1 [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
HB [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
B2 [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
BD [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
BI [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
BT [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 I
BX [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 I [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
ID [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
IP [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
C
CD [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
CT [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
K
CW [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 KE [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
CW [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 KF [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
KS [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
272 The GNU Troff Manual
L R
LD [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 R [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
LG [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 R [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
LP [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 RD [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
RE [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
RN [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
RP [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
M RS [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
MC [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
MS [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
S
SH [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
N SM [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
ND [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
NE [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 T
NH [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 TA [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
NL [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 TB [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
NT [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 TC [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
TE [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
TL [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
O TS [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
OF [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
OH [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 U
UL [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
P
P1 [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 V
PE [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 VE [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
PF [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 VS [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Pn [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
PN [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
PP [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 X
PS [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 XA [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
PT [man] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 XE [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
PX [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 XH [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
XH-REPLACEMENT [ms] . . . . . . . . . . . . . . . . . . . 55
XH-UPDATE-TOC [ms] . . . . . . . . . . . . . . . . . . . . 55
XN [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Q XN-INIT [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
QE [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 XN-REPLACEMENT [ms] . . . . . . . . . . . . . . . . . . . 55
QP [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 XP [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
QS [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 XS [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
273
! ^
! [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 ^ [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
’
' [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 _ [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
* ‘
* [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
` [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
,
, [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59, 60 {
{ [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
–
- [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
}
. } [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
. [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
.T. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
~
~ [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59, 60
/
/ [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
3
: 3 [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
: [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
< 8
8 [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
< [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
> A
> [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 ABSTRACT [ms] . . . . . . . . . . . . . . . . . . . . . . . . . 51
Ae [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
ae [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
?
? [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
274 The GNU Troff Manual
C O
C [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 o [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
CF [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 oe [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
CH [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 OE [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
D Q
q [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
d- [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 Q [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
D- [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
R
F REFERENCES [ms] . . . . . . . . . . . . . . . . . . . . . . . 51
FAM [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 RF [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
FR [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 RH [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
L S
SN [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
LF [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 SN-DOT [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
LH [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 SN-NO-DOT [ms] . . . . . . . . . . . . . . . . . . . . . . . . 39
SN-STYLE [ms] . . . . . . . . . . . . . . . . . . . . . . 31, 39
M
MONTH1 [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
T
MONTH10 [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 Th [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
MONTH11 [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 th [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
MONTH12 [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 TOC [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
MONTH2 [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
MONTH3 [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
MONTH4 [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
U
MONTH5 [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 U [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
MONTH6 [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
MONTH7 [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
MONTH8 [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 V
MONTH9 [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 v [ms]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
275
# P
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242, 245 paperlength . . . . . . . . . . . . . . . . . . . . . . . . . 243
papersize. . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
paperwidth . . . . . . . . . . . . . . . . . . . . . . . . . . 243
– pass_filenames . . . . . . . . . . . . . . . . . . . . . . 243
--- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 postpro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
prepro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
print . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
B
biggestfont . . . . . . . . . . . . . . . . . . . . . . . . . 245
R
C res . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
charset . . . . . . . . . . . . . . . . . . . . . . . . . 245, 246
S
F sizes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
sizescale. . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
family . . . . . . . . . . . . . . . . . . . . . . . . . . 131, 242
slant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
fonts . . . . . . . . . . . . . . . . . . . . . . . 135, 144, 242
spacewidth . . . . . . . . . . . . . . . . . . . . . . . . . . 245
spare1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
H spare2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
special . . . . . . . . . . . . . . . . . . . . . . . . . 146, 246
hor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 styles . . . . . . . . . . . . . . . . . . . . . 131, 134, 244
I
image_generator . . . . . . . . . . . . . . . . . . . . . 243
T
tcommand . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
K
kernpairs. . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
U
unicode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
unitwidth. . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
L unscaled_charwidths . . . . . . . . . . . . . . . . 244
ligatures. . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 use_charnames_in_special. . . . . . 212, 244
N V
name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 vert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
277
A J
an.tmac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 ja.tmac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
C L
changebar. . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 latin1.tmac . . . . . . . . . . . . . . . . . . . . . . . . . . 70
composite.tmac . . . . . . . . . . . . . . . . . . . . . . 139 latin2.tmac . . . . . . . . . . . . . . . . . . . . . . . . . . 71
cp1047.tmac . . . . . . . . . . . . . . . . . . . . . . . . . . 70 latin5.tmac . . . . . . . . . . . . . . . . . . . . . . . . . . 71
cs.tmac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 latin9.tmac . . . . . . . . . . . . . . . . . . . . . . . . . . 71
D M
de.tmac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 makeindex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
DESC . . . . . . . . . . . . . . 131, 134, 135, 139, 144 man.local . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
diffmk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 man.tmac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
man.ultrix . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
E N
ec.tmac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
nrchbar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
en.tmac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
eqn. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
P
papersize.tmac . . . . . . . . . . . . . . . . . . . . . . . 13
F perl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
fr.tmac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 pic. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
freeeuro.pfa . . . . . . . . . . . . . . . . . . . . . . . . . 71 post-grohtml . . . . . . . . . . . . . . . . . . . . . . . . . . 9
pre-grohtml . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
preconv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
G
gchem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
gdiffmk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 R
geqn. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 refer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
ggrn. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
gpic. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
grap. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 S
grefer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 soelim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
groff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 sv.tmac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
gsoelim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
gtbl. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
gtroff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 T
tbl. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
trace.tmac . . . . . . . . . . . . . . . . . . . . . . . . . . 170
I troffrc . . . . . . . . . . . . . . 8, 13, 110, 111, 121
it.tmac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 troffrc-end . . . . . . . . . . . . . . . . . . 8, 111, 121
tty.tmac . . . . . . . . . . . . . . . . . . . . . . . . 122, 123
278 The GNU Troff Manual
V
vtroff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
Z
zh.tmac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
279
" .
", as delimiter . . . . . . . . . . . . . . . . . . . . . . . . . 89 ., as delimiter . . . . . . . . . . . . . . . . . . . . . . . . . 90
", at end of sentence . . . . . . . . . . . . . . 65, 140 .h register, difference from nl . . . . . . . . 198
", embedding in a macro argument . . . . 86 .ps register, in
comparison with .psr . . . . . . . . . . . . . . 153
.s register, in comparison with .sr . . . 153
% .S register, Plan 9 alias for .tabs . . . . . 117
.t register, and diversions . . . . . . . . . . . . 191
%, as delimiter . . . . . . . . . . . . . . . . . . . . . . . . . 90
.tabs register, Plan 9 alias (.S) . . . . . . 117
.V register, and vs . . . . . . . . . . . . . . . . . . . 151
&
&, as delimiter . . . . . . . . . . . . . . . . . . . . . . . . . 90 /
/, as delimiter . . . . . . . . . . . . . . . . . . . . . . . . . 90
’
', as a comment . . . . . . . . . . . . . . . . . . . . . . . 91 :
', as delimiter . . . . . . . . . . . . . . . . . . . . . . . . . 89
:, as delimiter . . . . . . . . . . . . . . . . . . . . . . . . . 90
', at end of sentence . . . . . . . . . . . . . . 65, 140
( <
<, as delimiter . . . . . . . . . . . . . . . . . . . . . . . . . 90
(, as delimiter . . . . . . . . . . . . . . . . . . . . . . . . . 90
=
) =, as delimiter . . . . . . . . . . . . . . . . . . . . . . . . . 90
), as delimiter . . . . . . . . . . . . . . . . . . . . . . . . . 90
), at end of sentence . . . . . . . . . . . . . . 65, 140
>
>, as delimiter . . . . . . . . . . . . . . . . . . . . . . . . . 90
*
*, as delimiter . . . . . . . . . . . . . . . . . . . . . . . . . 90
*, at end of sentence . . . . . . . . . . . . . . 65, 140 [
[, macro names starting
+ with, and refer . . . . . . . . . . . . . . . . . . . . . 82
size of word space register (.ss) . . . . . . 105 special request, and glyph
size, optical, of a font . . . . . . . . . . . . . . . . . 132 search order . . . . . . . . . . . . . . . . . . . . . . . . 135
size, paper. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 spline, drawing (‘\D'~ ...'’) . . . . . . . . . 183
size, size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 springing a trap . . . . . . . . . . . . . . . . . . . . . . 186
sizes, fractional . . . . . . . . . . . . . . . . . . . . . . . 227 sqrtex glyph, and cflags . . . . . . . . . . . . 140
sizes, fractional type . . . . . . . . . . . . . . . . . . 152 ss request, incompatibilities
skew, of last glyph (.csk) . . . . . . . . . . . . 205 with AT&T troff . . . . . . . . . . . . . . . . . . 227
slant, font, changing (\S) . . . . . . . . . . . . . 145 stack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
soft hyphen character, setting (shc) . . . 107 stacking glyphs (\b) . . . . . . . . . . . . . . . . . . 184
soft hyphen glyph (hy) . . . . . . . . . . . . . . . 107 standard input, reading from (rd) . . . . 208
solid circle, drawing (‘\D'C ...'’) . . . . . 183 stderr, printing to (tm, tm1, tmc) . . . . . . 218
solid ellipse, drawing (‘\D'E ...'’) . . . . 183 stops, tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
solid polygon, drawing (‘\D'P ...'’) . . 183 string arguments . . . . . . . . . . . . . . . . . . . . . 156
SOURCE_DATE_EPOCH, string comparison . . . . . . . . . . . . . . . . . . . . 162
environment variable . . . . . . . . . . . . . . . . 12 string expansion (\*) . . . . . . . . . . . . . . . . . 156
sp request, and no-space mode. . . . . . . . 115 string interpolation (\*) . . . . . . . . . . . . . . 156
sp request, causing implicit break . . . . . . 99 string, appending (as) . . . . . . . . . . . . . . . . 158
space between sentences . . . . . . . . . . . . . . . 64 string, creating alias for (als) . . . . . . . . 159
space between sentences string, length of (length) . . . . . . . . . . . . . 158
register (.sss) . . . . . . . . . . . . . . . . . . . . . 105 string, removing (rm) . . . . . . . . . . . . . . . . . 159
space between words register (.ss) . . . 105 string, removing alias for (rm) . . . . . . . . 160
space character, as delimiter . . . . . . . . . . . 90 string, renaming (rn) . . . . . . . . . . . . . . . . . 159
space characters, in expressions . . . . . . . . 80 strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
space, between sentences . . . . . . . . . . . . . 105 strings [ms] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
space, between words . . . . . . . . . . . . . . . . . 105 strings, multi-line. . . . . . . . . . . . . . . . . . . . . 157
space, discardable, horizontal . . . . . . . . . 105 strings, shared name space with
space, hair (\^). . . . . . . . . . . . . . . . . . . . . . . 179 macros and diversions . . . . . . . . . . . . . . . 83
space, horizontal (\h) . . . . . . . . . . . . . . . . . 178 stripping final newline in diversions . . . 202
space, horizontal, unformatting . . . . . . . 202 stroke color . . . . . . . . . . . . . . . . . . . . . . . . . . 154
space, thin (\|) . . . . . . . . . . . . . . . . . . . . . . 179 stroke color name register (.m) . . . . . . . . 155
space, unbreakable (\~) . . . . . . . . . . . . . . . 100 stroked circle, drawing (‘\D'c ...'’) . . 183
space, unbreakable and stroked ellipse, drawing
unadjustable (\SP) . . . . . . . . . . . . . . . . . 179 (‘\D'e ...'’) . . . . . . . . . . . . . . . . . . . . . . . 183
space, vertical, unit (v) . . . . . . . . . . . . . . . . 75 stroked polygon, drawing
space, width of a digit (‘\D'p ...'’) . . . . . . . . . . . . . . . . . . . . . . . 183
(numeral) (\0) . . . . . . . . . . . . . . . . . . . . . 179 structuring source code of documents
spaces with ds. . . . . . . . . . . . . . . . . . . . . . . . 157 or macro packages . . . . . . . . . . . . . . . . . . . 85
spaces, in a macro argument . . . . . . . . . . . 86 sty request, and changing fonts . . . . . . . 131
spaces, leading and trailing . . . . . . . . . . . . 66 sty request, and font translations . . . . . 132
spacing (introduction) . . . . . . . . . . . . . . . . . 16 style, font . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
spacing, manipulating . . . . . . . . . . . . . . . . 112 style, font, abstract . . . . . . . . . . . . . . . . . . . 130
spacing, vertical . . . . . . . . . . . . . . . . . . 74, 150 style, font, abstract,
spacing, vertical (introduction) . . . . . . . . 16 setting up (sty) . . . . . . . . . . . . . . . . . . . . 134
special characters . . . . . . . . . . . . . . . . . 65, 120 styles, font . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
special characters [ms] . . . . . . . . . . . . . . . . . 59 substring (substring) . . . . . . . . . . . . . . . . 158
special characters, list of subtraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
(groff char(7) man page) . . . . . . . . . . . 136 suppressing output (\O) . . . . . . . . . . . . . . 205
special font . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 suppression nesting level register . . . . . . 206
special fonts . . . . . . . . . . . . . . . . 135, 144, 246 sv request, and no-space mode. . . . . . . . 129
special fonts, emboldening . . . . . . . . . . . . 146 switching environments (ev) . . . . . . . . . . 203
special request, and font sy request, and safer mode . . . . . . . . . . . . . . 9
translations . . . . . . . . . . . . . . . . . . . . . . . . 132 sy request, disabled by default . . . . . . . . 223
Appendix J: Concept Index 299