Go to main content

man pages section 1: User Commands

Exit Print View

Updated: July 2017



troff - typeset or format documents


troff [-a] [-f] [-Fdir] [-i] [-mname] [-nN] [-o
list] [-raN] 
     [-sN] [-uN] [-z] [filename]...


troff formats text in the filenames for typesetting or laser printing. Input to troff is expected to consist of text interspersed with formatting requests and macros. If no filename argument is present, troff reads standard input. A minus sign (−) as a filename indicates that standard input should be read at that point in the list of input files.


The following options are supported. They may appear in any order, but all must appear before the first filename.


Send an ASCII approximation of formatted output to standard output. (Note: a rough ASCII version can also be printed out on ordinary terminals with an old and rarely used command, /usr/bin/ta.)


Do not print a trailer after the final page of output or cause the postprocessor to relinquish control of the device.


Search directory dir for font width or terminal tables instead of the system default directory.


Read standard input after all input files are exhausted.


Prepend the macro file /usr/share/lib/tmac/name to the input filenames. Note: most references to macro packages include the leading m as part of the name; for example, the man(5) macros reside in /usr/share/lib/tmac/an. The macro directory can be changed by setting the TROFFMACS environment variable to a specific path. Be certain to include the trailing ' / ' (slash) at the end of the path.


Number the first generated page N.


Print only pages whose page numbers appear in the comma-separated list of numbers and ranges. A range NM means pages N through M; an initial N means from the beginning to page N; and a final N means from N to the end.


Quiet mode in nroff; ignored in troff.


Set register a (one-character names only) to N.


Stop the phototypesetter every N pages. On some devices, troff produces a trailer so you can change cassettes; resume by pressing the typesetter's start button.


Set the emboldening factor for the font mounted in position 3 to N. If N is missing, then set the emboldening factor to 0.


Suppress formatted output. Only diagnostic messages and messages output using the .tm request are output.


The following operand is supported:


The file containing text to be processed by troff.



temporary file


standard macro files


font width tables for alternate mounted troff fonts


terminal driving tables for nroff


See attributes(5) for descriptions of the following attributes:


See Also

checknr(1), col(1), eqn(1), man(1), nroff(1), tbl(1), attributes(5), man(5), me(5), ms(5)


troff is not 8-bit clean because it is by design based on 7-bit ASCII.

Previous documentation incorrectly described the numeric register yr as being the Last two digits of current year. yr is in actuality the number of years since 1900. To correctly obtain the last two digits of the current year through the year 2099, the definition given below of string register yy may be included in a document and subsequently used to display a two-digit year. Note that any other available one- or two-character register name may be substituted for yy.

.\" definition of new string register yy--last two digits of year
.\" use yr (# of years since 1900) if it is < 100
.ie \n(yr<100 .ds yy \n(yr
.el \{             .\" else, subtract 100 from yr, store in ny
.nr ny \n(yr-100
.ie \n(ny>9 \{     .\" use ny if it is two digits
.ds yy \n(ny
.\" remove temporary number register ny
.rr ny \}
.el \{.ds yy 0
.\" if ny is one digit, append it to 0
.as yy \n(ny
.rr ny \} \}