OxideBSD
ROFF(7) Miscellaneous Information Manual ROFF(7)

roff — roff language reference for manual pages

The roff language is the input format underneath the mdoc(7) and man(7) macro languages. This page describes the part of it that oxdoc(1) implements: the requests and escape sequences that manual pages use. Page layout, diversions, traps and environments are not implemented, as in the other BSDs' formatter.

An input line is either a text line or a control line. A control line starts with the control character, normally ‘.’, or the no-break control character ‘'’, followed by optional spaces and tabs, a request or macro name, and its arguments. Any other line is a text line.

Arguments are separated by spaces. An argument that contains spaces is enclosed in double quotes; inside quotes, two double quotes stand for one.

A line ending with an odd number of backslashes continues on the next input line. A control line consisting of the control character alone is ignored.

‘\"’ starts a comment that runs to the end of the line. A line consisting of the control character and a comment is ignored entirely. ‘\#’ is a comment that also removes the newline.

ds name [string]
Define a string. A leading double quote in string is removed, so that it can start with spaces.
as name [string]
Append to a string.
nr name [+|-]number
Set, increase or decrease a number register.
rr name ...
Remove number registers.
rm name ...
Remove strings or macros.
rn old new
Rename a string or macro.
als new old
Make new another name for the macro old.
de name [end]
Define a macro, up to a line holding the control character and end, by default ‘..’. In the definition, ‘\\’ stands for one backslash, so that ‘\\$1’ becomes the first argument when the macro is called.
am name [end]
Append to a macro.
ig [end]
Ignore input up to a line holding the control character and end.
if condition body
Process body if condition holds.
ie condition body
The same, remembering the result for the next el.
el body
Process body if the last ie condition did not hold.
so file
Include file, relative to the root of the manual tree.
tr pairs
Translate each first character of a pair to the second.
cc c
Use c as the control character.
ec [c]
Use c as the escape character, by default a backslash.
eo
Turn escape sequences off.
nop text
Treat text as a text line.

A body is the rest of the line, or, starting with ‘\{’, all lines up to the matching ‘\}’.

A condition is one of:

, o
true (terminal output, odd page);
, e, v
false;
name
a string or macro name is defined;
name
a number register name is defined;
char
true;
'a'b'
the strings a and b, after interpolation, are equal;
expression
a numeric expression is greater than zero.
Any condition may be negated with ‘!’. Numeric expressions use ‘+’, ‘-’, ‘*’, ‘/’, ‘%’, ‘<’, ‘>’, ‘<=’, ‘>=’, ‘=’, ‘==’, ‘<>’, ‘&’ and ‘:’ evaluated from left to right, and parentheses.

Requests that only affect typesetting — hyphenation, adjustment, page size, fonts and the like — are accepted and have no effect.

\\, \e
A backslash.
\-
A minus sign.
A zero-width character. It stops a word from being taken as a macro name or a delimiter, and a period before it from ending a sentence.
\ , \~, \0
A space that does not break the line.
, \^, \%, \:
Nothing on a terminal.
At the end of a text line, join the next line without a space.
, \[name], \C'name'
The special character name, such as ‘\(em’ for an em dash; see mandoc_char(7) on other systems for the list. \[uXXXX] is the Unicode character U+XXXX.
number'
The character with code number.
font
Change the font: R (roman), B (bold), I (italic, shown underlined), BI, CW, or P, the previous font. Names longer than one character are written \f(xx or \f[name].
c, \*(xx, \*[name]
Interpolate a string.
c, \n(xx, \n[name]
Interpolate a number register; \n+c and \n-c increment or decrement it first.
n, \$*, \$@
Inside a macro: its nth argument, or all of them, the second form quoted.
size, \mcolor, \h'width'
Size, color and motion; on a terminal, horizontal motion prints spaces and the others nothing.
text'
The width of text.

An escape sequence not listed prints its character.

ANSI
&
|
≥
>
infinity
≤
, lq “
<
NaN
≠
pi
±
POSIX
®
, rq ”
(Tm)
´
`
, rp (and)
"
↑
↕

oxdoc(1), eqn(7), man(7), mdoc(7), tbl(7)

The roff typesetting language appeared in Version 1 AT&T UNIX, descended from RUNOFF on CTSS. This manual was written for OxideBSD.

September 27, 2026 OxideBSD