roff
’s
page description language is a sequence of
tokens:
single-letter commands or their arguments.
Some commands accept a subcommand as a first argument,
followed by one or more further arguments.
AT&T device-independent
troff
used whitespace minimally when producing output.
GNU
troff
, in contrast,
attempts to make its output more human-readable.
The whitespace characters—tab,
space,
and newline—are always meaningful.
They are never used to represent spacing in the document;
that is done with horizontal
(h
, H
)
and vertical
(v
, V
)
positioning commands.
Any sequence of space and/or tab characters is equivalent to a single
space,
separating commands from arguments and arguments from each other.
Space is required only where omitting it would cause ambiguity.
A line break separates commands.
The comment character is a pound/hash sign
(#
),
and marks the remainder of the line as a comment.
A line comprising only whitespace after comment removal does nothing but
separate input tokens.
The positioning commands noted above,
and the command to write one glyph
(c
),
each take a single argument;
the former a signed integer,
and the latter a printable ISO 646/“ASCII” character.
A series of such commands could validly occur without spaces
on an input line,
but GNU
troff
follows each with a newline.
Some commands have a more complex syntax;
the GNU
troff
extension command for writing glyph sequences
(t
)
accepts a variable number of arguments.
Those that draw geometric objects
(D
)
or control the device
(x
)
furthermore recognize subcommand arguments.
Such commands thus must end with a newline.
In GNU
troff
, the device extension (sub)command
‘x X’
uniquely supports a line continuation syntax;
all other commands occupy one input line.