1*0a6a1f1dSLionel Sambuc.\" Id: tbl.7,v 1.18 2013/09/16 22:39:19 schwarze Exp 2d65f6f70SBen Gras.\" 392395e9cSLionel Sambuc.\" Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> 4d65f6f70SBen Gras.\" 5d65f6f70SBen Gras.\" Permission to use, copy, modify, and distribute this software for any 6d65f6f70SBen Gras.\" purpose with or without fee is hereby granted, provided that the above 7d65f6f70SBen Gras.\" copyright notice and this permission notice appear in all copies. 8d65f6f70SBen Gras.\" 9d65f6f70SBen Gras.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10d65f6f70SBen Gras.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11d65f6f70SBen Gras.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12d65f6f70SBen Gras.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13d65f6f70SBen Gras.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14d65f6f70SBen Gras.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15d65f6f70SBen Gras.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16d65f6f70SBen Gras.\" 17*0a6a1f1dSLionel Sambuc.Dd September 16, 2013 18d65f6f70SBen Gras.Dt TBL 7 19d65f6f70SBen Gras.Os 20d65f6f70SBen Gras.Sh NAME 21d65f6f70SBen Gras.Nm tbl 22d65f6f70SBen Gras.Nd tbl language reference for mandoc 23d65f6f70SBen Gras.Sh DESCRIPTION 24d65f6f70SBen GrasThe 25d65f6f70SBen Gras.Nm tbl 26d65f6f70SBen Graslanguage is a table-formatting language. 27d65f6f70SBen GrasIt is used within 28d65f6f70SBen Gras.Xr mdoc 7 29d65f6f70SBen Grasand 30d65f6f70SBen Gras.Xr man 7 31d65f6f70SBen Gras.Ux 32d65f6f70SBen Grasmanual pages. 33d65f6f70SBen GrasThis manual describes the subset of the 34d65f6f70SBen Gras.Nm 35d65f6f70SBen Graslanguage accepted by the 36d65f6f70SBen Gras.Xr mandoc 1 37d65f6f70SBen Grasutility. 38d65f6f70SBen Gras.Pp 39d65f6f70SBen GrasTables within 40d65f6f70SBen Gras.Xr mdoc 7 41d65f6f70SBen Grasor 42d65f6f70SBen Gras.Xr man 7 43d65f6f70SBen Grasare enclosed by the 44d65f6f70SBen Gras.Sq TS 45d65f6f70SBen Grasand 46d65f6f70SBen Gras.Sq TE 47d65f6f70SBen Grasmacro tags, whose precise syntax is documented in 48d65f6f70SBen Gras.Xr roff 7 . 49d65f6f70SBen GrasTables consist of a series of options on a single line, followed by the 50d65f6f70SBen Grastable layout, followed by data. 51d65f6f70SBen Gras.Pp 5292395e9cSLionel SambucFor example, the following creates a boxed table with digits centred in 53d65f6f70SBen Grasthe cells. 54d65f6f70SBen Gras.Bd -literal -offset indent 55d65f6f70SBen Gras\&.TS 56d65f6f70SBen Grastab(:) box; 57d65f6f70SBen Grasc5 c5 c5. 58d65f6f70SBen Gras1:2:3 59d65f6f70SBen Gras4:5:6 60d65f6f70SBen Gras\&.TE 61d65f6f70SBen Gras.Ed 62d65f6f70SBen Gras.Pp 63d65f6f70SBen GrasWhen formatted, the following output is produced: 64d65f6f70SBen Gras.Bd -filled -offset indent -compact 65d65f6f70SBen Gras.TS 66d65f6f70SBen Grastab(:) box; 67d65f6f70SBen Grasc5 c5 c5. 68d65f6f70SBen Gras1:2:3 69d65f6f70SBen Gras4:5:6 70d65f6f70SBen Gras.TE 71d65f6f70SBen Gras.Ed 72d65f6f70SBen Gras.Sh TABLE STRUCTURE 73d65f6f70SBen GrasTables are enclosed by the 74d65f6f70SBen Gras.Sq TS 75d65f6f70SBen Grasand 76d65f6f70SBen Gras.Sq TE 77d65f6f70SBen Gras.Xr roff 7 78d65f6f70SBen Grasmacros. 79d65f6f70SBen GrasA table consists of an optional single line of table 80d65f6f70SBen Gras.Sx Options 81d65f6f70SBen Grasterminated by a semicolon, followed by one or more lines of 82d65f6f70SBen Gras.Sx Layout 83d65f6f70SBen Grasspecifications terminated by a period, then 84d65f6f70SBen Gras.Sx Data . 85d65f6f70SBen GrasAll input must be 7-bit ASCII. 86d65f6f70SBen GrasExample: 87d65f6f70SBen Gras.Bd -literal -offset indent 88d65f6f70SBen Gras\&.TS 89d65f6f70SBen Grasbox tab(:); 90d65f6f70SBen Grasc | c 91d65f6f70SBen Gras| c | c. 92d65f6f70SBen Gras1:2 93d65f6f70SBen Gras3:4 94d65f6f70SBen Gras\&.TE 95d65f6f70SBen Gras.Ed 96d65f6f70SBen Gras.Pp 97d65f6f70SBen GrasTable data is 98d65f6f70SBen Gras.Em pre-processed , 99d65f6f70SBen Grasthat is, data rows are parsed then inserted into the underlying stream 100d65f6f70SBen Grasof input data. 101d65f6f70SBen GrasThis allows data rows to be interspersed by arbitrary 102d65f6f70SBen Gras.Xr roff 7 , 103d65f6f70SBen Gras.Xr mdoc 7 , 104d65f6f70SBen Grasand 105d65f6f70SBen Gras.Xr man 7 106d65f6f70SBen Grasmacros such as 107d65f6f70SBen Gras.Bd -literal -offset indent 108d65f6f70SBen Gras\&.TS 109d65f6f70SBen Grastab(:); 110d65f6f70SBen Grasc c c. 111d65f6f70SBen Gras1:2:3 112d65f6f70SBen Gras\&.Ao 113d65f6f70SBen Gras3:2:1 114d65f6f70SBen Gras\&.Ac 115d65f6f70SBen Gras\&.TE 116d65f6f70SBen Gras.Ed 117d65f6f70SBen Gras.Pp 118d65f6f70SBen Grasin the case of 119d65f6f70SBen Gras.Xr mdoc 7 120d65f6f70SBen Grasor 121d65f6f70SBen Gras.Bd -literal -offset indent 122d65f6f70SBen Gras\&.TS 123d65f6f70SBen Grastab(:); 124d65f6f70SBen Grasc c c. 125d65f6f70SBen Gras\&.ds ab 2 126d65f6f70SBen Gras1:\e*(ab:3 127d65f6f70SBen Gras\&.I 128d65f6f70SBen Gras3:2:1 129d65f6f70SBen Gras\&.TE 130d65f6f70SBen Gras.Ed 131d65f6f70SBen Gras.Pp 132d65f6f70SBen Grasin the case of 133d65f6f70SBen Gras.Xr man 7 . 134d65f6f70SBen Gras.Ss Options 135d65f6f70SBen GrasThe first line of a table consists of space-separated option keys and 136d65f6f70SBen Grasmodifiers terminated by a semicolon. 137d65f6f70SBen GrasIf the first line does not have a terminating semicolon, it is assumed 138d65f6f70SBen Grasthat no options are specified and instead a 139d65f6f70SBen Gras.Sx Layout 140d65f6f70SBen Grasis processed. 141d65f6f70SBen GrasSome options accept arguments enclosed by parenthesis. 142d65f6f70SBen GrasThe following case-insensitive options are available: 143d65f6f70SBen Gras.Bl -tag -width Ds 144d65f6f70SBen Gras.It Cm center 145d65f6f70SBen GrasThis option is not supported by 146d65f6f70SBen Gras.Xr mandoc 1 . 147d65f6f70SBen GrasThis may also be invoked with 148d65f6f70SBen Gras.Cm centre . 149d65f6f70SBen Gras.It Cm delim 150d65f6f70SBen GrasAccepts a two-character argument. 151d65f6f70SBen GrasThis option is not supported by 152d65f6f70SBen Gras.Xr mandoc 1 . 153d65f6f70SBen Gras.It Cm expand 154d65f6f70SBen GrasThis option is not supported by 155d65f6f70SBen Gras.Xr mandoc 1 . 156d65f6f70SBen Gras.It Cm box 157d65f6f70SBen GrasDraw a single-line box around the table. 158d65f6f70SBen GrasThis may also be invoked with 159d65f6f70SBen Gras.Cm frame . 160d65f6f70SBen Gras.It Cm doublebox 161d65f6f70SBen GrasDraw a double-line box around the table. 162d65f6f70SBen GrasThis may also be invoked with 163d65f6f70SBen Gras.Cm doubleframe . 164d65f6f70SBen Gras.It Cm allbox 165d65f6f70SBen GrasThis option is not supported by 166d65f6f70SBen Gras.Xr mandoc 1 . 167d65f6f70SBen Gras.It Cm tab 168d65f6f70SBen GrasAccepts a single-character argument. 169d65f6f70SBen GrasThis character is used as a delimiter between data cells, which otherwise 170d65f6f70SBen Grasdefaults to the tab character. 171d65f6f70SBen Gras.It Cm linesize 172d65f6f70SBen GrasAccepts a natural number (all digits). 173d65f6f70SBen GrasThis option is not supported by 174d65f6f70SBen Gras.Xr mandoc 1 . 175d65f6f70SBen Gras.It Cm nokeep 176d65f6f70SBen GrasThis option is not supported by 177d65f6f70SBen Gras.Xr mandoc 1 . 178d65f6f70SBen Gras.It Cm decimalpoint 179d65f6f70SBen GrasAccepts a single-character argument. 180d65f6f70SBen GrasThis character will be used as the decimal point with the 181d65f6f70SBen Gras.Cm n 182d65f6f70SBen Graslayout key. 183d65f6f70SBen Gras.It Cm nospaces 184d65f6f70SBen GrasThis option is not supported by 185d65f6f70SBen Gras.Xr mandoc 1 . 186d65f6f70SBen Gras.El 187d65f6f70SBen Gras.Ss Layout 188d65f6f70SBen GrasThe table layout follows 189d65f6f70SBen Gras.Sx Options 190d65f6f70SBen Grasor a 191d65f6f70SBen Gras.Sq \&T& 192d65f6f70SBen Grasmacro invocation. 193d65f6f70SBen GrasLayout specifies how data rows are displayed on output. 194d65f6f70SBen GrasEach layout line corresponds to a line of data; the last layout line 195d65f6f70SBen Grasapplies to all remaining data lines. 196d65f6f70SBen GrasLayout lines may also be separated by a comma. 197d65f6f70SBen GrasEach layout cell consists of one of the following case-insensitive keys: 198d65f6f70SBen Gras.Bl -tag -width Ds 199d65f6f70SBen Gras.It Cm c 200d65f6f70SBen GrasCentre a literal string within its column. 201d65f6f70SBen Gras.It Cm r 202d65f6f70SBen GrasRight-justify a literal string within its column. 203d65f6f70SBen Gras.It Cm l 204d65f6f70SBen GrasLeft-justify a literal string within its column. 205d65f6f70SBen Gras.It Cm n 20692395e9cSLionel SambucJustify a number around its last decimal point. 207d65f6f70SBen GrasIf the decimal point is not found on the number, it's assumed to trail 208d65f6f70SBen Grasthe number. 209d65f6f70SBen Gras.It Cm s 21092395e9cSLionel SambucHorizontally span columns from the last 21192395e9cSLionel Sambuc.No non- Ns Cm s 21292395e9cSLionel Sambucdata cell. 21392395e9cSLionel SambucIt is an error if spanning columns follow a 21492395e9cSLionel Sambuc.Cm \- 21592395e9cSLionel Sambucor 21692395e9cSLionel Sambuc.Cm \(ba 21792395e9cSLionel Sambuccell, or come first. 218d65f6f70SBen GrasThis option is not supported by 219d65f6f70SBen Gras.Xr mandoc 1 . 220d65f6f70SBen Gras.It Cm a 22192395e9cSLionel SambucLeft-justify a literal string and pad with one space. 222d65f6f70SBen Gras.It Cm ^ 22392395e9cSLionel SambucVertically span rows from the last 22492395e9cSLionel Sambuc.No non- Ns Cm ^ 22592395e9cSLionel Sambucdata cell. 22692395e9cSLionel SambucIt is an error to invoke a vertical span on the first layout row. 22792395e9cSLionel SambucUnlike a horizontal spanner, you must specify an empty cell (if it not 22892395e9cSLionel Sambucempty, the data is discarded) in the corresponding data cell. 229d65f6f70SBen Gras.It Cm \- 230d65f6f70SBen GrasReplace the data cell (its contents will be lost) with a single 231d65f6f70SBen Grashorizontal line. 232d65f6f70SBen GrasThis may also be invoked with 233d65f6f70SBen Gras.Cm _ . 234d65f6f70SBen Gras.It Cm = 235d65f6f70SBen GrasReplace the data cell (its contents will be lost) with a double 236d65f6f70SBen Grashorizontal line. 237d65f6f70SBen Gras.It Cm \(ba 238d65f6f70SBen GrasEmit a vertical bar instead of data. 239d65f6f70SBen Gras.It Cm \(ba\(ba 240d65f6f70SBen GrasEmit a double-vertical bar instead of data. 241d65f6f70SBen Gras.El 242d65f6f70SBen Gras.Pp 243d65f6f70SBen GrasKeys may be followed by a set of modifiers. 244d65f6f70SBen GrasA modifier is either a modifier key or a natural number for specifying 24592395e9cSLionel Sambucthe minimum width of a column. 246d65f6f70SBen GrasThe following case-insensitive modifier keys are available: 247d65f6f70SBen Gras.Cm z , 248d65f6f70SBen Gras.Cm u , 249d65f6f70SBen Gras.Cm e , 250d65f6f70SBen Gras.Cm t , 251d65f6f70SBen Gras.Cm d , 252d65f6f70SBen Gras.Cm b , 253d65f6f70SBen Gras.Cm i , 25492395e9cSLionel Sambuc.Cm r , 255d65f6f70SBen Grasand 25692395e9cSLionel Sambuc.Cm f 25792395e9cSLionel Sambuc.Po 25892395e9cSLionel Sambucfollowed by 25992395e9cSLionel Sambuc.Cm b , 26092395e9cSLionel Sambuc.Cm i , 26192395e9cSLionel Sambuc.Cm r , 26292395e9cSLionel Sambuc.Cm 3 , 26392395e9cSLionel Sambuc.Cm 2 , 26492395e9cSLionel Sambucor 26592395e9cSLionel Sambuc.Cm 1 26692395e9cSLionel Sambuc.Pc . 267d65f6f70SBen GrasAll of these are ignored by 268d65f6f70SBen Gras.Xr mandoc 1 . 26992395e9cSLionel Sambuc.Pp 27092395e9cSLionel SambucFor example, the following layout specifies a centre-justified column of 27192395e9cSLionel Sambucminimum width 10, followed by vertical bar, followed by a left-justified 27292395e9cSLionel Sambuccolumn of minimum width 10, another vertical bar, then a column 27392395e9cSLionel Sambucjustified about the decimal point in numbers: 27492395e9cSLionel Sambuc.Pp 27592395e9cSLionel Sambuc.Dl c10 | l10 | n 276d65f6f70SBen Gras.Ss Data 277d65f6f70SBen GrasThe data section follows the last layout row. 278d65f6f70SBen GrasBy default, cells in a data section are delimited by a tab. 279d65f6f70SBen GrasThis behaviour may be changed with the 280d65f6f70SBen Gras.Cm tab 281d65f6f70SBen Grasoption. 282d65f6f70SBen GrasIf 283d65f6f70SBen Gras.Cm _ 284d65f6f70SBen Grasor 285d65f6f70SBen Gras.Cm = 286d65f6f70SBen Grasis specified, a single or double line, respectively, is drawn across the 287d65f6f70SBen Grasdata field. 288d65f6f70SBen GrasIf 289d65f6f70SBen Gras.Cm \e- 290d65f6f70SBen Grasor 291d65f6f70SBen Gras.Cm \e= 292d65f6f70SBen Grasis specified, a line is drawn within the data field (i.e. terminating 293d65f6f70SBen Graswithin the cell and not draw to the border). 294d65f6f70SBen GrasIf the last cell of a line is 295d65f6f70SBen Gras.Cm T{ , 296d65f6f70SBen Grasall subsequent lines are included as part of the cell until 297d65f6f70SBen Gras.Cm T} 298d65f6f70SBen Grasis specified as its own data cell. 299d65f6f70SBen GrasIt may then be followed by a tab 300d65f6f70SBen Gras.Pq or as designated by Cm tab 301d65f6f70SBen Grasor an end-of-line to terminate the row. 302d65f6f70SBen Gras.Sh COMPATIBILITY 303d65f6f70SBen GrasThis section documents compatibility between mandoc and other 304d65f6f70SBen Gras.Nm 305d65f6f70SBen Grasimplementations, at this time limited to GNU tbl. 306d65f6f70SBen Gras.Pp 307d65f6f70SBen Gras.Bl -dash -compact 308d65f6f70SBen Gras.It 309d65f6f70SBen GrasIn GNU tbl, comments and macros are disallowed prior to the data block 310d65f6f70SBen Grasof a table. 311d65f6f70SBen GrasThe 312d65f6f70SBen Gras.Xr mandoc 1 313d65f6f70SBen Grasimplementation allows them. 314d65f6f70SBen Gras.El 315d65f6f70SBen Gras.Sh SEE ALSO 316d65f6f70SBen Gras.Xr mandoc 1 , 317d65f6f70SBen Gras.Xr man 7 , 318d65f6f70SBen Gras.Xr mandoc_char 7 , 319d65f6f70SBen Gras.Xr mdoc 7 , 320d65f6f70SBen Gras.Xr roff 7 321d65f6f70SBen Gras.Rs 322d65f6f70SBen Gras.%A M. E. Lesk 323d65f6f70SBen Gras.%T Tbl\(emA Program to Format Tables 324d65f6f70SBen Gras.%D June 11, 1976 325d65f6f70SBen Gras.Re 326d65f6f70SBen Gras.Sh HISTORY 327d65f6f70SBen GrasThe tbl utility, a preprocessor for troff, was originally written by M. 328d65f6f70SBen GrasE. Lesk at Bell Labs in 1975. 329d65f6f70SBen GrasThe GNU reimplementation of tbl, part of the groff package, was released 330d65f6f70SBen Grasin 1990 by James Clark. 331d65f6f70SBen GrasA standalone tbl implementation was written by Kristaps Dzonsons in 332d65f6f70SBen Gras2010. 333d65f6f70SBen GrasThis formed the basis of the implementation that is part of the 334d65f6f70SBen Gras.Xr mandoc 1 335d65f6f70SBen Grasutility. 336d65f6f70SBen Gras.Sh AUTHORS 33792395e9cSLionel SambucThis 338d65f6f70SBen Gras.Nm 339d65f6f70SBen Grasreference was written by 340*0a6a1f1dSLionel Sambuc.An Kristaps Dzonsons Aq Mt kristaps@bsd.lv . 341