A dictionary of troff commands
This documents some troff commands and common macros. See also the manual pages for groff, groff_man, groff_mdoc, groff_char and mdoc.samples. The entries in this "dictionary" are sorted in ASCII order, so "." is followed by "\" and so on, with the exception that alphabetical entries are sorted case-insensitively. The command itself is highlighted, and the arguments to the command are shown after it.
followed
by new line- Line continuation marker.
"
- In a string definition, marker for whitespace at the beginning of the string.
$*
- Unknown
$0
- Name of the macro executing
$@
- In a macro or string, the concatenation of all the arguments with each surrounded by double quotes, and separated by spaces.
&
- Non-printing zero-width character.
(*
- Greek character conversion, e.g. \(*a gives α
(co
- Copyright mark, ©
*(xy
- String xy defined by
.ds
*[]
- String with arbitrary length. See also
\*x
,\*(xy
, and.ds
*x
- String x defined by
.ds
.$
- Number of arguments available at the current level.
..
- End of macro. See
.de
. .af
R c- Assign format c to register R. See also
.nr
. .als
alias object- Alias for request, string, macro, or diversion object.
.Ar
- [Manual page macro] An argument. This becomes "file ..." by default.
.as
name string- Append string to string name (append version of
.ds
). .Bd
- Begin display. This can begin indented text, preformatted text like source code, or filled text depending on the argument. The section ends with
.Ed
. .Bd
-literal- Start of preformatted text.
.Bf
- Begin a font, either emphasis, symbolic (bold) or literal (monospace). See also
.Ef
. .Bk
- Begin keep. See also
.Ek
. .Bl
- [Manual page macro] Begin a list. See also
.El
for ending. .BR
- Causes text on the same line to appear alternately in bold face and
roman. The text must be on the same line as the macro call. This is
often used for a manual page, like
.BR stdio (3)
See also.IR
. .c
- Number of lines read from current input file.
.cf
filename- Copy file filename to output, unprocessed.
.Cm
commands- [Manual page macro] Command (like a flag without - in front)
.Dd
- [Manual page macro] Date for BSD manual pages. See also
.Dt
,.TH
. .de
xx yy- Define a macro. If yy is present then the definition ends at .yy, otherwise it ends at "..". See also
..
. .Dl
- Literal line
.Dq
- [Manual page macro] Double quotes around what follows
.ds
abc xyz- Define string abc to have the value xyz; expland with
\*x
or\*(xy
. See also.as
(append string). .Dt
title- [Manual page macro] Title for BSD manual pages. See also
.Dd
,.TH
. .ec
- Reset escape character to
.ec
c- Set escape character to "c". If c is empty, set it to \.
.Ed
- End of a
.Bd
block. .Ef
- End a font started with
.Bf
.Ek
- End keep. See also
.Bk
. .el
- If / else else part; see also
.ie
and.if
. .El
- [Manual page macro] End a list. See also
.Bl
for ending. .eo
- Turn off escape mechanism
.EQ
- Start of equation
.f
- Predefined read-only register containing number of current font.
.F
- Current input file name
.Fa
- [Manual page macro] Function argument
.Fd
- [Manual page macro] Function declaration in the synopsis section.
.fi
- Fill (join lines); see also
.nf
. .Fn
function- [Manual page macro] Function
.Fo
- [Manual page macro] Function open, used after the function's type and before the name of the function.
.Ft
- [Manual page macro] Function type, like int or char.
.ft
R- Font change
.g
- [Groff-specific] register which is true for GNU troff (groff)
.hy
- Hyphenation; see also
.nh
. .ie
- If / else if part; see also
.el
and.if
. .ie
n- If in "nroff" mode (terminal output)
.ie
t- If in "troff" mode (print output)
.if
- If statement; see also if / else using
.ie
and.el
. .In
- [Manual page macro] An "include" file for a C program.
.IP
- Indented paragraph
.IR
- Causes text on the same line to appear alternately in italic and
roman. The text must be on the same line as the macro call. This is
often used for a manual page, like
.IR stdio (3)
See also.BR
. .It
- [Manual page macro] List item
.Lb
- [Manual page macro] Macro which expands to the name of a library.
.Li
- Literal text
.Ms
- Mathematical symbol
.mso
name- Include macro package name. See also
.so
. .MTO
- GNU mailto www extension
.na
- No adjust. Ragged right margin.
.Nd
- [Manual page macro] Emphasize following text (used in SYNOPSIS section).
.nf
- No fill (do not join lines); see also
.fi
. .nh
- No hyphenation; see also
.hy
. .Nm
- Name of command.
.nop
anything- Always execute "anything". (nop means "no operation".)
.nr
R N- Set value of number register R to N
.Ns
- [Manual page macro] No spaces, used between things to not add spaces there.
.nx
filename- Switch to file filename, do not return to current file. See also
.so
. .Os
- [Manual page macro] Macro which expands to the name of the operating system.
.Pa
- Unknown
.Pf
- [Manual page macro] Unknown
.PP
- [Manual page macro] New paragraph
.ps
- Point size
.return
- [Groff-specific] return from a macro. See also
.de
. .Rv
std function1 function2- Display text stating the standard return values for the functions. Always takes std after the .Rv.
.Sc
.Sh
- [Manual page macro] "Section heading"
.shift
n- Shift the arguments by n positions
.Sm
on / off- [Manual page macro] Space mode on / off; do or do not put spaces between arguments
.So
.so
file- Include "file". See also
.mso
. .Sq
- [Manual page macro] Single quotes
.Ss
- [Manual page macro] "Subsection".
.St
- [Manual page macro] Standards of various kinds.
.Ta
- [Manual page macro] A tab in a table. The literal tab character is also used. If you want to go insane, try writing a troff processor.
.TE
- End of a table (see also
.TS
). .TH
title section date source manual- [Manual page macro] Title for GNU manual pages. See also
.Dd
,.Dt
for the BSD equivalents. .ti
- Temporary indent
.tm
message- Terminal message; print message on the terminal.
.TP
- Indented paragraph with label.
.TS
- Start of a table (see also
.TE
). .URL
- GNU www.mdoc extension
.x
- Reserved version-dependent register (contains major version of groff)
.Xc
- End of an
.Xo
block. .Xo
- [Manual page macro] Extend the current line of arguments until
.Xc
is seen. .Xr
page section- [Manual page macro] Cross-reference to manual page "page" in section "section" of the manual.
.y
- Reserved version-dependent register (contains minor version of groff)
.yr
- Years since 1900
[la]
- <
[ra]
- >
\$n
- Macro argument n, e.g. \\$1 is the first macro argument.
c
- Connect to next input text (not sure what this means?)
f[CB]
- Courier-Bold font
f[CO]
- Courier font
n(xx
- Value of number register xx
nx
- Value of number register x
s
- Point-size change function
~
- Non-breaking space
Where the command is marked "unknown", I don't know what that command does. I started this list of commands for a project putting Unix manual page translations on the web. If you have any suggestions for improvements, please email them to me (email is at the bottom of the page). The original dictionary from which the above HTML is made is downloadable here.
Web links
- Plan 9 Troff User's Manual [PDF]
- Heirloom Documentation Tools Nroff/Troff User’s Manual [PDF]
- A TROFF Tutorial [PostScript]
- The GNU Troff Manual
- mdoc language reference - OpenBSD Reference Manual
-
troff/nroff quick reference
Has info on units.
-
Practical UNIX Manuals by Kristaps Dzonsons
Kristaps Dzonsons is the author of mandoc, a new program for BSD manuals.