1troff(1) User Commands troff(1)
2
3
4
6 troff - typeset or format documents
7
9 troff [-a] [-f] [-Fdir] [-i] [-mname] [-nN] [-olist] [-raN]
10 [-sN] [-Tdest] [-uN] [-z] [filename]...
11
12
14 troff formats text in the filenames for typesetting or laser printing.
15 Input to troff is expected to consist of text interspersed with format‐
16 ting requests and macros. If no filename argument is present, troff
17 reads standard input. A minus sign (−) as a filename indicates that
18 standard input should be read at that point in the list of input files.
19
20
21 The output of troff is usually piped through dpost(1) to create a
22 printable postscript file (see EXAMPLES).
23
25 The following options are supported. They may appear in any order, but
26 all must appear before the first filename.
27
28 -a Send an ASCII approximation of formatted output to standard
29 output. (Note: a rough ASCII version can also be printed out
30 on ordinary terminals with an old and rarely used command,
31 /usr/bin/ta.)
32
33
34 -f Do not print a trailer after the final page of output or
35 cause the postprocessor to relinquish control of the device.
36
37
38 -Fdir Search directory dir for font width or terminal tables
39 instead of the system default directory.
40
41
42 -i Read standard input after all input files are exhausted.
43
44
45 -mname Prepend the macro file /usr/share/lib/tmac/name to the input
46 filenames. Note: most references to macro packages include
47 the leading m as part of the name; for example, the man(5)
48 macros reside in /usr/share/lib/tmac/an. The macro directory
49 can be changed by setting the TROFFMACS environment variable
50 to a specific path. Be certain to include the trailing '/'
51 (slash) at the end of the path.
52
53
54 -nN Number the first generated page N.
55
56
57 -olist Print only pages whose page numbers appear in the comma-sepa‐
58 rated list of numbers and ranges. A range N−M means pages N
59 through M; an initial −N means from the beginning to page N;
60 and a final N− means from N to the end.
61
62
63 -q Quiet mode in nroff; ignored in troff.
64
65
66 -raN Set register a (one-character names only) to N.
67
68
69 -sN Stop the phototypesetter every N pages. On some devices,
70 troff produces a trailer so you can change cassettes; resume
71 by pressing the typesetter's start button.
72
73
74 -Tdest Prepare output for typesetter dest. The following values can
75 be supplied for dest:
76
77 post A PostScript printer; this is the default value. The
78 output of the -T option must go through dpost(1)
79 before it is sent to a PostScript printer to obtain
80 the proper output.
81
82
83
84 -uN Set the emboldening factor for the font mounted in position 3
85 to N. If N is missing, then set the emboldening factor to 0.
86
87
88 -z Suppress formatted output. Only diagnostic messages and mes‐
89 sages output using the .tm request are output.
90
91
93 The following operand is supported:
94
95 filename The file containing text to be processed by troff.
96
97
99 Example 1 Using troff
100
101
102 The following example shows how to print an input text file mytext,
103 coded with formatting requests and macros. The input file contains
104 equations and tables and must go through the tbl(1) and eqn(1) pre‐
105 processors before it is formatted by troff with ms macros, processed by
106 dpost(1), and printed by lp(1):
107
108
109 tbl mytext | eqn | troff -ms | dpost | lp
110
111
113 /tmp/trtmp temporary file
114
115
116 /usr/share/lib/tmac/* standard macro files
117
118
119 /usr/lib/font/* font width tables for alternate mounted troff
120 fonts
121
122
123 /usr/share/lib/nterm/* terminal driving tables for nroff
124
125
127 See attributes(5) for descriptions of the following attributes:
128
129
130
131
132 ┌─────────────────────────────┬─────────────────────────────┐
133 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
134 ├─────────────────────────────┼─────────────────────────────┤
135 │Availability │SUNWdoc │
136 └─────────────────────────────┴─────────────────────────────┘
137
139 checknr(1), col(1), dpost(1), eqn(1), lp(1), man(1), nroff(1), tbl(1),
140 attributes(5), man(5), me(5), ms(5)
141
143 troff is not 8-bit clean because it is by design based on 7-bit ASCII.
144
145
146 Previous documentation incorrectly described the numeric register yr as
147 being the Last two digits of current year. yr is in actuality the num‐
148 ber of years since 1900. To correctly obtain the last two digits of the
149 current year through the year 2099, the definition given below of
150 string register yy may be included in a document and subsequently used
151 to display a two-digit year. Note that any other available one- or two-
152 character register name may be substituted for yy.
153
154 .\" definition of new string register yy--last two digits of year
155 .\" use yr (# of years since 1900) if it is < 100
156 .ie \n(yr<100 .ds yy \n(yr
157 .el \{ .\" else, subtract 100 from yr, store in ny
158 .nr ny \n(yr-100
159 .ie \n(ny>9 \{ .\" use ny if it is two digits
160 .ds yy \n(ny
161 .\" remove temporary number register ny
162 .rr ny \}
163 .el \{.ds yy 0
164 .\" if ny is one digit, append it to 0
165 .as yy \n(ny
166 .rr ny \} \}
167
168
169
170
171SunOS 5.11 24 Aug 2009 troff(1)