summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/groff/tbl/tbl.1
blob: 3ce3848e9048678ee6bced69a0b4632b7226afa9 (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
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
.\" $OpenBSD: tbl.1,v 1.4 2003/03/01 23:53:03 wcobb Exp $
.\"
.\" Copyright (c) 2003 Marc Espie
.\"
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd February 25, 2003
.Dt TBL 1
.Os
.Sh NAME
.Nm tbl
.Nd format tables for troff
.Sh SYNOPSIS
.Nm tbl
.Op Fl Cv
.Op Ar files ...
.Sh DESCRIPTION
.Nm
is a preprocessor for
.Xr troff
which is used to format tables.
These tables are composed from columns that can be independently justified,
headings may be placed over single columns or groups of columns,
and horizontal or vertical lines may be added as desired.
.Pp
.Nm
preprocesses the input
.Ar files ,
(or standard input if no file is specified)
and prints its result to standard output.
.Pp
Each table is preceded by a
.Sq .TS
(table start) command, and followed by a
.Sq .TE
(table end) command.
.Nm
does not touch the reminder of the text.
The actual
.Sq .TS
and
.Sq .TE
lines are copied verbatim as well, so that further page layout macros
may use these to place the resulting tables.
.Pp
The format of
.Nm
input is as follows:
.Bd -literal
    text
    \&.TS
    table specification
    \&.TE
    further text
    \&.TS
    table specification
    \&.TE
    more text
    \&...
.Ed
.Pp
And a table specification is as follows:
.Bd -literal
    \&.TS
    table options ;
    table format .
    data
    ...
    \&.TE
.Ed
.Pp
Each table is formatted independently, and thus must contain a full
separate specification.
The
.Sq table options
affect the entire table.
Alternately, the
.Sq table format
can be changed in the middle of a table,
which yields the following template:
.Bd -literal
    \&.TS
    table options ;
    table format .
    table data
    \&...
    \&.T&
    table format .
    more data
    \&...
    \&.TE
.Ed
.Pp
.Ss TABLE OPTIONS
Options affecting the whole table may appear on a single line,
immediately following the
.Sq .TS
line.
The option names may be separated by spaces, tabulations, or commas,
and must end in a semicolon.
Available options are:
.Bl -tag -width linesize(n)
.It allbox
put a box around each item in the table.
.It box
put a box around the whole table.
.It center
center the table, instead of the default left-adjust.
.It delim(ab)
use 
.Ar a 
and 
.Ar b 
as
.Xr eqn 1
delimiters.
.It doublebox
put a double box around the whole table.
.It expand
make the table as wide as the current line length.
.It linesize(n)
set lines and rules in 
.Ar n 
point type.
.It tab(n)
use 
.Ar n 
spaces instead of a tabulation to separate items.
.El
.Ss TABLE FORMAT
Each line in the format section corresponds to a single line of the table,
except for the last line which corresponds to all remaining lines up to the 
next
.Sq .T& ,
if present.
Each column is represented by one letter from the following list, along
with modifiers.
Good style mandates separating specifications for each column with spaces
or tabs.
.Bl -tag -width l or L
.It l or L
left-adjusted column entry.
.It c or C
centered column entry.
.It r or R
right-adjusted colum entry.
.It n or N
numerical column entry, to be aligned with other numerical entries so that
unit digits match up.
.It a or A
alphabetic subcolumn.
Corresponding entries are left-aligned, and set so that the widest is centered
within the column.
.It s or S
spanned heading. 
The entry for the previous column continues on this column.
.It ^
vertically spanned heading. 
The entry for the previous row continues on this row.
.It _ or =
horizontal rule, replacing the column entry.
.Sq =
creates a double rule.
If an adjacent column also contains an horizontal rule or if there are
vertical rules adjoing the column, the line is extended to meet the nearby
lines.
Any data entry for this column will be ignored and a warning message be
printed.
.It | or ||
single or double vertical rule.
.El
.Pp
Some extra features are available as modifiers
.Bl -tag -width l
.It "Inter-column spacing"
A number may follow a column format.
This number indicates the separation between the column and the next 
column.
The default number is 3.
The unit used is ens 
.Po
one en is roughly the width of the letter
.Sq n
.Pc .
.It "Non-centered vertical spanning"
Vertically spanned  items are normally centered over the rows they span.
If the column format is followed by t or T, the item will begin at the
top line of the span.
.It "Font changes"
A string containing a font name or number preceded by f or F may be used
to indicate that the corresponding column should be formatted in that font.
In
.Ux
.Nm ,
all font names are at most two letters long.
The letters b, b, I, and i are synonyms for fB and fI.
Individual data items within the table may override these specifications.
.El
.Ss TABLE DATA
Each table line is normally entered as one line of data.
Long lines may be broken, by using \\ as a continuation character.
Table entries are separated with tabulations (or with the character
specified in the
.Ar tabs
option).
There a few exceptions:
.Bl -tag -width l
.It "Embedded troff commands"
An input line beginning with a
.Sq \&.
followed by anything but a number is passed through to
troff unchanged.
For instance,
\&.sp
can be used to produce extra space within a table.
.It "Horizontal rules"
A line containing only
.Sq _
or
.Sq =
produces a single or double horizontal rule that extends for the
full width of the table.
.It "Single columns horizontal rules"
A table entry containing only
.Sq _
or
.Sq =
produces a single or double horizontal rule that extends for
the width of the column.
If necessary, the rule is extended to meet matching horizontal 
or vertical rules adjoining this column.
.El
.Sh GNU DIFFERENCES
The version of
.Nm
shipping with
.Ox
is part of 
.Xr groff 1 , 
and features a few differences from classical
.Ux .
.Pp
For instance, the output of GNU
.Nm
cannot be processed with
.Ux
.Xr troff 1 ,
but must be processed with GNU
.Xr troff 1 .
.Pp
Normally,
.Nm
makes use of diversions to attempt to prevent bad breaks in the table.
This can interact with some macro packages' use of diversions, for instance
with footnotes.
The
.Ar nokeep
option
can be used to tell
.Nm
not to try.
.Pp
The
.Ar decimalpoint (c)
option changes the character used as a decimal point instead of the default
period.
.Pp
The
.Ar f
format modifier can be used with a long font name enclosed in parenthesis.
.Pp
A
.Ar d
format modifier has been added, meaning that a vertically spanning entry
should be aligned at the bottom.
.Pp
There are no arrbitrary limits on the number of columns or the number of
text blocks in a table.
.Sh BUGS
This documentation is currently incomplete and only describes a subset of
.Nm tbl .
.Sh SEE ALSO
.Xr eqn 1 ,
.Xr nroff 1