1 .\" $Id: tbl.7,v 1.21 2014/11/26 17:51:55 schwarze Exp $
3 .\" Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
4 .\" Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
6 .\" Permission to use, copy, modify, and distribute this software for any
7 .\" purpose with or without fee is hereby granted, provided that the above
8 .\" copyright notice and this permission notice appear in all copies.
10 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 .Dd $Mdocdate: November 26 2014 $
23 .Nd tbl language reference for mandoc
27 language is a table-formatting language.
34 This manual describes the subset of the
36 language accepted by the
48 macro tags, whose precise syntax is documented in
50 Tables consist of a series of options on a single line, followed by the
51 table layout, followed by data.
53 For example, the following creates a boxed table with digits centred in
55 .Bd -literal -offset indent
64 When formatted, the following output is produced:
65 .Bd -filled -offset indent -compact
74 Tables are enclosed by the
80 A table consists of an optional single line of table
82 terminated by a semicolon, followed by one or more lines of
84 specifications terminated by a period, then
86 All input must be 7-bit ASCII.
88 .Bd -literal -offset indent
100 that is, data rows are parsed then inserted into the underlying stream
102 This allows data rows to be interspersed by arbitrary
108 .Bd -literal -offset indent
122 .Bd -literal -offset indent
136 The first line of a table consists of space-separated option keys and
137 modifiers terminated by a semicolon.
138 For GNU compatibility, option keys can also be separated by commas.
139 If the first line does not have a terminating semicolon, it is assumed
140 that no options are specified and instead a
143 Some options accept arguments enclosed by parenthesis.
144 The following case-insensitive options are available:
147 This option is not supported by
149 This may also be invoked with
152 Accepts a two-character argument.
153 This option is not supported by
156 This option is not supported by
159 Draw a single-line box around the table.
160 This may also be invoked with
163 Draw a double-line box around the table.
164 This may also be invoked with
167 This option is not supported by
170 Accepts a single-character argument.
171 This character is used as a delimiter between data cells, which otherwise
172 defaults to the tab character.
174 Accepts a natural number (all digits).
175 This option is not supported by
178 This option is not supported by
181 Accepts a single-character argument.
182 This character will be used as the decimal point with the
186 This option is not supported by
190 The table layout follows
195 Layout specifies how data rows are displayed on output.
196 Each layout line corresponds to a line of data; the last layout line
197 applies to all remaining data lines.
198 Layout lines may also be separated by a comma.
199 Each layout cell consists of one of the following case-insensitive keys:
202 Centre a literal string within its column.
204 Right-justify a literal string within its column.
206 Left-justify a literal string within its column.
208 Justify a number around its last decimal point.
209 If the decimal point is not found on the number, it's assumed to trail
212 Horizontally span columns from the last
215 It is an error if spanning columns follow a
220 This option is not supported by
223 Left-justify a literal string and pad with one space.
225 Vertically span rows from the last
228 It is an error to invoke a vertical span on the first layout row.
229 Unlike a horizontal spanner, you must specify an empty cell (if it not
230 empty, the data is discarded) in the corresponding data cell.
232 Replace the data cell (its contents will be lost) with a single
234 This may also be invoked with
237 Replace the data cell (its contents will be lost) with a double
240 Emit a vertical bar instead of data.
242 Emit a double-vertical bar instead of data.
245 Keys may be followed by a set of modifiers.
246 A modifier is either a modifier key or a natural number for specifying
247 the minimum width of a column.
248 The following case-insensitive modifier keys are available:
251 Use a bold font for the contents of this column.
253 Make this column wider to match the maximum width
254 of any other column also having the
258 The next character selects the font to use for this column.
261 manual for supported one-character font names.
263 Use an italic font for the contents of this column.
265 After determining the width of all other columns, distribute the
266 rest of the line length among all columns having the
270 Do not use this cell for determining the width of this column.
282 For example, the following layout specifies a centre-justified column of
283 minimum width 10, followed by vertical bar, followed by a left-justified
284 column of minimum width 10, another vertical bar, then a column using
285 bold font justified about the decimal point in numbers:
289 The data section follows the last layout row.
290 By default, cells in a data section are delimited by a tab.
291 This behaviour may be changed with the
298 is specified, a single or double line, respectively, is drawn across the
304 is specified, a line is drawn within the data field (i.e. terminating
305 within the cell and not draw to the border).
306 If the last cell of a line is
308 all subsequent lines are included as part of the cell until
310 is specified as its own data cell.
311 It may then be followed by a tab
312 .Pq or as designated by Cm tab
313 or an end-of-line to terminate the row.
315 This section documents compatibility between mandoc and other
317 implementations, at this time limited to GNU tbl.
321 In GNU tbl, comments and macros are disallowed prior to the data block
325 implementation allows them.
335 .%T Tbl\(emA Program to Format Tables
339 The tbl utility, a preprocessor for troff, was originally written by M.
340 E. Lesk at Bell Labs in 1975.
341 The GNU reimplementation of tbl, part of the groff package, was released
342 in 1990 by James Clark.
343 A standalone tbl implementation was written by Kristaps Dzonsons in
345 This formed the basis of the implementation that is part of the
351 reference was written by
352 .An Kristaps Dzonsons Aq Mt kristaps@bsd.lv .