xref: /titanic_54/usr/src/man/man5/tbl.5 (revision 260e9a87725c090ba5835b1f9f0b62fa2f96036f)
1*260e9a87SYuri Pankov.\"	$Id: tbl.7,v 1.26 2015/01/29 00:33:57 schwarze Exp $
2*260e9a87SYuri Pankov.\"
3*260e9a87SYuri Pankov.\" Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
4*260e9a87SYuri Pankov.\" Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
595c635efSGarrett D'Amore.\"
695c635efSGarrett D'Amore.\" Permission to use, copy, modify, and distribute this software for any
795c635efSGarrett D'Amore.\" purpose with or without fee is hereby granted, provided that the above
895c635efSGarrett D'Amore.\" copyright notice and this permission notice appear in all copies.
995c635efSGarrett D'Amore.\"
1095c635efSGarrett D'Amore.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1195c635efSGarrett D'Amore.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1295c635efSGarrett D'Amore.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1395c635efSGarrett D'Amore.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1495c635efSGarrett D'Amore.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1595c635efSGarrett D'Amore.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1695c635efSGarrett D'Amore.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1795c635efSGarrett D'Amore.\"
18*260e9a87SYuri Pankov.Dd $Mdocdate: January 29 2015 $
1995c635efSGarrett D'Amore.Dt TBL 5
2095c635efSGarrett D'Amore.Os
2195c635efSGarrett D'Amore.Sh NAME
2295c635efSGarrett D'Amore.Nm tbl
2395c635efSGarrett D'Amore.Nd tbl language reference for mandoc
2495c635efSGarrett D'Amore.Sh DESCRIPTION
2595c635efSGarrett D'AmoreThe
2695c635efSGarrett D'Amore.Nm tbl
2795c635efSGarrett D'Amorelanguage is a table-formatting language.
2895c635efSGarrett D'AmoreIt is used within
2995c635efSGarrett D'Amore.Xr mdoc 5
3095c635efSGarrett D'Amoreand
3195c635efSGarrett D'Amore.Xr man 5
3295c635efSGarrett D'Amore.Ux
3395c635efSGarrett D'Amoremanual pages.
3495c635efSGarrett D'AmoreThis manual describes the subset of the
3595c635efSGarrett D'Amore.Nm
3695c635efSGarrett D'Amorelanguage accepted by the
3795c635efSGarrett D'Amore.Xr mandoc 1
3895c635efSGarrett D'Amoreutility.
3995c635efSGarrett D'Amore.Pp
4095c635efSGarrett D'AmoreTables within
4195c635efSGarrett D'Amore.Xr mdoc 5
4295c635efSGarrett D'Amoreor
4395c635efSGarrett D'Amore.Xr man 5
4495c635efSGarrett D'Amoreare enclosed by the
4595c635efSGarrett D'Amore.Sq TS
4695c635efSGarrett D'Amoreand
4795c635efSGarrett D'Amore.Sq TE
4895c635efSGarrett D'Amoremacro tags, whose precise syntax is documented in
49*260e9a87SYuri Pankov.Xr mandoc_roff 5 .
5095c635efSGarrett D'AmoreTables consist of a series of options on a single line, followed by the
5195c635efSGarrett D'Amoretable layout, followed by data.
5295c635efSGarrett D'Amore.Pp
53*260e9a87SYuri PankovFor example, the following creates a boxed table with digits centered in
5495c635efSGarrett D'Amorethe cells.
5595c635efSGarrett D'Amore.Bd -literal -offset indent
5695c635efSGarrett D'Amore\&.TS
5795c635efSGarrett D'Amoretab(:) box;
5895c635efSGarrett D'Amorec5 c5 c5.
5995c635efSGarrett D'Amore1:2:3
6095c635efSGarrett D'Amore4:5:6
6195c635efSGarrett D'Amore\&.TE
6295c635efSGarrett D'Amore.Ed
6395c635efSGarrett D'Amore.Pp
6495c635efSGarrett D'AmoreWhen formatted, the following output is produced:
6595c635efSGarrett D'Amore.Bd -filled -offset indent -compact
6695c635efSGarrett D'Amore.TS
6795c635efSGarrett D'Amoretab(:) box;
6895c635efSGarrett D'Amorec5 c5 c5.
6995c635efSGarrett D'Amore1:2:3
7095c635efSGarrett D'Amore4:5:6
7195c635efSGarrett D'Amore.TE
7295c635efSGarrett D'Amore.Ed
7395c635efSGarrett D'Amore.Sh TABLE STRUCTURE
7495c635efSGarrett D'AmoreTables are enclosed by the
7595c635efSGarrett D'Amore.Sq TS
7695c635efSGarrett D'Amoreand
7795c635efSGarrett D'Amore.Sq TE
78*260e9a87SYuri Pankov.Xr mandoc_roff 5
7995c635efSGarrett D'Amoremacros.
8095c635efSGarrett D'AmoreA table consists of an optional single line of table
8195c635efSGarrett D'Amore.Sx Options
8295c635efSGarrett D'Amoreterminated by a semicolon, followed by one or more lines of
8395c635efSGarrett D'Amore.Sx Layout
8495c635efSGarrett D'Amorespecifications terminated by a period, then
8595c635efSGarrett D'Amore.Sx Data .
8695c635efSGarrett D'AmoreAll input must be 7-bit ASCII.
8795c635efSGarrett D'AmoreExample:
8895c635efSGarrett D'Amore.Bd -literal -offset indent
8995c635efSGarrett D'Amore\&.TS
9095c635efSGarrett D'Amorebox tab(:);
9195c635efSGarrett D'Amorec | c
9295c635efSGarrett D'Amore| c | c.
9395c635efSGarrett D'Amore1:2
9495c635efSGarrett D'Amore3:4
9595c635efSGarrett D'Amore\&.TE
9695c635efSGarrett D'Amore.Ed
9795c635efSGarrett D'Amore.Pp
9895c635efSGarrett D'AmoreTable data is
9995c635efSGarrett D'Amore.Em pre-processed ,
10095c635efSGarrett D'Amorethat is, data rows are parsed then inserted into the underlying stream
10195c635efSGarrett D'Amoreof input data.
10295c635efSGarrett D'AmoreThis allows data rows to be interspersed by arbitrary
103*260e9a87SYuri Pankov.Xr mandoc_roff 5 ,
10495c635efSGarrett D'Amore.Xr mdoc 5 ,
10595c635efSGarrett D'Amoreand
10695c635efSGarrett D'Amore.Xr man 5
10795c635efSGarrett D'Amoremacros such as
10895c635efSGarrett D'Amore.Bd -literal -offset indent
10995c635efSGarrett D'Amore\&.TS
11095c635efSGarrett D'Amoretab(:);
11195c635efSGarrett D'Amorec c c.
11295c635efSGarrett D'Amore1:2:3
11395c635efSGarrett D'Amore\&.Ao
11495c635efSGarrett D'Amore3:2:1
11595c635efSGarrett D'Amore\&.Ac
11695c635efSGarrett D'Amore\&.TE
11795c635efSGarrett D'Amore.Ed
11895c635efSGarrett D'Amore.Pp
11995c635efSGarrett D'Amorein the case of
12095c635efSGarrett D'Amore.Xr mdoc 5
12195c635efSGarrett D'Amoreor
12295c635efSGarrett D'Amore.Bd -literal -offset indent
12395c635efSGarrett D'Amore\&.TS
12495c635efSGarrett D'Amoretab(:);
12595c635efSGarrett D'Amorec c c.
12695c635efSGarrett D'Amore\&.ds ab 2
12795c635efSGarrett D'Amore1:\e*(ab:3
12895c635efSGarrett D'Amore\&.I
12995c635efSGarrett D'Amore3:2:1
13095c635efSGarrett D'Amore\&.TE
13195c635efSGarrett D'Amore.Ed
13295c635efSGarrett D'Amore.Pp
13395c635efSGarrett D'Amorein the case of
13495c635efSGarrett D'Amore.Xr man 5 .
13595c635efSGarrett D'Amore.Ss Options
136*260e9a87SYuri PankovThe first line of a table may contain options separated by spaces, tabs,
137*260e9a87SYuri Pankovor commas and terminated by a semicolon.
13895c635efSGarrett D'AmoreIf the first line does not have a terminating semicolon, it is assumed
13995c635efSGarrett D'Amorethat no options are specified and instead a
14095c635efSGarrett D'Amore.Sx Layout
14195c635efSGarrett D'Amoreis processed.
142*260e9a87SYuri PankovSome options require arguments enclosed by parentheses.
14395c635efSGarrett D'AmoreThe following case-insensitive options are available:
14495c635efSGarrett D'Amore.Bl -tag -width Ds
145*260e9a87SYuri Pankov.It Cm allbox
146*260e9a87SYuri PankovDraw a single-line box around each table cell.
147*260e9a87SYuri PankovCurrently treated as a synonym for
148*260e9a87SYuri Pankov.Cm box .
14995c635efSGarrett D'Amore.It Cm box
15095c635efSGarrett D'AmoreDraw a single-line box around the table.
151*260e9a87SYuri PankovFor GNU compatibility, this may also be invoked with
15295c635efSGarrett D'Amore.Cm frame .
153*260e9a87SYuri Pankov.It Cm center
154*260e9a87SYuri PankovCenter the table instead of left-adjusting it.
155*260e9a87SYuri PankovFor GNU compatibility, this may also be invoked with
156*260e9a87SYuri Pankov.Cm centre .
15795c635efSGarrett D'Amore.It Cm decimalpoint
158*260e9a87SYuri PankovUse the single-character argument as the decimal point with the
15995c635efSGarrett D'Amore.Cm n
16095c635efSGarrett D'Amorelayout key.
161*260e9a87SYuri PankovThis is a GNU extension.
162*260e9a87SYuri Pankov.It Cm delim
163*260e9a87SYuri PankovUse the two characters of the argument as
164*260e9a87SYuri Pankov.Xr eqn 5
165*260e9a87SYuri Pankovdelimiters.
166*260e9a87SYuri PankovCurrently unsupported.
167*260e9a87SYuri Pankov.It Cm doublebox
168*260e9a87SYuri PankovDraw a double-line box around the table.
169*260e9a87SYuri PankovFor GNU compatibility, this may also be invoked with
170*260e9a87SYuri Pankov.Cm doubleframe .
171*260e9a87SYuri Pankov.It Cm expand
172*260e9a87SYuri PankovIncrease the width of the table to the current line length.
173*260e9a87SYuri PankovCurrently ignored.
174*260e9a87SYuri Pankov.It Cm linesize
175*260e9a87SYuri PankovDraw lines with the point size given by the unsigned integer argument.
176*260e9a87SYuri PankovCurrently ignored.
177*260e9a87SYuri Pankov.It Cm nokeep
178*260e9a87SYuri PankovAllow page breaks within the table.
179*260e9a87SYuri PankovThis is a GNU extension and currently ignored.
18095c635efSGarrett D'Amore.It Cm nospaces
181*260e9a87SYuri PankovIgnore leading and trailing spaces in data cells.
182*260e9a87SYuri PankovThis is a GNU extension and currently ignored.
183*260e9a87SYuri Pankov.It Cm nowarn
184*260e9a87SYuri PankovSuppress warnings about tables exceeding the current line length.
185*260e9a87SYuri PankovThis is a GNU extension and currently ignored.
186*260e9a87SYuri Pankov.It Cm tab
187*260e9a87SYuri PankovUse the single-character argument as a delimiter between data cells.
188*260e9a87SYuri PankovBy default, the tab character is used.
18995c635efSGarrett D'Amore.El
19095c635efSGarrett D'Amore.Ss Layout
19195c635efSGarrett D'AmoreThe table layout follows
19295c635efSGarrett D'Amore.Sx Options
19395c635efSGarrett D'Amoreor a
19495c635efSGarrett D'Amore.Sq \&T&
19595c635efSGarrett D'Amoremacro invocation.
19695c635efSGarrett D'AmoreLayout specifies how data rows are displayed on output.
19795c635efSGarrett D'AmoreEach layout line corresponds to a line of data; the last layout line
19895c635efSGarrett D'Amoreapplies to all remaining data lines.
19995c635efSGarrett D'AmoreLayout lines may also be separated by a comma.
20095c635efSGarrett D'AmoreEach layout cell consists of one of the following case-insensitive keys:
201*260e9a87SYuri Pankov.Bl -tag -width 2n
20295c635efSGarrett D'Amore.It Cm c
203*260e9a87SYuri PankovCenter a literal string within its column.
20495c635efSGarrett D'Amore.It Cm r
20595c635efSGarrett D'AmoreRight-justify a literal string within its column.
20695c635efSGarrett D'Amore.It Cm l
20795c635efSGarrett D'AmoreLeft-justify a literal string within its column.
20895c635efSGarrett D'Amore.It Cm n
20995c635efSGarrett D'AmoreJustify a number around its last decimal point.
21095c635efSGarrett D'AmoreIf the decimal point is not found on the number, it's assumed to trail
21195c635efSGarrett D'Amorethe number.
21295c635efSGarrett D'Amore.It Cm s
21395c635efSGarrett D'AmoreHorizontally span columns from the last
21495c635efSGarrett D'Amore.No non- Ns Cm s
21595c635efSGarrett D'Amoredata cell.
21695c635efSGarrett D'AmoreIt is an error if spanning columns follow a
21795c635efSGarrett D'Amore.Cm \-
21895c635efSGarrett D'Amoreor
21995c635efSGarrett D'Amore.Cm \(ba
22095c635efSGarrett D'Amorecell, or come first.
22195c635efSGarrett D'AmoreThis option is not supported by
22295c635efSGarrett D'Amore.Xr mandoc 1 .
22395c635efSGarrett D'Amore.It Cm a
22495c635efSGarrett D'AmoreLeft-justify a literal string and pad with one space.
22595c635efSGarrett D'Amore.It Cm ^
22695c635efSGarrett D'AmoreVertically span rows from the last
22795c635efSGarrett D'Amore.No non- Ns Cm ^
22895c635efSGarrett D'Amoredata cell.
22995c635efSGarrett D'AmoreIt is an error to invoke a vertical span on the first layout row.
23095c635efSGarrett D'AmoreUnlike a horizontal spanner, you must specify an empty cell (if it not
23195c635efSGarrett D'Amoreempty, the data is discarded) in the corresponding data cell.
23295c635efSGarrett D'Amore.It Cm \-
23395c635efSGarrett D'AmoreReplace the data cell (its contents will be lost) with a single
23495c635efSGarrett D'Amorehorizontal line.
23595c635efSGarrett D'AmoreThis may also be invoked with
23695c635efSGarrett D'Amore.Cm _ .
23795c635efSGarrett D'Amore.It Cm =
23895c635efSGarrett D'AmoreReplace the data cell (its contents will be lost) with a double
23995c635efSGarrett D'Amorehorizontal line.
24095c635efSGarrett D'Amore.It Cm \(ba
24195c635efSGarrett D'AmoreEmit a vertical bar instead of data.
24295c635efSGarrett D'Amore.It Cm \(ba\(ba
24395c635efSGarrett D'AmoreEmit a double-vertical bar instead of data.
24495c635efSGarrett D'Amore.El
24595c635efSGarrett D'Amore.Pp
24695c635efSGarrett D'AmoreKeys may be followed by a set of modifiers.
24795c635efSGarrett D'AmoreA modifier is either a modifier key or a natural number for specifying
24895c635efSGarrett D'Amorethe minimum width of a column.
24995c635efSGarrett D'AmoreThe following case-insensitive modifier keys are available:
250*260e9a87SYuri Pankov.Bl -tag -width 2n
251*260e9a87SYuri Pankov.It Cm b
252*260e9a87SYuri PankovUse a bold font for the contents of this column.
253*260e9a87SYuri Pankov.It Cm d
254*260e9a87SYuri PankovMove cell content down to the last cell of a vertical span.
255*260e9a87SYuri PankovCurrently ignored.
256*260e9a87SYuri Pankov.It Cm e
257*260e9a87SYuri PankovMake this column wider to match the maximum width
258*260e9a87SYuri Pankovof any other column also having the
259*260e9a87SYuri Pankov.Cm e
260*260e9a87SYuri Pankovmodifier.
261*260e9a87SYuri Pankov.It Cm f
262*260e9a87SYuri PankovThe next character selects the font to use for this column.
263*260e9a87SYuri PankovSee the
264*260e9a87SYuri Pankov.Xr mandoc_roff 5
265*260e9a87SYuri Pankovmanual for supported one-character font names.
266*260e9a87SYuri Pankov.It Cm i
267*260e9a87SYuri PankovUse an italic font for the contents of this column.
268*260e9a87SYuri Pankov.It Cm m
269*260e9a87SYuri PankovSpecify a cell start macro.
270*260e9a87SYuri PankovThis is a GNU extension and currently unsupported.
271*260e9a87SYuri Pankov.It Cm p
272*260e9a87SYuri PankovSet the point size to the following unsigned argument,
273*260e9a87SYuri Pankovor change it by the following signed argument.
274*260e9a87SYuri PankovCurrently ignored.
275*260e9a87SYuri Pankov.It Cm v
276*260e9a87SYuri PankovSet the vertical line spacing to the following unsigned argument,
277*260e9a87SYuri Pankovor change it by the following signed argument.
278*260e9a87SYuri PankovCurrently ignored.
279*260e9a87SYuri Pankov.It Cm t
280*260e9a87SYuri PankovDo not vertically center cell content in the vertical span,
281*260e9a87SYuri Pankovleave it at the top.
282*260e9a87SYuri PankovCurrently ignored.
283*260e9a87SYuri Pankov.It Cm u
284*260e9a87SYuri PankovMove cell content up by half a table line.
285*260e9a87SYuri PankovCurrently ignored.
286*260e9a87SYuri Pankov.It Cm w
287*260e9a87SYuri PankovSpecify minimum column width.
288*260e9a87SYuri PankovCurrently ignored.
289*260e9a87SYuri Pankov.It Cm x
290*260e9a87SYuri PankovAfter determining the width of all other columns, distribute the
291*260e9a87SYuri Pankovrest of the line length among all columns having the
292*260e9a87SYuri Pankov.Cm x
293*260e9a87SYuri Pankovmodifier.
294*260e9a87SYuri Pankov.It Cm z
295*260e9a87SYuri PankovDo not use this cell for determining the width of this column.
296*260e9a87SYuri Pankov.El
29795c635efSGarrett D'Amore.Pp
298*260e9a87SYuri PankovFor example, the following layout specifies a center-justified column of
29995c635efSGarrett D'Amoreminimum width 10, followed by vertical bar, followed by a left-justified
300*260e9a87SYuri Pankovcolumn of minimum width 10, another vertical bar, then a column using
301*260e9a87SYuri Pankovbold font justified about the decimal point in numbers:
30295c635efSGarrett D'Amore.Pp
303*260e9a87SYuri Pankov.Dl c10 | l10 | nfB
30495c635efSGarrett D'Amore.Ss Data
30595c635efSGarrett D'AmoreThe data section follows the last layout row.
30695c635efSGarrett D'AmoreBy default, cells in a data section are delimited by a tab.
30795c635efSGarrett D'AmoreThis behaviour may be changed with the
30895c635efSGarrett D'Amore.Cm tab
30995c635efSGarrett D'Amoreoption.
31095c635efSGarrett D'AmoreIf
31195c635efSGarrett D'Amore.Cm _
31295c635efSGarrett D'Amoreor
31395c635efSGarrett D'Amore.Cm =
31495c635efSGarrett D'Amoreis specified, a single or double line, respectively, is drawn across the
31595c635efSGarrett D'Amoredata field.
31695c635efSGarrett D'AmoreIf
31795c635efSGarrett D'Amore.Cm \e-
31895c635efSGarrett D'Amoreor
31995c635efSGarrett D'Amore.Cm \e=
32095c635efSGarrett D'Amoreis specified, a line is drawn within the data field (i.e. terminating
32195c635efSGarrett D'Amorewithin the cell and not draw to the border).
32295c635efSGarrett D'AmoreIf the last cell of a line is
32395c635efSGarrett D'Amore.Cm T{ ,
32495c635efSGarrett D'Amoreall subsequent lines are included as part of the cell until
32595c635efSGarrett D'Amore.Cm T}
32695c635efSGarrett D'Amoreis specified as its own data cell.
32795c635efSGarrett D'AmoreIt may then be followed by a tab
32895c635efSGarrett D'Amore.Pq or as designated by Cm tab
32995c635efSGarrett D'Amoreor an end-of-line to terminate the row.
33095c635efSGarrett D'Amore.Sh COMPATIBILITY
33195c635efSGarrett D'AmoreThe
33295c635efSGarrett D'Amore.Xr mandoc 1
333*260e9a87SYuri Pankovimplementation of
334*260e9a87SYuri Pankov.Nm
335*260e9a87SYuri Pankovdoesn't support
336*260e9a87SYuri Pankov.Xr mdoc 5
337*260e9a87SYuri Pankovand
338*260e9a87SYuri Pankov.Xr man 5
339*260e9a87SYuri Pankovmacros and
340*260e9a87SYuri Pankov.Xr eqn 5
341*260e9a87SYuri Pankovequations inside tables.
34295c635efSGarrett D'Amore.Sh SEE ALSO
34395c635efSGarrett D'Amore.Xr mandoc 1 ,
34495c635efSGarrett D'Amore.Xr man 5 ,
34595c635efSGarrett D'Amore.Xr mandoc_char 5 ,
346*260e9a87SYuri Pankov.Xr mandoc_roff 5 ,
347*260e9a87SYuri Pankov.Xr mdoc 5
34895c635efSGarrett D'Amore.Rs
34995c635efSGarrett D'Amore.%A M. E. Lesk
35095c635efSGarrett D'Amore.%T Tbl\(emA Program to Format Tables
35195c635efSGarrett D'Amore.%D June 11, 1976
35295c635efSGarrett D'Amore.Re
35395c635efSGarrett D'Amore.Sh HISTORY
35495c635efSGarrett D'AmoreThe tbl utility, a preprocessor for troff, was originally written by M.
35595c635efSGarrett D'AmoreE. Lesk at Bell Labs in 1975.
35695c635efSGarrett D'AmoreThe GNU reimplementation of tbl, part of the groff package, was released
35795c635efSGarrett D'Amorein 1990 by James Clark.
35895c635efSGarrett D'AmoreA standalone tbl implementation was written by Kristaps Dzonsons in
35995c635efSGarrett D'Amore2010.
36095c635efSGarrett D'AmoreThis formed the basis of the implementation that is part of the
36195c635efSGarrett D'Amore.Xr mandoc 1
36295c635efSGarrett D'Amoreutility.
36395c635efSGarrett D'Amore.Sh AUTHORS
36495c635efSGarrett D'AmoreThis
36595c635efSGarrett D'Amore.Nm
36695c635efSGarrett D'Amorereference was written by
367*260e9a87SYuri Pankov.An Kristaps Dzonsons Aq Mt kristaps@bsd.lv .
368