1*544c191cSchristos.\" Id: tbl.7,v 1.34 2019/03/02 21:03:02 schwarze Exp 2c0d9444aSjoerg.\" 348741257Sjoerg.\" Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> 4*544c191cSchristos.\" Copyright (c) 2014,2015,2017,2018,2019 Ingo Schwarze <schwarze@openbsd.org> 5c0d9444aSjoerg.\" 6c0d9444aSjoerg.\" Permission to use, copy, modify, and distribute this software for any 7c0d9444aSjoerg.\" purpose with or without fee is hereby granted, provided that the above 8c0d9444aSjoerg.\" copyright notice and this permission notice appear in all copies. 9c0d9444aSjoerg.\" 10c0d9444aSjoerg.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11c0d9444aSjoerg.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12c0d9444aSjoerg.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13c0d9444aSjoerg.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14c0d9444aSjoerg.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15c0d9444aSjoerg.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16c0d9444aSjoerg.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17c0d9444aSjoerg.\" 18*544c191cSchristos.Dd March 2, 2019 19c0d9444aSjoerg.Dt TBL 7 20c0d9444aSjoerg.Os 21c0d9444aSjoerg.Sh NAME 22c0d9444aSjoerg.Nm tbl 23c0d9444aSjoerg.Nd tbl language reference for mandoc 24c0d9444aSjoerg.Sh DESCRIPTION 25c0d9444aSjoergThe 26c0d9444aSjoerg.Nm tbl 27c9bcef03Schristoslanguage formats tables. 28c0d9444aSjoergIt is used within 29c0d9444aSjoerg.Xr mdoc 7 30c0d9444aSjoergand 31c0d9444aSjoerg.Xr man 7 32c9bcef03Schristospages. 33c0d9444aSjoergThis manual describes the subset of the 34c0d9444aSjoerg.Nm 35c0d9444aSjoerglanguage accepted by the 36c0d9444aSjoerg.Xr mandoc 1 37c0d9444aSjoergutility. 38c0d9444aSjoerg.Pp 39c9bcef03SchristosEach table is started with a 40c0d9444aSjoerg.Xr roff 7 41c9bcef03Schristos.Ic \&TS 42c9bcef03Schristosmacro, consist of at most one line of 43c9bcef03Schristos.Sx Options , 44c9bcef03Schristosone or more 45c0d9444aSjoerg.Sx Layout 46c9bcef03Schristoslines, one or more 47c9bcef03Schristos.Sx Data 48c9bcef03Schristoslines, and ends with a 49c9bcef03Schristos.Ic \&TE 50c9bcef03Schristosmacro. 51c0d9444aSjoergAll input must be 7-bit ASCII. 52c0d9444aSjoerg.Ss Options 53c9bcef03SchristosIf the first input line of a table ends with a semicolon, it contains 54c9bcef03Schristoscase-insensitive options separated by spaces, tabs, or commas. 55c9bcef03SchristosOtherwise, it is interpreted as the first 56c0d9444aSjoerg.Sx Layout 57c9bcef03Schristosline. 58c9bcef03Schristos.Pp 59c9bcef03SchristosThe following options are available. 60c9bcef03SchristosSome of them require arguments enclosed in parentheses: 61c0d9444aSjoerg.Bl -tag -width Ds 62fec65c98Schristos.It Cm allbox 63fec65c98SchristosDraw a single-line box around each table cell. 64c0d9444aSjoerg.It Cm box 65c0d9444aSjoergDraw a single-line box around the table. 66fec65c98SchristosFor GNU compatibility, this may also be invoked with 67c0d9444aSjoerg.Cm frame . 68fec65c98Schristos.It Cm center 69fec65c98SchristosCenter the table instead of left-adjusting it. 70fec65c98SchristosFor GNU compatibility, this may also be invoked with 71fec65c98Schristos.Cm centre . 72c0d9444aSjoerg.It Cm decimalpoint 73fec65c98SchristosUse the single-character argument as the decimal point with the 74c0d9444aSjoerg.Cm n 75c0d9444aSjoerglayout key. 76fec65c98SchristosThis is a GNU extension. 77fec65c98Schristos.It Cm delim 78fec65c98SchristosUse the two characters of the argument as 79fec65c98Schristos.Xr eqn 7 80fec65c98Schristosdelimiters. 81fec65c98SchristosCurrently unsupported. 82fec65c98Schristos.It Cm doublebox 83fec65c98SchristosDraw a double-line box around the table. 84fec65c98SchristosFor GNU compatibility, this may also be invoked with 85fec65c98Schristos.Cm doubleframe . 86fec65c98Schristos.It Cm expand 87fec65c98SchristosIncrease the width of the table to the current line length. 88fec65c98SchristosCurrently ignored. 89fec65c98Schristos.It Cm linesize 90fec65c98SchristosDraw lines with the point size given by the unsigned integer argument. 91fec65c98SchristosCurrently ignored. 92fec65c98Schristos.It Cm nokeep 93fec65c98SchristosAllow page breaks within the table. 94fec65c98SchristosThis is a GNU extension and currently ignored. 95c0d9444aSjoerg.It Cm nospaces 96fec65c98SchristosIgnore leading and trailing spaces in data cells. 97fec65c98SchristosThis is a GNU extension and currently ignored. 98fec65c98Schristos.It Cm nowarn 99fec65c98SchristosSuppress warnings about tables exceeding the current line length. 100fec65c98SchristosThis is a GNU extension and currently ignored. 101fec65c98Schristos.It Cm tab 102fec65c98SchristosUse the single-character argument as a delimiter between data cells. 103c9bcef03SchristosBy default, the horizontal tabulator character is used. 104c0d9444aSjoerg.El 105c0d9444aSjoerg.Ss Layout 106c9bcef03SchristosThe table layout follows an 107c0d9444aSjoerg.Sx Options 108c9bcef03Schristosline or a 109c9bcef03Schristos.Xr roff 7 110c9bcef03Schristos.Ic \&TS 111c9bcef03Schristosor 112c9bcef03Schristos.Ic \&T& 113c9bcef03Schristosmacro. 114c9bcef03SchristosEach layout line specifies how one line of 115c9bcef03Schristos.Sx Data 116c9bcef03Schristosis formatted. 117c9bcef03SchristosThe last layout line ends with a full stop. 118c9bcef03SchristosIt also applies to all remaining data lines. 119c9bcef03SchristosMultiple layout lines can be joined by commas on a single physical 120c9bcef03Schristosinput line. 121c9bcef03Schristos.Pp 122c9bcef03SchristosEach layout line consists of one or more layout cell specifications, 123c9bcef03Schristosoptionally separated by whitespace. 124c9bcef03SchristosThe following case-insensitive key characters start a new cell 125c9bcef03Schristosspecification: 126fec65c98Schristos.Bl -tag -width 2n 127c0d9444aSjoerg.It Cm c 128c9bcef03SchristosCenter the string in this cell. 129c0d9444aSjoerg.It Cm r 130c9bcef03SchristosRight-justify the string in this cell. 131c0d9444aSjoerg.It Cm l 132c9bcef03SchristosLeft-justify the string in this cell. 133c0d9444aSjoerg.It Cm n 13448741257SjoergJustify a number around its last decimal point. 135c9bcef03SchristosIf no decimal point is found in the number, 136c9bcef03Schristosit is assumed to trail the number. 137c0d9444aSjoerg.It Cm s 13848741257SjoergHorizontally span columns from the last 139c9bcef03Schristos.Pf non- Cm s 140c9bcef03Schristoslayout cell. 141c9bcef03SchristosIt is an error if a column span follows a 142c9bcef03Schristos.Cm _ 14348741257Sjoergor 144c9bcef03Schristos.Cm = 145c9bcef03Schristoscell, or comes first on a layout line. 146c9bcef03SchristosThe combined cell as a whole consumes only one cell 147c9bcef03Schristosof the corresponding data line. 148c0d9444aSjoerg.It Cm a 149c9bcef03SchristosLeft-justify a string and pad with one space. 150*544c191cSchristos.It Cm \(ha 15148741257SjoergVertically span rows from the last 152*544c191cSchristos.Pf non- Cm \(ha 153c9bcef03Schristoslayout cell. 154c9bcef03SchristosIt is an error to invoke a vertical span on the first layout line. 155c9bcef03SchristosUnlike a horizontal span, a vertical span consumes a data cell 156c9bcef03Schristosand discards the content. 157c9bcef03Schristos.It Cm _ 158c9bcef03SchristosDraw a single horizontal line in this cell. 159c9bcef03SchristosThis consumes a data cell and discards the content. 160c9bcef03SchristosIt may also be invoked with 161c9bcef03Schristos.Cm \- . 162c0d9444aSjoerg.It Cm = 163c9bcef03SchristosDraw a double horizontal line in this cell. 164c9bcef03SchristosThis consumes a data cell and discards the content. 165c0d9444aSjoerg.El 166c0d9444aSjoerg.Pp 167c9bcef03SchristosEach cell key may be followed by zero or more of the following 168c9bcef03Schristoscase-insensitive modifiers: 169fec65c98Schristos.Bl -tag -width 2n 170fec65c98Schristos.It Cm b 171c9bcef03SchristosUse a bold font for the contents of this cell. 172fec65c98Schristos.It Cm d 173c9bcef03SchristosMove content down to the last row of this vertical span. 174fec65c98SchristosCurrently ignored. 175fec65c98Schristos.It Cm e 176fec65c98SchristosMake this column wider to match the maximum width 177fec65c98Schristosof any other column also having the 178fec65c98Schristos.Cm e 179fec65c98Schristosmodifier. 180fec65c98Schristos.It Cm f 181c9bcef03SchristosThe next character selects the font to use for this cell. 182fec65c98SchristosSee the 183fec65c98Schristos.Xr roff 7 184fec65c98Schristosmanual for supported one-character font names. 185fec65c98Schristos.It Cm i 186c9bcef03SchristosUse an italic font for the contents of this cell. 187fec65c98Schristos.It Cm m 188fec65c98SchristosSpecify a cell start macro. 189fec65c98SchristosThis is a GNU extension and currently unsupported. 190fec65c98Schristos.It Cm p 191fec65c98SchristosSet the point size to the following unsigned argument, 192fec65c98Schristosor change it by the following signed argument. 193fec65c98SchristosCurrently ignored. 194fec65c98Schristos.It Cm v 195fec65c98SchristosSet the vertical line spacing to the following unsigned argument, 196fec65c98Schristosor change it by the following signed argument. 197fec65c98SchristosCurrently ignored. 198fec65c98Schristos.It Cm t 199c9bcef03SchristosDo not vertically center content in this vertical span, 200c9bcef03Schristosleave it in the top row. 201fec65c98SchristosCurrently ignored. 202fec65c98Schristos.It Cm u 203c9bcef03SchristosMove cell content up by half a table row. 204fec65c98SchristosCurrently ignored. 205fec65c98Schristos.It Cm w 206c9bcef03SchristosSpecify a minimum column width. 207fec65c98Schristos.It Cm x 208fec65c98SchristosAfter determining the width of all other columns, distribute the 209fec65c98Schristosrest of the line length among all columns having the 210fec65c98Schristos.Cm x 211fec65c98Schristosmodifier. 212fec65c98Schristos.It Cm z 213fec65c98SchristosDo not use this cell for determining the width of this column. 214c9bcef03Schristos.It Cm \&| 215c9bcef03SchristosDraw a single vertical line to the right of this cell. 216c9bcef03Schristos.It Cm || 217c9bcef03SchristosDraw a double vertical line to the right of this cell. 218fec65c98Schristos.El 21948741257Sjoerg.Pp 220c9bcef03SchristosIf a modifier consists of decimal digits, 221c9bcef03Schristosit specifies a minimum spacing in units of 222c9bcef03Schristos.Cm n 223c9bcef03Schristosbetween this column and the next column to the right. 224c9bcef03SchristosThe default is 3. 225c9bcef03SchristosIf there is a vertical line, it is drawn inside the spacing. 226c0d9444aSjoerg.Ss Data 227c9bcef03SchristosThe data section follows the last 228c9bcef03Schristos.Sx Layout 229c9bcef03Schristosline. 230c9bcef03SchristosEach data line consists of one or more data cells, delimited by 231c0d9444aSjoerg.Cm tab 232c9bcef03Schristoscharacters. 233c9bcef03Schristos.Pp 234*544c191cSchristosIf a data cell contains only the two bytes 235*544c191cSchristos.Ql \e\(ha , 236*544c191cSchristosthe cell above spans to this row, as if the layout specification 237*544c191cSchristosof this cell were 238*544c191cSchristos.Cm \(ha . 239*544c191cSchristos.Pp 240*544c191cSchristosIf a data cell contains only the single character 241c9bcef03Schristos.Ql _ 242c0d9444aSjoergor 243c9bcef03Schristos.Ql = , 244c9bcef03Schristosa single or double horizontal line is drawn across the cell, 245c9bcef03Schristosjoining its neighbours. 246*544c191cSchristosIf a data cell contains only the two character sequence 247c9bcef03Schristos.Ql \e_ 248c0d9444aSjoergor 249c9bcef03Schristos.Ql \e= , 250c9bcef03Schristosa single or double horizontal line is drawn inside the cell, 251c9bcef03Schristosnot joining its neighbours. 252c9bcef03SchristosIf a data line contains nothing but the single character 253c9bcef03Schristos.Ql _ 254c9bcef03Schristosor 255c9bcef03Schristos.Ql = , 256c9bcef03Schristosa horizontal line across the whole table is inserted 257c9bcef03Schristoswithout consuming a layout row. 258c9bcef03Schristos.Pp 259c9bcef03SchristosIn place of any data cell, a text block can be used. 260c9bcef03SchristosIt starts with 261c9bcef03Schristos.Ic \&T{ 262c9bcef03Schristosat the end of a physical input line. 263c9bcef03SchristosInput line breaks inside the text block 264c9bcef03Schristosneither end the text block nor its data cell. 265c9bcef03SchristosIt only ends if 266c9bcef03Schristos.Ic \&T} 267c9bcef03Schristosoccurs at the beginning of a physical input line and is followed 268c9bcef03Schristosby an end-of-cell indicator. 269c9bcef03SchristosIf the 270c9bcef03Schristos.Ic \&T} 271c9bcef03Schristosis followed by the end of the physical input line, the text block, 272c9bcef03Schristosthe data cell, and the data line ends at this point. 273c9bcef03SchristosIf the 274c9bcef03Schristos.Ic \&T} 275c9bcef03Schristosis followed by the 276c9bcef03Schristos.Cm tab 277c9bcef03Schristoscharacter, only the text block and the data cell end, 278c9bcef03Schristosbut the data line continues with the data cell following the 279c9bcef03Schristos.Cm tab 280c9bcef03Schristoscharacter. 281c9bcef03SchristosIf 282c9bcef03Schristos.Ic \&T} 283c9bcef03Schristosis followed by any other character, it does not end the text block, 284c9bcef03Schristoswhich instead continues to the following physical input line. 285c9bcef03Schristos.Sh EXAMPLES 286c9bcef03SchristosString justification and font selection: 287c9bcef03Schristos.Bd -literal -offset indent 288c9bcef03Schristos\&.TS 289c9bcef03Schristosrb c lb 290c9bcef03Schristosr ci l. 291c9bcef03Schristosr center l 292c9bcef03Schristosri ce le 293c9bcef03Schristosright c left 294c9bcef03Schristos\&.TE 295c9bcef03Schristos.Ed 296c9bcef03Schristos.Bd -filled -offset indent 297c9bcef03Schristos.TS 298c9bcef03Schristosrb c lb 299c9bcef03Schristosr ci l. 300c9bcef03Schristosr center l 301c9bcef03Schristosri ce le 302c9bcef03Schristosright c left 303c9bcef03Schristos.TE 304c9bcef03Schristos.Ed 305c9bcef03Schristos.Pp 306c9bcef03SchristosSome ports in 307c9bcef03Schristos.Ox 6.1 308c9bcef03Schristosto show number alignment and line drawing: 309c9bcef03Schristos.Bd -literal -offset indent 310c9bcef03Schristos\&.TS 311c9bcef03Schristosbox tab(:); 312c9bcef03Schristosr| l 313c9bcef03Schristosr n. 314c9bcef03Schristossoftware:version 315c9bcef03Schristos_ 316c9bcef03SchristosAFL:2.39b 317c9bcef03SchristosMutt:1.8.0 318c9bcef03SchristosRuby:1.8.7.374 319c9bcef03SchristosTeX Live:2015 320c9bcef03Schristos\&.TE 321c9bcef03Schristos.Ed 322c9bcef03Schristos.Bd -filled -offset indent 323c9bcef03Schristos.TS 324c9bcef03Schristosbox tab(:); 325c9bcef03Schristosr| l 326c9bcef03Schristosr n. 327c9bcef03Schristossoftware:version 328c9bcef03Schristos_ 329c9bcef03SchristosAFL:2.39b 330c9bcef03SchristosMutt:1.8.0 331c9bcef03SchristosRuby:1.8.7.374 332c9bcef03SchristosTeX Live:2015 333c9bcef03Schristos.TE 334c9bcef03Schristos.Ed 335c9bcef03Schristos.sp 2v 336c9bcef03SchristosSpans and skipping width calculations: 337c9bcef03Schristos.Bd -literal -offset indent 338c9bcef03Schristos\&.TS 339c9bcef03Schristosbox tab(:); 340c9bcef03Schristoslz s | rt 341*544c191cSchristoslt| cb| \(ha 342*544c191cSchristos\(ha | rz s. 343c9bcef03Schristosleft:r 344c9bcef03Schristosl:center: 345c9bcef03Schristos:right 346c9bcef03Schristos\&.TE 347c9bcef03Schristos.Ed 348c9bcef03Schristos.Bd -filled -offset indent 349c9bcef03Schristos.TS 350c9bcef03Schristosbox tab(:); 351c9bcef03Schristoslz s | rt 352c9bcef03Schristoslt| cb| ^ 353c9bcef03Schristos^ | rz s. 354c9bcef03Schristosleft:r 355c9bcef03Schristosl:center: 356c9bcef03Schristos:right 357c9bcef03Schristos.TE 358c9bcef03Schristos.Ed 359c9bcef03Schristos.sp 2v 360c9bcef03SchristosText blocks, specifying spacings and specifying and equalizing 361c9bcef03Schristoscolumn widths, putting lines into individual cells, and overriding 362c9bcef03Schristos.Cm allbox : 363c9bcef03Schristos.Bd -literal -offset indent 364c9bcef03Schristos\&.TS 365c9bcef03Schristosallbox tab(:); 366c9bcef03Schristosle le||7 lw10. 367c9bcef03SchristosThe fourth line:_:line 1 368c9bcef03Schristosof this column:=:line 2 369c9bcef03Schristosdetermines:\_:line 3 370c9bcef03Schristosthe column width.:T{ 371c9bcef03SchristosThis text is too wide to fit into a column of width 17. 372c9bcef03SchristosT}:line 4 373c9bcef03SchristosT{ 374c9bcef03SchristosNo break here. 375c9bcef03SchristosT}::line 5 376c9bcef03Schristos\&.TE 377c9bcef03Schristos.Ed 378c9bcef03Schristos.Bd -filled -offset indent 379c9bcef03Schristos.TS 380c9bcef03Schristosallbox tab(:); 381c9bcef03Schristosle le||7 lw10. 382c9bcef03SchristosThe fourth line:_:line 1 383c9bcef03Schristosof this column:=:line 2 384c9bcef03Schristosdetermines:\_:line 3 385c9bcef03Schristosthe column width.:T{ 386c9bcef03SchristosThis text is too wide to fit into a column of width 17. 387c9bcef03SchristosT}:line 4 388c9bcef03SchristosT{ 389c9bcef03SchristosNo break here. 390c9bcef03SchristosT}::line 5 391c9bcef03Schristos.TE 392c9bcef03Schristos.Ed 393c9bcef03Schristos.sp 2v 394c9bcef03SchristosThese examples were constructed to demonstrate many 395c9bcef03Schristos.Nm 396c9bcef03Schristosfeatures in a compact way. 397*544c191cSchristosIn real manual pages, keep tables as simple as possible. 398*544c191cSchristosThey usually look better, are less fragile, and are more portable. 399c0d9444aSjoerg.Sh COMPATIBILITY 400c0d9444aSjoergThe 401c0d9444aSjoerg.Xr mandoc 1 402fec65c98Schristosimplementation of 403fec65c98Schristos.Nm 404fec65c98Schristosdoesn't support 405fec65c98Schristos.Xr mdoc 7 406fec65c98Schristosand 407fec65c98Schristos.Xr man 7 408fec65c98Schristosmacros and 409fec65c98Schristos.Xr eqn 7 410fec65c98Schristosequations inside tables. 411c0d9444aSjoerg.Sh SEE ALSO 412c0d9444aSjoerg.Xr mandoc 1 , 413c0d9444aSjoerg.Xr man 7 , 414c0d9444aSjoerg.Xr mandoc_char 7 , 415c0d9444aSjoerg.Xr mdoc 7 , 416c0d9444aSjoerg.Xr roff 7 417c0d9444aSjoerg.Rs 418c0d9444aSjoerg.%A M. E. Lesk 419c0d9444aSjoerg.%T Tbl\(emA Program to Format Tables 420c0d9444aSjoerg.%D June 11, 1976 421c0d9444aSjoerg.Re 422c0d9444aSjoerg.Sh HISTORY 423c0d9444aSjoergThe tbl utility, a preprocessor for troff, was originally written by M. 424c0d9444aSjoergE. Lesk at Bell Labs in 1975. 425c0d9444aSjoergThe GNU reimplementation of tbl, part of the groff package, was released 426c0d9444aSjoergin 1990 by James Clark. 427c0d9444aSjoergA standalone tbl implementation was written by Kristaps Dzonsons in 428c0d9444aSjoerg2010. 429c9bcef03SchristosThis formed the basis of the implementation that first appeared in 430c9bcef03Schristos.Ox 4.9 431c9bcef03Schristosas a part of the 432c0d9444aSjoerg.Xr mandoc 1 433c0d9444aSjoergutility. 434c0d9444aSjoerg.Sh AUTHORS 435c5f73b34SjoergThis 436c0d9444aSjoerg.Nm 437c0d9444aSjoergreference was written by 438c9bcef03Schristos.An Kristaps Dzonsons Aq Mt kristaps@bsd.lv 439c9bcef03Schristosand 440c9bcef03Schristos.An Ingo Schwarze Aq Mt schwarze@openbsd.org . 441*544c191cSchristos.Sh BUGS 442*544c191cSchristosIn 443*544c191cSchristos.Fl T 444*544c191cSchristos.Cm utf8 445*544c191cSchristosoutput mode, heavy lines are drawn instead of double lines. 446*544c191cSchristosThis cannot be improved because the Unicode standard only provides 447*544c191cSchristosan incomplete set of box drawing characters with double lines, 448*544c191cSchristoswhereas it provides a full set of box drawing characters 449*544c191cSchristoswith heavy lines. 450*544c191cSchristosIt is unlikely this can be improved in the future because the box 451*544c191cSchristosdrawing characters are already marked in Unicode as characters 452*544c191cSchristosintended only for backward compatibility with legacy systems, 453*544c191cSchristosand their use is not encouraged. 454*544c191cSchristosSo it seems unlikely that the missing ones might get added in the future. 455