xref: /titanic_41/usr/src/man/man5/tbl.5 (revision 32a712da90cea6ff9a05f51e7844944ccfa28d5e)
1*32a712daSGarrett D'Amore.\"
2*32a712daSGarrett D'Amore.\" Permission to use, copy, modify, and distribute this software for any
3*32a712daSGarrett D'Amore.\" purpose with or without fee is hereby granted, provided that the above
4*32a712daSGarrett D'Amore.\" copyright notice and this permission notice appear in all copies.
5*32a712daSGarrett D'Amore.\"
6*32a712daSGarrett D'Amore.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
7*32a712daSGarrett D'Amore.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
8*32a712daSGarrett D'Amore.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
9*32a712daSGarrett D'Amore.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
10*32a712daSGarrett D'Amore.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
11*32a712daSGarrett D'Amore.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
12*32a712daSGarrett D'Amore.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
13*32a712daSGarrett D'Amore.\"
14*32a712daSGarrett D'Amore.\"
15*32a712daSGarrett D'Amore.\" Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
16*32a712daSGarrett D'Amore.\" Copyright 2012 Nexenta Systems, Inc. All rights reserved.
17*32a712daSGarrett D'Amore.\"
18*32a712daSGarrett D'Amore.Dd Sep 3, 2011
19*32a712daSGarrett D'Amore.Dt TBL 5
20*32a712daSGarrett D'Amore.Os
21*32a712daSGarrett D'Amore.Sh NAME
22*32a712daSGarrett D'Amore.Nm tbl
23*32a712daSGarrett D'Amore.Nd tbl language reference for mandoc
24*32a712daSGarrett D'Amore.Sh DESCRIPTION
25*32a712daSGarrett D'AmoreThe
26*32a712daSGarrett D'Amore.Nm tbl
27*32a712daSGarrett D'Amorelanguage is a table-formatting language.
28*32a712daSGarrett D'AmoreIt is used within
29*32a712daSGarrett D'Amore.Xr mdoc 5
30*32a712daSGarrett D'Amoreand
31*32a712daSGarrett D'Amore.Xr man 5
32*32a712daSGarrett D'Amore.Ux
33*32a712daSGarrett D'Amoremanual pages.
34*32a712daSGarrett D'AmoreThis manual describes the subset of the
35*32a712daSGarrett D'Amore.Nm
36*32a712daSGarrett D'Amorelanguage accepted by the
37*32a712daSGarrett D'Amore.Xr mandoc 1
38*32a712daSGarrett D'Amoreutility.
39*32a712daSGarrett D'Amore.Pp
40*32a712daSGarrett D'AmoreTables within
41*32a712daSGarrett D'Amore.Xr mdoc 5
42*32a712daSGarrett D'Amoreor
43*32a712daSGarrett D'Amore.Xr man 5
44*32a712daSGarrett D'Amoreare enclosed by the
45*32a712daSGarrett D'Amore.Sq TS
46*32a712daSGarrett D'Amoreand
47*32a712daSGarrett D'Amore.Sq TE
48*32a712daSGarrett D'Amoremacro tags, whose precise syntax is documented in
49*32a712daSGarrett D'Amore.Xr roff 5 .
50*32a712daSGarrett D'AmoreTables consist of a series of options on a single line, followed by the
51*32a712daSGarrett D'Amoretable layout, followed by data.
52*32a712daSGarrett D'Amore.Pp
53*32a712daSGarrett D'AmoreFor example, the following creates a boxed table with digits centred in
54*32a712daSGarrett D'Amorethe cells.
55*32a712daSGarrett D'Amore.Bd -literal -offset indent
56*32a712daSGarrett D'Amore\&.TS
57*32a712daSGarrett D'Amoretab(:) box;
58*32a712daSGarrett D'Amorec5 c5 c5.
59*32a712daSGarrett D'Amore1:2:3
60*32a712daSGarrett D'Amore4:5:6
61*32a712daSGarrett D'Amore\&.TE
62*32a712daSGarrett D'Amore.Ed
63*32a712daSGarrett D'Amore.Pp
64*32a712daSGarrett D'AmoreWhen formatted, the following output is produced:
65*32a712daSGarrett D'Amore.Bd -filled -offset indent -compact
66*32a712daSGarrett D'Amore.TS
67*32a712daSGarrett D'Amoretab(:) box;
68*32a712daSGarrett D'Amorec5 c5 c5.
69*32a712daSGarrett D'Amore1:2:3
70*32a712daSGarrett D'Amore4:5:6
71*32a712daSGarrett D'Amore.TE
72*32a712daSGarrett D'Amore.Ed
73*32a712daSGarrett D'Amore.Pp
74*32a712daSGarrett D'AmoreThe
75*32a712daSGarrett D'Amore.Nm
76*32a712daSGarrett D'Amoreimplementation in
77*32a712daSGarrett D'Amore.Xr mandoc 1
78*32a712daSGarrett D'Amoreis
79*32a712daSGarrett D'Amore.Ud
80*32a712daSGarrett D'Amore.Sh TABLE STRUCTURE
81*32a712daSGarrett D'AmoreTables are enclosed by the
82*32a712daSGarrett D'Amore.Sq TS
83*32a712daSGarrett D'Amoreand
84*32a712daSGarrett D'Amore.Sq TE
85*32a712daSGarrett D'Amore.Xr roff 5
86*32a712daSGarrett D'Amoremacros.
87*32a712daSGarrett D'AmoreA table consists of an optional single line of table
88*32a712daSGarrett D'Amore.Sx Options
89*32a712daSGarrett D'Amoreterminated by a semicolon, followed by one or more lines of
90*32a712daSGarrett D'Amore.Sx Layout
91*32a712daSGarrett D'Amorespecifications terminated by a period, then
92*32a712daSGarrett D'Amore.Sx Data .
93*32a712daSGarrett D'AmoreAll input must be 7-bit ASCII.
94*32a712daSGarrett D'AmoreExample:
95*32a712daSGarrett D'Amore.Bd -literal -offset indent
96*32a712daSGarrett D'Amore\&.TS
97*32a712daSGarrett D'Amorebox tab(:);
98*32a712daSGarrett D'Amorec | c
99*32a712daSGarrett D'Amore| c | c.
100*32a712daSGarrett D'Amore1:2
101*32a712daSGarrett D'Amore3:4
102*32a712daSGarrett D'Amore\&.TE
103*32a712daSGarrett D'Amore.Ed
104*32a712daSGarrett D'Amore.Pp
105*32a712daSGarrett D'AmoreTable data is
106*32a712daSGarrett D'Amore.Em pre-processed ,
107*32a712daSGarrett D'Amorethat is, data rows are parsed then inserted into the underlying stream
108*32a712daSGarrett D'Amoreof input data.
109*32a712daSGarrett D'AmoreThis allows data rows to be interspersed by arbitrary
110*32a712daSGarrett D'Amore.Xr roff 5 ,
111*32a712daSGarrett D'Amore.Xr mdoc 5 ,
112*32a712daSGarrett D'Amoreand
113*32a712daSGarrett D'Amore.Xr man 5
114*32a712daSGarrett D'Amoremacros such as
115*32a712daSGarrett D'Amore.Bd -literal -offset indent
116*32a712daSGarrett D'Amore\&.TS
117*32a712daSGarrett D'Amoretab(:);
118*32a712daSGarrett D'Amorec c c.
119*32a712daSGarrett D'Amore1:2:3
120*32a712daSGarrett D'Amore\&.Ao
121*32a712daSGarrett D'Amore3:2:1
122*32a712daSGarrett D'Amore\&.Ac
123*32a712daSGarrett D'Amore\&.TE
124*32a712daSGarrett D'Amore.Ed
125*32a712daSGarrett D'Amore.Pp
126*32a712daSGarrett D'Amorein the case of
127*32a712daSGarrett D'Amore.Xr mdoc 5
128*32a712daSGarrett D'Amoreor
129*32a712daSGarrett D'Amore.Bd -literal -offset indent
130*32a712daSGarrett D'Amore\&.TS
131*32a712daSGarrett D'Amoretab(:);
132*32a712daSGarrett D'Amorec c c.
133*32a712daSGarrett D'Amore\&.ds ab 2
134*32a712daSGarrett D'Amore1:\e*(ab:3
135*32a712daSGarrett D'Amore\&.I
136*32a712daSGarrett D'Amore3:2:1
137*32a712daSGarrett D'Amore\&.TE
138*32a712daSGarrett D'Amore.Ed
139*32a712daSGarrett D'Amore.Pp
140*32a712daSGarrett D'Amorein the case of
141*32a712daSGarrett D'Amore.Xr man 5 .
142*32a712daSGarrett D'Amore.Ss Options
143*32a712daSGarrett D'AmoreThe first line of a table consists of space-separated option keys and
144*32a712daSGarrett D'Amoremodifiers terminated by a semicolon.
145*32a712daSGarrett D'AmoreIf the first line does not have a terminating semicolon, it is assumed
146*32a712daSGarrett D'Amorethat no options are specified and instead a
147*32a712daSGarrett D'Amore.Sx Layout
148*32a712daSGarrett D'Amoreis processed.
149*32a712daSGarrett D'AmoreSome options accept arguments enclosed by parenthesis.
150*32a712daSGarrett D'AmoreThe following case-insensitive options are available:
151*32a712daSGarrett D'Amore.Bl -tag -width Ds
152*32a712daSGarrett D'Amore.It Cm center
153*32a712daSGarrett D'AmoreThis option is not supported by
154*32a712daSGarrett D'Amore.Xr mandoc 1 .
155*32a712daSGarrett D'AmoreThis may also be invoked with
156*32a712daSGarrett D'Amore.Cm centre .
157*32a712daSGarrett D'Amore.It Cm delim
158*32a712daSGarrett D'AmoreAccepts a two-character argument.
159*32a712daSGarrett D'AmoreThis option is not supported by
160*32a712daSGarrett D'Amore.Xr mandoc 1 .
161*32a712daSGarrett D'Amore.It Cm expand
162*32a712daSGarrett D'AmoreThis option is not supported by
163*32a712daSGarrett D'Amore.Xr mandoc 1 .
164*32a712daSGarrett D'Amore.It Cm box
165*32a712daSGarrett D'AmoreDraw a single-line box around the table.
166*32a712daSGarrett D'AmoreThis may also be invoked with
167*32a712daSGarrett D'Amore.Cm frame .
168*32a712daSGarrett D'Amore.It Cm doublebox
169*32a712daSGarrett D'AmoreDraw a double-line box around the table.
170*32a712daSGarrett D'AmoreThis may also be invoked with
171*32a712daSGarrett D'Amore.Cm doubleframe .
172*32a712daSGarrett D'Amore.It Cm allbox
173*32a712daSGarrett D'AmoreThis option is not supported by
174*32a712daSGarrett D'Amore.Xr mandoc 1 .
175*32a712daSGarrett D'Amore.It Cm tab
176*32a712daSGarrett D'AmoreAccepts a single-character argument.
177*32a712daSGarrett D'AmoreThis character is used as a delimiter between data cells, which otherwise
178*32a712daSGarrett D'Amoredefaults to the tab character.
179*32a712daSGarrett D'Amore.It Cm linesize
180*32a712daSGarrett D'AmoreAccepts a natural number (all digits).
181*32a712daSGarrett D'AmoreThis option is not supported by
182*32a712daSGarrett D'Amore.Xr mandoc 1 .
183*32a712daSGarrett D'Amore.It Cm nokeep
184*32a712daSGarrett D'AmoreThis option is not supported by
185*32a712daSGarrett D'Amore.Xr mandoc 1 .
186*32a712daSGarrett D'Amore.It Cm decimalpoint
187*32a712daSGarrett D'AmoreAccepts a single-character argument.
188*32a712daSGarrett D'AmoreThis character will be used as the decimal point with the
189*32a712daSGarrett D'Amore.Cm n
190*32a712daSGarrett D'Amorelayout key.
191*32a712daSGarrett D'Amore.It Cm nospaces
192*32a712daSGarrett D'AmoreThis option is not supported by
193*32a712daSGarrett D'Amore.Xr mandoc 1 .
194*32a712daSGarrett D'Amore.El
195*32a712daSGarrett D'Amore.Ss Layout
196*32a712daSGarrett D'AmoreThe table layout follows
197*32a712daSGarrett D'Amore.Sx Options
198*32a712daSGarrett D'Amoreor a
199*32a712daSGarrett D'Amore.Sq \&T&
200*32a712daSGarrett D'Amoremacro invocation.
201*32a712daSGarrett D'AmoreLayout specifies how data rows are displayed on output.
202*32a712daSGarrett D'AmoreEach layout line corresponds to a line of data; the last layout line
203*32a712daSGarrett D'Amoreapplies to all remaining data lines.
204*32a712daSGarrett D'AmoreLayout lines may also be separated by a comma.
205*32a712daSGarrett D'AmoreEach layout cell consists of one of the following case-insensitive keys:
206*32a712daSGarrett D'Amore.Bl -tag -width Ds
207*32a712daSGarrett D'Amore.It Cm c
208*32a712daSGarrett D'AmoreCentre a literal string within its column.
209*32a712daSGarrett D'Amore.It Cm r
210*32a712daSGarrett D'AmoreRight-justify a literal string within its column.
211*32a712daSGarrett D'Amore.It Cm l
212*32a712daSGarrett D'AmoreLeft-justify a literal string within its column.
213*32a712daSGarrett D'Amore.It Cm n
214*32a712daSGarrett D'AmoreJustify a number around its last decimal point.
215*32a712daSGarrett D'AmoreIf the decimal point is not found on the number, it's assumed to trail
216*32a712daSGarrett D'Amorethe number.
217*32a712daSGarrett D'Amore.It Cm s
218*32a712daSGarrett D'AmoreHorizontally span columns from the last
219*32a712daSGarrett D'Amore.No non- Ns Cm s
220*32a712daSGarrett D'Amoredata cell.
221*32a712daSGarrett D'AmoreIt is an error if spanning columns follow a
222*32a712daSGarrett D'Amore.Cm \-
223*32a712daSGarrett D'Amoreor
224*32a712daSGarrett D'Amore.Cm \(ba
225*32a712daSGarrett D'Amorecell, or come first.
226*32a712daSGarrett D'AmoreThis option is not supported by
227*32a712daSGarrett D'Amore.Xr mandoc 1 .
228*32a712daSGarrett D'Amore.It Cm a
229*32a712daSGarrett D'AmoreLeft-justify a literal string and pad with one space.
230*32a712daSGarrett D'Amore.It Cm ^
231*32a712daSGarrett D'AmoreVertically span rows from the last
232*32a712daSGarrett D'Amore.No non- Ns Cm ^
233*32a712daSGarrett D'Amoredata cell.
234*32a712daSGarrett D'AmoreIt is an error to invoke a vertical span on the first layout row.
235*32a712daSGarrett D'AmoreUnlike a horizontal spanner, you must specify an empty cell (if it not
236*32a712daSGarrett D'Amoreempty, the data is discarded) in the corresponding data cell.
237*32a712daSGarrett D'Amore.It Cm \-
238*32a712daSGarrett D'AmoreReplace the data cell (its contents will be lost) with a single
239*32a712daSGarrett D'Amorehorizontal line.
240*32a712daSGarrett D'AmoreThis may also be invoked with
241*32a712daSGarrett D'Amore.Cm _ .
242*32a712daSGarrett D'Amore.It Cm =
243*32a712daSGarrett D'AmoreReplace the data cell (its contents will be lost) with a double
244*32a712daSGarrett D'Amorehorizontal line.
245*32a712daSGarrett D'Amore.It Cm \(ba
246*32a712daSGarrett D'AmoreEmit a vertical bar instead of data.
247*32a712daSGarrett D'Amore.It Cm \(ba\(ba
248*32a712daSGarrett D'AmoreEmit a double-vertical bar instead of data.
249*32a712daSGarrett D'Amore.El
250*32a712daSGarrett D'Amore.Pp
251*32a712daSGarrett D'AmoreKeys may be followed by a set of modifiers.
252*32a712daSGarrett D'AmoreA modifier is either a modifier key or a natural number for specifying
253*32a712daSGarrett D'Amorethe minimum width of a column.
254*32a712daSGarrett D'AmoreThe following case-insensitive modifier keys are available:
255*32a712daSGarrett D'Amore.Cm z ,
256*32a712daSGarrett D'Amore.Cm u ,
257*32a712daSGarrett D'Amore.Cm e ,
258*32a712daSGarrett D'Amore.Cm t ,
259*32a712daSGarrett D'Amore.Cm d ,
260*32a712daSGarrett D'Amore.Cm b ,
261*32a712daSGarrett D'Amore.Cm i ,
262*32a712daSGarrett D'Amore.Cm r ,
263*32a712daSGarrett D'Amoreand
264*32a712daSGarrett D'Amore.Cm f
265*32a712daSGarrett D'Amore.Po
266*32a712daSGarrett D'Amorefollowed by
267*32a712daSGarrett D'Amore.Cm b ,
268*32a712daSGarrett D'Amore.Cm i ,
269*32a712daSGarrett D'Amore.Cm r ,
270*32a712daSGarrett D'Amore.Cm 3 ,
271*32a712daSGarrett D'Amore.Cm 2 ,
272*32a712daSGarrett D'Amoreor
273*32a712daSGarrett D'Amore.Cm 1
274*32a712daSGarrett D'Amore.Pc .
275*32a712daSGarrett D'AmoreAll of these are ignored by
276*32a712daSGarrett D'Amore.Xr mandoc 1 .
277*32a712daSGarrett D'Amore.Pp
278*32a712daSGarrett D'AmoreFor example, the following layout specifies a centre-justified column of
279*32a712daSGarrett D'Amoreminimum width 10, followed by vertical bar, followed by a left-justified
280*32a712daSGarrett D'Amorecolumn of minimum width 10, another vertical bar, then a column
281*32a712daSGarrett D'Amorejustified about the decimal point in numbers:
282*32a712daSGarrett D'Amore.Pp
283*32a712daSGarrett D'Amore.Dl c10 | l10 | n
284*32a712daSGarrett D'Amore.Ss Data
285*32a712daSGarrett D'AmoreThe data section follows the last layout row.
286*32a712daSGarrett D'AmoreBy default, cells in a data section are delimited by a tab.
287*32a712daSGarrett D'AmoreThis behaviour may be changed with the
288*32a712daSGarrett D'Amore.Cm tab
289*32a712daSGarrett D'Amoreoption.
290*32a712daSGarrett D'AmoreIf
291*32a712daSGarrett D'Amore.Cm _
292*32a712daSGarrett D'Amoreor
293*32a712daSGarrett D'Amore.Cm =
294*32a712daSGarrett D'Amoreis specified, a single or double line, respectively, is drawn across the
295*32a712daSGarrett D'Amoredata field.
296*32a712daSGarrett D'AmoreIf
297*32a712daSGarrett D'Amore.Cm \e-
298*32a712daSGarrett D'Amoreor
299*32a712daSGarrett D'Amore.Cm \e=
300*32a712daSGarrett D'Amoreis specified, a line is drawn within the data field (i.e. terminating
301*32a712daSGarrett D'Amorewithin the cell and not draw to the border).
302*32a712daSGarrett D'AmoreIf the last cell of a line is
303*32a712daSGarrett D'Amore.Cm T{ ,
304*32a712daSGarrett D'Amoreall subsequent lines are included as part of the cell until
305*32a712daSGarrett D'Amore.Cm T}
306*32a712daSGarrett D'Amoreis specified as its own data cell.
307*32a712daSGarrett D'AmoreIt may then be followed by a tab
308*32a712daSGarrett D'Amore.Pq or as designated by Cm tab
309*32a712daSGarrett D'Amoreor an end-of-line to terminate the row.
310*32a712daSGarrett D'Amore.Sh COMPATIBILITY
311*32a712daSGarrett D'AmoreThis section documents compatibility between mandoc and other
312*32a712daSGarrett D'Amore.Nm
313*32a712daSGarrett D'Amoreimplementations, at this time limited to GNU tbl.
314*32a712daSGarrett D'Amore.Pp
315*32a712daSGarrett D'Amore.Bl -dash -compact
316*32a712daSGarrett D'Amore.It
317*32a712daSGarrett D'AmoreIn GNU tbl, comments and macros are disallowed prior to the data block
318*32a712daSGarrett D'Amoreof a table.
319*32a712daSGarrett D'AmoreThe
320*32a712daSGarrett D'Amore.Xr mandoc 1
321*32a712daSGarrett D'Amoreimplementation allows them.
322*32a712daSGarrett D'Amore.El
323*32a712daSGarrett D'Amore.Sh SEE ALSO
324*32a712daSGarrett D'Amore.Xr mandoc 1 ,
325*32a712daSGarrett D'Amore.Xr man 5 ,
326*32a712daSGarrett D'Amore.Xr mandoc_char 5 ,
327*32a712daSGarrett D'Amore.Xr mdoc 5 ,
328*32a712daSGarrett D'Amore.Xr roff 5
329*32a712daSGarrett D'Amore.Rs
330*32a712daSGarrett D'Amore.%A M. E. Lesk
331*32a712daSGarrett D'Amore.%T Tbl\(emA Program to Format Tables
332*32a712daSGarrett D'Amore.%D June 11, 1976
333*32a712daSGarrett D'Amore.Re
334*32a712daSGarrett D'Amore.Sh HISTORY
335*32a712daSGarrett D'AmoreThe tbl utility, a preprocessor for troff, was originally written by M.
336*32a712daSGarrett D'AmoreE. Lesk at Bell Labs in 1975.
337*32a712daSGarrett D'AmoreThe GNU reimplementation of tbl, part of the groff package, was released
338*32a712daSGarrett D'Amorein 1990 by James Clark.
339*32a712daSGarrett D'AmoreA standalone tbl implementation was written by Kristaps Dzonsons in
340*32a712daSGarrett D'Amore2010.
341*32a712daSGarrett D'AmoreThis formed the basis of the implementation that is part of the
342*32a712daSGarrett D'Amore.Xr mandoc 1
343*32a712daSGarrett D'Amoreutility.
344*32a712daSGarrett D'Amore.Sh AUTHORS
345*32a712daSGarrett D'AmoreThis
346*32a712daSGarrett D'Amore.Nm
347*32a712daSGarrett D'Amorereference was written by
348*32a712daSGarrett D'Amore.An Kristaps Dzonsons ,
349*32a712daSGarrett D'Amore.Mt kristaps@bsd.lv .
350