A dictionary of troff commands

This is a work in progress to document some troff commands and common macros. See also groff, groff, groff_man, groff_mdoc, groff_char and mdoc.samples.

"in a string definition, marker for whitespace at the beginning of the string.
$0name of the macro executing
.$ Number of arguments available at the current level.
..end of macro. See .de.
.af R cassign format c to register R. See also .nr.
.als alias objectalias for request, string, macro, or diversion object.
.as name stringAppend string to string name (append version of .ds).
.BdBegin display. This can begin indented text, preformatted text like source code, or filled text depending on the argument. The section ends with .Ed.
.Bfbegin a font, either emphasis, symbolic (bold) or literal (monospace). See also .Ef.
.BkBegin keep. See also .Ek.
.cnumber of lines read from current input file.
.cf filenameCopy 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 ...
.Dlliteral line
.Dq[Manual page macro] double quotes
.Dqdouble quotes around what follows
.ds abc xyzdefine string abc to have the value xyz; expland with \*x or \*(xy. See also .as (append string).
.Dt[Manual page macro] Title for BSD manual pages. See also .Dd, .TH.
.Dt title[Manual page macro] Set document title to title
.ecreset escape character to \
.ec cSet escape character to c.
.ec cset escape character to "c". If c is empty, set it to \.
.EdEnd of a .Bd block.
.Efend a font started with .Bf
.EkEnd keep. See also .Bk.
.elif / else else part; see also .ie and .if.
.eoturn off escape mechanism
.EQStart of equation
.fpredefined read-only register containing number of current font.
.Fcurrent input file name
.fifill (join lines); see also .nf.
.Fn function[Manual page macro] Function
.ft Rfont change
.g[Groff-specific] register which is true for GNU troff (groff)
.ieif / else if part; see also .el and .if.
.ie nIf in "nroff" mode (terminal output)
.ie tIf in "troff" mode (print output)
.ifif statement; see also if / else using .ie and .el.
.It[Manual page macro] List item
.Lb[Manual page macro] Macro which expands to the name of a library.
.Msmathematical symbol
.mso nameinclude macro package name. See also .so.
.MTOGNU mailto www extension
.naNo adjust. Ragged right margin.
.Nd[Manual page macro] Emphasize following text (used in SYNOPSIS section).
.nfno fill (do not join lines); see also .fi.
.nhno hyphenation
.NmName of command.
.nop anythingAlways execute "anything".
.nr R Nset value of number register R to N
.nx filenameSwitch 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.
.PP[Manual page macro] New paragraph
.pspoint 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
.shift nshift 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 fileinclude "file". See also .mso.
.Sq[Manual page macro] single quotes
.Ss[Manual page macro] "Subsection".
.TEEnd 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.
.titemporary indent
.tm messageterminal message; print message on the terminal.
.TPIndented paragraph with label.
.TSStart of a table (see also .TE).
.URLGNU www.mdoc extension
.xreserved version-dependent register (contains major version of groff)
.XcEnd of an .Xo block.
.Xo[Manual page macro] extended argument
.XoExtend 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.
.yreserved version-dependent register (contains minor version of groff)
.yryears since 1900
\ <new line>Line continuation marker.
\$*unknown
\$@In a macro or string, the concatenation of all the arguments with each surrounded by double quotes, and separated by spaces.
\&#38;Non-printing zero-width character.
\(*Greek character conversion, e.g. \(*a gives α
\(cocopyright mark, ©
\*(xystring xy defined by .ds
\*[]string with arbitrary length. See also \*x, \*(xy, and .ds
\*xstring x defined by .ds
\[la]<
\[ra]>
\\$nmacro argument n, e.g. \\$1 is the first macro argument.
\cconnect to next input text (not sure what this means?)
\f[CB]Courier-Bold font
\f[CO]Courier font
\n(xxvalue of number register xx
\nxvalue of number register x
\spoint-size change function
\~non-breaking space

Web links


Copyright © Ben Bullock 2009-2012. All rights reserved. For comments, questions, and corrections, please email Ben Bullock (ben.bullock@lemoda.net) / Privacy / Disclaimer