aboutsummaryrefslogtreecommitdiff
path: root/man/man1/tbl.1
blob: 921e9e85e4df6277146cc01cb00992c05bd3765a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
.TH TBL 1
.SH NAME
tbl \- format tables for nroff or troff
.SH SYNOPSIS
.B tbl
[
.I file ...
]
.SH DESCRIPTION
.I Tbl
is a preprocessor for formatting tables for
.I nroff
or
.IR troff (1).
The input
.I files
are copied to the standard output,
except for segments of the form
.IP
.nf
.B .TS
.IB options " ;
.IB format " .
.I data
.B .T&
.IB format " .
.I data
\&. . .
.B .TE
.fi
.LP
which describe tables
and are replaced by
.I troff 
requests to lay out the tables.
If no arguments are given,
.I tbl
reads the standard input.
.PP
The (optional)
.I options
line is terminated by a semicolon and contains one or more
of
.RS
.TF linesize(n)
.TP
.B center
center the table; default is left-adjust
.TP
.B expand
make table as wide as current line length
.TP
.B box
.TP
.B doublebox
enclose the table in a box or double box
.TP
.B allbox
enclose every item in a box
.TP
.BI tab( x )
use 
.I x
to separate input items; default is tab
.TP
.BI linesize( n )
set rules in
.IR n -point
type
.TP
.BI delim( xy )
recognize
.I x
and
.I y
as
.IR eqn (1)
delimiters
.PD
.RE
.PP
Each line, except the last, of the obligatory
.I format
describes one row of the table.
The last line describes all rows until the next
.BR .T& ,
where the format changes,
or the end of the table at
.BR .TE .
A format is specified by key letters, one per column, either upper or lower case:
.RS
.TP 0
.B L
Left justify: the default for
columns without format keys.
.PD0
.TP
.B R
Right justify.
.TP
.B C
Center.
.TP
.B N
Numeric: align at decimal point (inferred for integers) or at
.LR \e& .
.TP
.B S
Span: extend previous column across this one.
.TP
.B A
Alphabetic: left-aligned within column, widest item centered, indented relative to 
.B L
rows.
.TP
.B ^
Vertical span: continue item from previous row into this row.
.TP
.B -
Draw a horizontal rule in this column.
.TP
.B =
Draw a double horizontal rule in this column.
.PD
.RE
.PP
Key letters may be followed by modifiers, also either case:
.RS
.TP \w'\fLF\fIfont\fLXX'u
.B |
Draw vertical rule between columns.
.PD0
.TP
.B ||
Draw a double vertical rule between columns.
.TP
.I n
Gap between column is
.I n
ens wide.
Default is 3.
.TP
.BI F font
Use specified
.IR font .
.B B
and
.B I
mean
.B FB
and
.BR FI .
.TP
.B T
Begin vertically-spanned item at top row of range; default is 
vertical centering (with
.LR ^ ).
.TP
.BI P n
Use point size
.IR n .
.TP
.BI V n
Use
.IR n -point
vertical spacing in text block; signed
.I n
means relative change.
.TP
.BI W( n )
Column width as a
.I troff
width specification.
Parens are optional if
.I n
is a simple integer.
.TP
.B E
Equalize the widths of all columns marked
.BR E .
.PD
.RE
.PP
Each line of
.I data
becomes one row of the table; tabs separate items.
Lines beginning with
.L .
are 
.I troff 
requests.
Certain special data items are recognized:
.RS
.TP 0
.B _
Draw a horizontal rule in this column.
.PD0
.TP
.B =
Draw a double horizontal rule in this column.
A data line consisting of a single
.L _
or
.L =
draws the rule across the whole table.
.TP
.B \e_
Draw a rule only as wide as the contents of the column.
.TP
.BI \eR x
Repeat character
.I x
across the column.
.TP
.B \e^
Span the previous item in this column down into this row.
.TP
.B T{
The item is a text block to be separately formatted
by
.I troff 
and placed in the table.
The block continues to the next line beginning with
.BR T} .
The remainder of the data line follows at that point.
.PD
.RE
.PP
When it is used in a pipeline with
.IR eqn ,
the
.I tbl
command should be first, to minimize the volume
of data passed through
pipes.
.SH EXAMPLES
.ds tb \fR<tab>\fP
Let \*(tb
represent a tab (which should
be typed as a genuine tab).
.if t .2C
.EX
\&.TS
c s s
c c s
c c c
l n n.
Household Population
Town\*(tbHouseholds
\*(tbNumber\*(tbSize
Bedminster\*(tb789\*(tb3.26
Bernards Twp.\*(tb3087\*(tb3.74
Bernardsville\*(tb2018\*(tb3.30
\&.TE
.if t \{\0 
\0 
\0\}
.if n .PP
.TS
c s s
c c s
c c c
l n n.
Household Population
Town	Households
	Number	Size
Bedminster	789	3.26
Bernards Twp.	3087	3.74
Bernardsville	2018	3.30
.TE
.EE
.if t \{.sp3
.1C\}
.SH SOURCE
.B /sys/src/cmd/tbl
.SH SEE ALSO
.IR troff (1), 
.IR eqn (1),
.IR doctype (1)
.br
M. E. Lesk and L. L. Cherry,
``TBL\(ema Program to Format Tables'',
.I
Unix Research System Programmer's Manual,
Tenth Edition, Volume 2.