This section describes all intermediate output commands, the
classical commands as well as the groff extensions.
Comment command
#
anything⟨end-of-line⟩
A comment. Ignore any characters from the #
character up
to the next newline character.
This command is the only possibility for commenting in the
intermediate output. Each comment can be preceded by arbitrary
syntactical space; every command can be terminated by a comment.
Simple commands
The commands in this subsection have a command code consisting of
a single character, taking a fixed number of arguments. Most of
them are commands for positioning and text writing. These
commands are smart about 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 only necessary when two integer arguments
would clash or if the preceding argument ends with a string
argument.
C
xxx⟨white-space⟩
Print a glyph (special character) named xxx. The trailing
syntactical space or line break is necessary to allow
glyph names of arbitrary length. The glyph is printed at
the current print position; the glyph's size is read from
the font file. The print position is not changed.
c
c Print glyph with single-letter name c at the current print
position; the glyph's size is read from the font file.
The print position is not changed.
f
n Set font to font number n (a non-negative integer).
H
n Move right to the absolute vertical position n (a non-
negative integer in basic units u
) relative to left edge
of current page.
h
n Move n (a non-negative integer) basic units u
horizontally
to the right. [CSTR #54] allows negative values for n
also, but groff doesn't use this.
m
color-scheme [component ...]
Set the color for text (glyphs), line drawing, and the
outline of graphic objects using different color schemes;
the analogous command for the filling color of graphic
objects is DF
. The color components are specified as
integer arguments between 0 and 65536. The number of
color components and their meaning vary for the different
color schemes. These commands are generated by the groff
escape sequence \m
. No position changing. These commands
are a groff extension.
mc
cyan magenta yellow
Set color using the CMY color scheme, having the
3 color components cyan, magenta, and yellow.
md
Set color to the default color value (black in most
cases). No component arguments.
mg
gray
Set color to the shade of gray given by the
argument, an integer between 0 (black) and 65536
(white).
mk
cyan magenta yellow black
Set color using the CMYK color scheme, having the
4 color components cyan, magenta, yellow, and
black.
mr
red green blue
Set color using the RGB color scheme, having the
3 color components red, green, and blue.
N
n Print glyph with index n (an integer, normally non-
negative) of the current font. The print position is not
changed. If -T html
or -T xhtml
is used, negative values
are emitted also to indicate an unbreakable space with
given width. For example, N -193
represents an
unbreakable space which has a width of 193u. This command
is a groff extension.
n
b a Inform the device about a line break, but no positioning
is done by this command. In classical troff, the integer
arguments b and a informed about the space before and
after the current line to make the intermediate output
more human readable without performing any action. In
groff, they are just ignored, but they must be provided
for compatibility reasons.
p
n Begin a new page in the outprint. The page number is set
to n. This page is completely independent of pages
formerly processed even if those have the same page
number. The vertical position on the outprint is
automatically set to 0. All positioning, writing, and
drawing is always done relative to a page, so a p
command
must be issued before any of these commands.
s
n Set point size to n scaled points (this is unit z
in GNU
troff
). Classical troff used the unit points (p
) instead;
see section 'Compatibility' below.
t
xyz...⟨white-space⟩
t
xyz... dummy-arg⟨white-space⟩
Print a word, i.e., a sequence of glyphs with single-
letter names x, y, z, etc., terminated by a space
character or a line break; an optional second integer
argument is ignored (this allows the formatter to generate
an even number of arguments). The first glyph should be
printed at the current position, the current horizontal
position should then be increased by the width of the
first glyph, and so on for each glyph. The widths of the
glyph are read from the font file, scaled for the current
point size, and rounded to a multiple of the horizontal
resolution. Special characters (glyphs with names longer
than a single letter) cannot be printed using this
command; use the C
command for those glyphs. This command
is a groff extension; it is only used for devices whose
DESC file contains the tcommand
keyword; see
groff_font(5).
u
n xyz...⟨white-space⟩
Print word with track kerning. This is the same as the t
command except that after printing each glyph, the current
horizontal position is increased by the sum of the width
of that glyph and n (an integer in basic units u
). This
command is a groff extension; it is only used for devices
whose DESC file contains the tcommand
keyword; see
groff_font(5).
V
n Move down to the absolute vertical position n (a non-
negative integer in basic units u
) relative to upper edge
of current page.
v
n Move n basic units u
down (n is a non-negative integer).
[CSTR #54] allows negative values for n also, but groff
doesn't use this.
w
Describe an adjustable space. This performs no action; it
is present for documentary purposes. The spacing itself
must be performed explicitly by a move command.
Graphics commands
Each graphics or drawing command in the intermediate output
starts with the letter D
followed by one or two characters that
specify a subcommand; this is followed by a fixed or variable
number of integer arguments that are separated by a single space
character. A D
command may not be followed by another command on
the same line (apart from a comment), so each D
command is
terminated by a syntactical line break.
troff
output follows the classical spacing rules (no space
between command and subcommand, all arguments are preceded by a
single space character), but the parser allows optional space
between the command letters and makes the space before the first
argument optional. As usual, each space can be any sequence of
tab and space characters.
Some graphics commands can take a variable number of arguments.
In this case, they are integers representing a size measured in
basic units u
. The h arguments stand for horizontal distances
where positive means right, negative left. The v arguments stand
for vertical distances where positive means down, negative up.
All these distances are offsets relative to the current location.
Unless indicated otherwise, each graphics command directly
corresponds to a similar groff \D
escape sequence; see groff(7).
Unknown D
commands are assumed to be device-specific. Its
arguments are parsed as strings; the whole information is then
sent to the postprocessor.
In the following command reference, the syntax element ⟨line-
break⟩ means a syntactical line break as defined in subsection
'Separation' above.
D~
h1 v1 h2 v2 ... hn vn⟨line-break⟩
Draw B-spline from current position to offset (h1, v1),
then to offset (h2, v2) if given, etc., up to (hn, vn).
This command takes a variable number of argument pairs;
the current position is moved to the terminal point of the
drawn curve.
Da
h1 v1 h2 v2⟨line-break⟩
Draw arc from current position to (h1, v1)+(h2, v2) with
center at (h1, v1); then move the current position to the
final point of the arc.
DC
d⟨line-break⟩
DC
d dummy-arg⟨line-break⟩
Draw a solid circle using the current fill color 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. An optional second
integer argument is ignored (this allows the formatter to
generate an even number of arguments). This command is a
groff extension.
Dc
d⟨line-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 v⟨line-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 groff extension.
De
h v⟨line-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.
DF
color-scheme [component ...]⟨line-break⟩
Set fill color for solid drawing objects using different
color schemes; the analogous command for setting the color
of text, line graphics, and the outline of graphic objects
is m
. The color components are specified as integer
arguments between 0 and 65536. The number of color
components and their meaning vary for the different color
schemes. These commands are generated by the groff escape
sequences \D'F
...'
and \M
(with no other corresponding
graphics commands). No position changing. This command
is a groff extension.
DFc
cyan magenta yellow⟨line-break⟩
Set fill color for solid drawing objects using the
CMY color scheme, having the 3 color components
cyan, magenta, and yellow.
DFd
⟨line-break⟩
Set fill color for solid drawing objects to the
default fill color value (black in most cases). No
component arguments.
DFg
gray⟨line-break⟩
Set fill color for solid drawing objects to the
shade of gray given by the argument, an integer
between 0 (black) and 65536 (white).
DFk
cyan magenta yellow black⟨line-break⟩
Set fill color for solid drawing objects using the
CMYK color scheme, having the 4 color components
cyan, magenta, yellow, and black.
DFr
red green blue⟨line-break⟩
Set fill color for solid drawing objects using the
RGB color scheme, having the 3 color components
red, green, and blue.
Df
n⟨line-break⟩
The argument n must be an integer in the range -32767 to
32767.
0≤n≤1000
Set the color for filling solid drawing objects to
a shade of gray, where 0 corresponds to solid
white, 1000 (the default) to solid black, and
values in between to intermediate shades of gray;
this is obsoleted by command DFg
.
n<0 or n>1000
Set the filling color to the color that is
currently being used for the text and the outline,
see command m
. For example, the command sequence
mg 0 0 65536
Df -1
sets all colors to blue.
No position changing. This command is a groff extension.
Dl
h v⟨line-break⟩
Draw line from current position to offset (h, v) (integers
in basic units u
); then set current position to the end of
the drawn line.
Dp
h1 v1 h2 v2 ... hn vn⟨line-break⟩
Draw a polygon line from current position to offset
(h1, v1), from there to offset (h2, v2), etc., up to
offset (hn, vn), and from there back to the starting
position. For historical reasons, the position is changed
by adding the sum of all arguments with odd index to the
actual horizontal position and the even ones to the
vertical position. Although this doesn't make sense it is
kept for compatibility. This command is a groff
extension.
DP
h1 v1 h2 v2 ... hn vn⟨line-break⟩
The same macro as the corresponding Dp
command with the
same arguments, but draws a solid polygon in the current
fill color rather than an outlined polygon. The position
is changed in the same way as with Dp
. This command is a
groff extension.
Dt
n⟨line-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 point size (this is the default before the first Dt
command was specified). For historical reasons, the
horizontal position is changed by adding the argument to
the actual horizontal position, while the vertical
position is not changed. Although this doesn't make sense
it is kept for compatibility. This command is a groff
extension.
Device control commands
Each device control command starts with the letter x
followed by
a space character (optional or arbitrary space/tab in groff) and
a subcommand letter or word; each argument (if any) must be
preceded by a syntactical space. All x
commands are terminated
by a syntactical line break; no device control command can be
followed by another command on the same line (except a comment).
The subcommand is basically a single letter, but to increase
readability, it can be written as a word, i.e., an arbitrary
sequence of characters terminated by the next tab, space, or
newline character. All characters of the subcommand word but the
first are simply ignored. For example, troff
outputs the
initialization command x i
as x init
and the resolution command
x r
as x res
. But writings like x i_like_groff
and
x roff_is_groff
are accepted as well to mean the same commands.
In the following, the syntax element ⟨line-break⟩ means a
syntactical line break as defined in subsection 'Separation'
above.
xF
name⟨line-break⟩
(Filename control command)
Use name as the intended name for the current file in
error reports. This is useful for remembering the
original file name when groff
uses an internal piping
mechanism. The input file is not changed by this command.
This command is a groff extension.
xf
n s⟨line-break⟩
(font control command)
Mount font position n (a non-negative integer) with font
named s (a text word); see groff_font(5).
xH
n⟨line-break⟩
(Height control command)
Set character height to n (a positive integer in scaled
points z
). Classical troff used the unit points (p
)
instead; see section 'Compatibility' below.
xi
⟨line-break⟩
(init control command)
Initialize device. This is the third command of the
prologue.
xp
⟨line-break⟩
(pause control command)
Parsed but ignored. The classical documentation reads
pause device, can be restarted.
xr
n h v⟨line-break⟩
(resolution control command)
Resolution is n, while h is the minimal horizontal motion,
and v the minimal vertical motion possible with this
device; all arguments are positive integers in basic
units u
per inch. This is the second command of the
prologue.
xS
n⟨line-break⟩
(Slant control command)
Set slant to n degrees (an integer in basic units u
).
xs
⟨line-break⟩
(stop control command)
Terminates the processing of the current file; issued as
the last command of any intermediate troff output.
xt
⟨line-break⟩
(trailer control command)
Generate trailer information, if any. In groff
, this is
actually just ignored.
xT
xxx⟨line-break⟩
(Typesetter control command)
Set the name of the output driver to xxx, a sequence of
non-whitespace characters terminated by whitespace. The
possible names correspond to those of groff's -T
option.
This is the first command of the prologue.
xu
n⟨line-break⟩
(underline control command)
Configure underlining of spaces. If n is 1, start
underlining of spaces; if n is 0, stop underlining of
spaces. This is needed for the cu
request in nroff
mode
and is ignored otherwise. This command is a groff
extension.
xX
anything⟨line-break⟩
(X-escape control command)
Send string anything uninterpreted to the device. If the
line following this command starts with a +
character this
line is interpreted as a continuation line in the
following sense. The +
is ignored, but a newline
character is sent instead to the device, the rest of the
line is sent uninterpreted. The same applies to all
following lines until the first character of a line is not
a +
character. This command is generated by the groff
escape sequence \X
. The line-continuing feature is a
groff extension.
Obsolete command
In classical troff output, emitting a single glyph was mostly
done by a very strange command that combined a horizontal move
and the printing of a glyph. It didn't have a command code, but
is represented by a 3-character argument consisting of exactly
2 digits and a character.
ddc Move right dd (exactly two decimal digits) basic units u
,
then print glyph with single-letter name c.
In groff, arbitrary syntactical space around and within
this command is allowed to be added. Only when a
preceding command on the same line ends with an argument
of variable length a separating space is obligatory. In
classical troff, large clusters of these and other
commands were used, mostly without spaces; this made such
output almost unreadable.
For modern high-resolution devices, this command does not make
sense because the width of the glyphs can become much larger than
two decimal digits. In groff
, this is only used for the devices
X75
, X75-12
, X100
, and X100-12
. For other devices, the commands
t
and u
provide a better functionality.