1 .\" $Id: tbl.7,v 1.37 2021/09/18 12:34:27 schwarze Exp $
3 .\" Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
4 .\" Copyright (c) 2014,2015,2017,2018,2019 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: September 18 2021 $
23 .Nd tbl language reference for mandoc
27 language formats tables.
33 This manual describes the subset of the
35 language accepted by the
39 Each table is started with a
42 macro, consist of at most one line of
48 lines, and ends with a
51 All input must be 7-bit ASCII.
53 If the first input line of a table ends with a semicolon, it contains
54 case-insensitive options separated by spaces, tabs, or commas.
55 Otherwise, it is interpreted as the first
59 The following options are available.
60 Some of them require arguments enclosed in parentheses:
63 Draw a single-line box around each table cell.
65 Draw a single-line box around the table.
66 For GNU compatibility, this may also be invoked with
69 Center the table instead of left-adjusting it.
70 For GNU compatibility, this may also be invoked with
73 Use the single-character argument as the decimal point with the
76 This is a GNU extension.
78 Use the two characters of the argument as
81 Currently unsupported.
83 Draw a double-line box around the table.
84 For GNU compatibility, this may also be invoked with
87 Increase the width of the table to the current line length.
90 Draw lines with the point size given by the unsigned integer argument.
93 Allow page breaks within the table.
94 This is a GNU extension and currently ignored.
96 Ignore leading and trailing spaces in data cells.
97 This is a GNU extension.
99 Suppress warnings about tables exceeding the current line length.
100 This is a GNU extension and currently ignored.
102 Use the single-character argument as a delimiter between data cells.
103 By default, the horizontal tabulator character is used.
106 The table layout follows an
114 Each layout line specifies how one line of
117 The last layout line ends with a full stop.
118 It also applies to all remaining data lines.
119 Multiple layout lines can be joined by commas on a single physical
122 Each layout line consists of one or more layout cell specifications,
123 optionally separated by whitespace.
124 The following case-insensitive key characters start a new cell
128 Center the string in this cell.
130 Right-justify the string in this cell.
132 Left-justify the string in this cell.
134 Justify a number around its last decimal point.
135 If no decimal point is found in the number,
136 it is assumed to trail the number.
138 Horizontally span columns from the last
141 It is an error if a column span follows a
145 cell, or comes first on a layout line.
146 The combined cell as a whole consumes only one cell
147 of the corresponding data line.
149 Left-justify a string and pad with one space.
151 Vertically span rows from the last
154 It is an error to invoke a vertical span on the first layout line.
155 Unlike a horizontal span, a vertical span consumes a data cell
156 and discards the content.
158 Draw a single horizontal line in this cell.
159 This consumes a data cell and discards the content.
160 It may also be invoked with
163 Draw a double horizontal line in this cell.
164 This consumes a data cell and discards the content.
167 Each cell key may be followed by zero or more of the following
168 case-insensitive modifiers:
171 Use a bold font for the contents of this cell.
173 Move content down to the last row of this vertical span.
176 Make this column wider to match the maximum width
177 of any other column also having the
181 The next one or two characters select the font to use for this cell.
182 One-character font names must be followed by a blank or period.
185 manual for supported font names.
187 Use an italic font for the contents of this cell.
189 Specify a cell start macro.
190 This is a GNU extension and currently unsupported.
192 Set the point size to the following unsigned argument,
193 or change it by the following signed argument.
196 Set the vertical line spacing to the following unsigned argument,
197 or change it by the following signed argument.
200 Do not vertically center content in this vertical span,
201 leave it in the top row.
204 Move cell content up by half a table row.
207 Specify a minimum column width.
209 After determining the width of all other columns, distribute the
210 rest of the line length among all columns having the
214 Do not use this cell for determining the width of this column.
216 Draw a single vertical line to the right of this cell.
218 Draw a double vertical line to the right of this cell.
221 If a modifier consists of decimal digits,
222 it specifies a minimum spacing in units of
224 between this column and the next column to the right.
226 If there is a vertical line, it is drawn inside the spacing.
228 The data section follows the last
231 Each data line consists of one or more data cells, delimited by
235 If a data cell contains only the two bytes
237 the cell above spans to this row, as if the layout specification
241 If a data cell contains only the single character
245 a single or double horizontal line is drawn across the cell,
246 joining its neighbours.
247 If a data cell contains only the two character sequence
251 a single or double horizontal line is drawn inside the cell,
252 not joining its neighbours.
253 If a data line contains nothing but the single character
257 a horizontal line across the whole table is inserted
258 without consuming a layout row.
260 In place of any data cell, a text block can be used.
263 at the end of a physical input line.
264 Input line breaks inside the text block
265 neither end the text block nor its data cell.
268 occurs at the beginning of a physical input line and is followed
269 by an end-of-cell indicator.
272 is followed by the end of the physical input line, the text block,
273 the data cell, and the data line ends at this point.
278 character, only the text block and the data cell end,
279 but the data line continues with the data cell following the
284 is followed by any other character, it does not end the text block,
285 which instead continues to the following physical input line.
287 String justification and font selection:
288 .Bd -literal -offset indent
297 .Bd -filled -offset indent
309 to show number alignment and line drawing:
310 .Bd -literal -offset indent
323 .Bd -filled -offset indent
337 Spans and skipping width calculations:
338 .Bd -literal -offset indent
349 .Bd -filled -offset indent
361 Text blocks, specifying spacings and specifying and equalizing
362 column widths, putting lines into individual cells, and overriding
364 .Bd -literal -offset indent
368 The fourth line:_:line 1
369 of this column:=:line 2
372 This text is too wide to fit into a column of width 17.
379 .Bd -filled -offset indent
383 The fourth line:_:line 1
384 of this column:=:line 2
387 This text is too wide to fit into a column of width 17.
395 These examples were constructed to demonstrate many
397 features in a compact way.
398 In real manual pages, keep tables as simple as possible.
399 They usually look better, are less fragile, and are more portable.
411 equations inside tables.
420 .%T Tbl \(em A Program to Format Tables
424 The tbl utility, a preprocessor for troff, was originally written by M.
425 E. Lesk at Bell Labs in 1975.
426 The GNU reimplementation of tbl, part of the groff package, was released
427 in 1990 by James Clark.
428 A standalone tbl implementation was written by Kristaps Dzonsons in
430 This formed the basis of the implementation that first appeared in
438 reference was written by
439 .An Kristaps Dzonsons Aq Mt kristaps@bsd.lv
441 .An Ingo Schwarze Aq Mt schwarze@openbsd.org .
446 output mode, heavy lines are drawn instead of double lines.
447 This cannot be improved because the Unicode standard only provides
448 an incomplete set of box drawing characters with double lines,
449 whereas it provides a full set of box drawing characters
451 It is unlikely this can be improved in the future because the box
452 drawing characters are already marked in Unicode as characters
453 intended only for backward compatibility with legacy systems,
454 and their use is not encouraged.
455 So it seems unlikely that the missing ones might get added in the future.