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