| ROFF(7) | Miscellaneous Information Manual | ROFF(7) |
NAME
roff — roff
language reference for manual pages
DESCRIPTION
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.
Input lines
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.
Comments
‘\"’ 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.
REQUESTS
dsname [string]- Define a string. A leading double quote in string is removed, so that it can start with spaces.
asname [string]- Append to a string.
nrname [+|-]number- Set, increase or decrease a number register.
rrname ...- Remove number registers.
rmname ...- Remove strings or macros.
rnold new- Rename a string or macro.
alsnew old- Make new another name for the macro old.
dename [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. amname [end]- Append to a macro.
ig[end]- Ignore input up to a line holding the control character and end.
ifcondition body- Process body if condition holds.
iecondition body- The same, remembering the result for the next
el. elbody- Process body if the last
iecondition did not hold. sofile- Include file, relative to the root of the manual tree.
trpairs- Translate each first character of a pair to the second.
ccc- Use c as the control character.
ec[c]- Use c as the escape character, by default a backslash.
eo- Turn escape sequences off.
noptext- 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:
n,o- true (terminal output, odd page);
t,e,v- false;
dname- a string or macro name is defined;
rname- a number register name is defined;
cchar- true;
- 'a'b'
- the strings a and b, after interpolation, are equal;
- expression
- a numeric expression is greater than zero.
!’.
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.
ESCAPE SEQUENCES
\\,\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.
\c- At the end of a text line, join the next line without a space.
\(xx,\[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. \N'number'- The character with code number.
\ffont- Change the font:
R(roman),B(bold),I(italic, shown underlined),BI,CW, orP, the previous font. Names longer than one character are written\f(xx or\f[name]. \*c, \*(xx, \*[name]- Interpolate a string.
\nc, \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.
\ssize, \mcolor, \h'width'- Size, color and motion; on a terminal, horizontal motion prints spaces and the others nothing.
\w'text'- The width of text.
An escape sequence not listed prints its character.
PREDEFINED STRINGS
| Name | Value |
Ai |
ANSI |
Am |
& |
Ba |
| |
Ge |
≥ |
Gt |
> |
If |
infinity |
Le |
≤ |
Lq,
lq |
“ |
Lt |
< |
Na |
NaN |
Ne |
≠ |
Pi |
pi |
Pm |
± |
Px |
POSIX |
R |
® |
Rq,
rq |
” |
Tm |
(Tm) |
aa |
´ |
ga |
` |
lp,
rp |
(and) |
q |
" |
ua |
↑ |
va |
↕ |
SEE ALSO
HISTORY
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 |