1tbl(1)                      General Commands Manual                     tbl(1)
2
3
4

Name

6       tbl - prepare tables for groff documents
7

Synopsis

9       tbl [-C] [file ...]
10
11       tbl --help
12
13       tbl -v
14       tbl --version
15

Description

17       The  GNU implementation of tbl is part of the groff(1) document format‐
18       ting system.  tbl is a troff(1) preprocessor that  translates  descrip‐
19       tions  of  tables embedded in roff(7) input files into the language un‐
20       derstood by troff.  It copies the contents of each file to the standard
21       output stream, except that lines between .TS and .TE are interpreted as
22       table descriptions.  While GNU tbl's input syntax is highly  compatible
23       with  AT&T tbl, the output GNU tbl produces cannot be processed by AT&T
24       troff; GNU troff (or a troff implementing any GNU extensions  employed)
25       must  be used.  Normally, tbl is not executed directly by the user, but
26       invoked by specifying the -t option to groff(1).  If no  file  operands
27       are  given  on the command line, or if file is “-”, tbl reads the stan‐
28       dard input stream.
29
30   Overview
31       tbl expects to find table descriptions between input lines  that  begin
32       with .TS (table start) and .TE (table end).  Each such table region en‐
33       closes one or more table descriptions.  Within a  table  region,  table
34       descriptions  beyond  the  first must each be preceded by an input line
35       beginning with .T&.  This mechanism does not start a new table  region;
36       all  table descriptions are treated as part of their .TS/.TE enclosure,
37       even if they are boxed or have column headings that  repeat  on  subse‐
38       quent pages (see below).
39
40       (Experienced  roff users should observe that tbl is not a roff language
41       interpreter: the default control character must be used, and no  spaces
42       or tabs are permitted between the control character and the macro name.
43       These tbl input tokens remain as-is in the output,  where  they  become
44       ordinary  macro  calls.   Macro  packages  often  define TS, T&, and TE
45       macros to handle issues of table placement on the page.   tbl  produces
46       groff  code to define these macros as empty if their definitions do not
47       exist when the formatter encounters a table region.)
48
49       Each table region may begin with region options, and must  contain  one
50       or  more  table  definitions;  each  table definition contains a format
51       specification followed by one or more input lines  (rows)  of  entries.
52       These entries comprise the table data.
53
54   Region options
55       The  line  immediately  following  the .TS token may specify region op‐
56       tions, keywords that influence the interpretation or rendering  of  the
57       region  as  a  whole  or  all table entries within it indiscriminately.
58       They must be separated by commas, spaces, or tabs.  Those that  require
59       a  parenthesized  argument  permit spaces and tabs between the option's
60       name and the opening parenthesis.  Options accumulate and cannot be un‐
61       set  within a region once declared; if an option that takes a parameter
62       is repeated, the last occurrence controls.  If present, the set of  re‐
63       gion options must be terminated with a semicolon (;).
64
65       Any  of  the  allbox, box, doublebox, frame, and doubleframe region op‐
66       tions makes a table “boxed” for the purpose of later discussion.
67
68       allbox Enclose each table entry in a box; implies box.
69
70       box    Enclose the entire table region in a box.  As a  GNU  extension,
71              the alternative option name frame is also recognized.
72
73       center Center  the table region with respect to the current indentation
74              and line length; the default is to left-align it.  As a GNU  ex‐
75              tension, the alternative option name centre is also recognized.
76
77       decimalpoint(c)
78              Recognize  character c as the decimal separator in columns using
79              the N (numeric) classifier (see subsection “Column  classifiers”
80              below).  This is a GNU extension.
81
82       delim(xy)
83              Recognize  characters  x  and y as start and end delimiters, re‐
84              spectively, for eqn(1) input, and ignore input between them.   x
85              and y need not be distinct.
86
87       doublebox
88              Enclose  the  entire  table region in a double box; implies box.
89              As a GNU extension, the alternative option name  doubleframe  is
90              also recognized.
91
92       expand Spread  the table horizontally to fill the available space (line
93              length minus indentation) by increasing column separation.   Or‐
94              dinarily,  a table is made only as wide as necessary to accommo‐
95              date the widths  of  its  entries  and  its  column  separations
96              (whether  specified or default).  When expand applies to a table
97              that exceeds the available horizontal space,  column  separation
98              is  reduced  as  far  as necessary (even to zero).  tbl produces
99              groff input that issues a diagnostic if such compression occurs.
100              The column modifier x (see below) overrides this option.
101
102       linesize(n)
103              Draw  lines  or  rules  (e.g.,  from  box)  with  a thickness of
104              n points.  The default is the current type size when the  region
105              begins.  This option is ignored on terminal devices.
106
107       nokeep Don't  use roff diversions to manage page breaks.  Normally, tbl
108              employs them to avoid breaking a page within a table row.   This
109              usage  can sometimes interact badly with macro packages' own use
110              of diversions—when footnotes, for example, are  employed.   This
111              is a GNU extension.
112
113       nospaces
114              Ignore  leading and trailing spaces in table entries.  This is a
115              GNU extension.
116
117       nowarn Suppress diagnostic messages  produced  at  document  formatting
118              time  when  the line or page lengths are inadequate to contain a
119              table row.  This is a GNU extension.
120
121       tab(c) Use the character c instead of a tab to separate  entries  in  a
122              row of table data.
123
124   Table format specification
125       The  table  format specification is mandatory: it determines the number
126       of columns in the table and directs how the entries within it are to be
127       typeset.   The  format specification is a series of column descriptors.
128       Each descriptor encodes a classifier followed by  zero  or  more  modi‐
129       fiers.   Classifiers  are  letters  (recognized  case-insensitively) or
130       punctuation symbols; modifiers consist of or begin with letters or  nu‐
131       merals.  Spaces, tabs, newlines, and commas separate descriptors.  New‐
132       lines and commas are special; they apply the descriptors following them
133       to  a subsequent row of the table.  (This enables column headings to be
134       centered or emboldened while the table entries for the  data  are  not,
135       for instance.)  We term the resulting group of column descriptors a row
136       definition.  Within a row definition,  separation  between  column  de‐
137       scriptors  (by  spaces or tabs) is often optional; only some modifiers,
138       described below, make separation necessary.
139
140       Each column descriptor begins with a mandatory classifier, a  character
141       that  selects from one of several arrangements.  Some determine the po‐
142       sitioning of table entries within a rectangular cell:  centered,  left-
143       aligned,  numeric (aligned to a configurable decimal separator), and so
144       on.  Others perform special operations like drawing lines  or  spanning
145       entries  from adjacent cells in the table.  Except for “|”, any classi‐
146       fier can be followed by one or more modifiers; some of these accept  an
147       argument,  which  in  GNU  tbl  can be parenthesized.  Modifiers select
148       fonts, set the type size, and perform other tasks described below.
149
150       The format specification can occupy multiple input lines, but must con‐
151       clude with a dot “.” followed by a newline.  Each row definition is ap‐
152       plied in turn to one row of the table.  The last row definition is  ap‐
153       plied to rows of table data in excess of the row definitions.
154
155       For  clarity in this document's examples, we shall write classifiers in
156       uppercase and modifiers in lowercase.   Thus,  “CbCb,LR.”  defines  two
157       rows  of  two  columns.  The first row's entries are centered and bold‐
158       faced; the second and any further rows' first and  second  columns  are
159       left- and right-aligned, respectively.
160
161       The row definition with the most column descriptors determines the num‐
162       ber of columns in the table; any row definition with fewer  is  implic‐
163       itly  extended  on the right-hand side with L classifiers as many times
164       as necessary to make the table rectangular.
165
166   Column classifiers
167       The L, R, and C classifiers are the easiest to understand and use.
168
169       A, a   Center longest entry in this column,  left-align  remaining  en‐
170              tries in the column with respect to the centered entry, then in‐
171              dent all entries by one en.  Such  “alphabetic”  entries  (hence
172              the name of the classifier) can be used in the same column as L-
173              classified entries, as in “LL,AR.”.  The  A  entries  are  often
174              termed “sub-columns” due to their indentation.
175
176       C, c   Center entry within the column.
177
178       L, l   Left-align entry within the column.
179
180       N, n   Numerically  align  entry  in the column.  tbl aligns columns of
181              numbers vertically at the units place.  If multiple decimal sep‐
182              arators  are  adjacent to a digit, it uses the rightmost one for
183              vertical alignment.  If  there  is  no  decimal  separator,  the
184              rightmost  digit  is used for vertical alignment; otherwise, tbl
185              centers the entry within the column.  The roff  dummy  character
186              \&  in  an  entry  marks  the glyph preceding it (if any) as the
187              units place; if multiple instances occur in the data, the  left‐
188              most is used for alignment.
189
190              If  N-classified entries share a column with L or R entries, tbl
191              centers the widest N entry with respect to the widest L or R en‐
192              try,  preserving the alignment of N entries with respect to each
193              other.
194
195              The appearance of eqn equations within N-classified columns  can
196              be  troublesome  due to the foregoing textual scan for a decimal
197              separator.  Use the delim region option to make tbl  ignore  the
198              data within eqn delimiters for that purpose.
199
200       R, r   Right-align entry within the column.
201
202       S, s   Span previous entry on the left into this column.
203
204       ^      Span  entry  in  the same column from the previous row into this
205              row.
206
207       _, -   Replace table entry with a horizontal rule.  An empty table  en‐
208              try  is  expected  to correspond to this classifier; if data are
209              found there, tbl issues a diagnostic message.
210
211       =      Replace table entry with a double horizontal rule.  An empty ta‐
212              ble  entry is expected to correspond to this classifier; if data
213              are found there, tbl issues a diagnostic message.
214
215       |      Place a vertical rule (line) on the corresponding row of the ta‐
216              ble  (if  two  of  these  are adjacent, a double vertical rule).
217              This classifier does not contribute to the column count  and  no
218              table  entries  correspond  to it.  A | to the left of the first
219              column descriptor or to the right of the  last  one  produces  a
220              vertical rule at the edge of the table; these are redundant (and
221              ignored) in boxed tables.
222
223       To change the table format within a tbl region, use the  .T&  token  at
224       the  start of a line.  It is followed by a format specification and ta‐
225       ble data, but not region options.  The quantity of columns in a new ta‐
226       ble format thus introduced cannot increase relative to the previous ta‐
227       ble format; in that case, you must end the table region and  start  an‐
228       other.   If  that will not serve because the region uses box options or
229       the columns align in an undesirable manner, you must design the initial
230       table  format  specification to include the maximum quantity of columns
231       required, and use the S horizontal spanning classifier where  necessary
232       to achieve the desired columnar alignment.
233
234       Attempting  to horizontally span in the first column or vertically span
235       on the first row is an error.  Non-rectangular span areas are also  not
236       supported.
237
238   Column modifiers
239       Any  number  of modifiers can follow a column classifier.  Arguments to
240       modifiers, where accepted, are case-sensitive.  If the same modifier is
241       applied  to  a column specifier more than once, or if conflicting modi‐
242       fiers are applied, only the last occurrence has effect.  The modifier x
243       is  mutually  exclusive  with  e and w, but e is not mutually exclusive
244       with w; if these are used in combination, x unsets both e and w,  while
245       either e or w overrides x.
246
247       b, B   Typeset entry in boldface, abbreviating f(B).
248
249       d, D   Align  a  vertically spanned table entry to the bottom (“down”),
250              instead of the center, of its range.  This is a GNU extension.
251
252       e, E   Equalize the widths of columns with this modifier.   The  column
253              with the largest width controls.  This modifier sets the default
254              line length used in a text block.
255
256       f, F   Select the typeface for the table entry.  This modifier must  be
257              followed  by  a  font  or  style name (one or two characters not
258              starting with a digit), font mounting position (a single digit),
259              or  a  name  or  mounting position of any length in parentheses.
260              The last form is a GNU extension.  (The parameter corresponds to
261              that  accepted  by the troff ft request.)  A one-character argu‐
262              ment not in parentheses must be separated by one or more  spaces
263              or tabs from what follows.
264
265       i, I   Typeset entry in an oblique or italic face, abbreviating f(I).
266
267       m, M   Call  a groff macro before typesetting a text block (see subsec‐
268              tion “Text blocks” below).  This is a GNU extension.  This modi‐
269              fier  must  be followed by a macro name of one or two characters
270              or a name of any length in parentheses.  A  one-character  macro
271              name  not in parentheses must be separated by one or more spaces
272              or tabs from what follows.  The named macro must be defined  be‐
273              fore the table region containing this column modifier is encoun‐
274              tered.  The macro should contain only simple groff  requests  to
275              change  text  formatting,  like  adjustment or hyphenation.  The
276              macro is called after the column modifiers b, f,  i,  p,  and  v
277              take effect; it can thus override other column modifiers.
278
279       p, P   Set  the  type  size for the table entry.  This modifier must be
280              followed by an integer n with an optional leading sign.  If  un‐
281              signed, the type size is set to n scaled points.  Otherwise, the
282              type size is incremented or decremented per the sign by n scaled
283              points.   The use of a signed multi-digit number is a GNU exten‐
284              sion.  (The parameter corresponds to that accepted by the  troff
285              ps  request.)   If  a type size modifier is followed by a column
286              separation modifier (see below), they must be  separated  by  at
287              least one space or tab.
288
289       t, T   Align  a  vertically  spanned table entry to the top, instead of
290              the center, of its range.
291
292       u, U   Move the column up one half-line, “staggering” the  rows.   This
293              is a GNU extension.
294
295       v, V   Set the vertical spacing to be used in a text block.  This modi‐
296              fier must be followed by an integer n with an  optional  leading
297              sign.   If  unsigned,  the  vertical spacing is set to n points.
298              Otherwise, the vertical spacing is  incremented  or  decremented
299              per  the sign by n points.  The use of a signed multi-digit num‐
300              ber is a GNU extension.  (This parameter corresponds to that ac‐
301              cepted by the troff vs request.)  If a vertical spacing modifier
302              is followed by a column separation modifier  (see  below),  they
303              must be separated by at least one space or tab.
304
305       w, W   Set  the column's minimum width.  This modifier must be followed
306              by a number, which is either a unitless integer, or a roff hori‐
307              zontal  measurement in parentheses.  Parentheses are required if
308              the width is to be followed immediately by  an  explicit  column
309              separation  (alternatively,  follow  the  width with one or more
310              spaces or tabs).  If no unit  is  specified,  ens  are  assumed.
311              This modifier sets the default line length used in a text block.
312
313       x, X   Expand  the column.  After computing the column widths, distrib‐
314              ute any remaining line length evenly over  all  columns  bearing
315              this  modifier.  Applying the x modifier to more than one column
316              is a GNU extension.  This modifier sets the default line  length
317              used in a text block.
318
319       z, Z   Ignore  the table entries corresponding to this column for width
320              calculation purposes; that is, compute the column's width  using
321              only the information in its descriptor.
322
323       n      A numeric suffix on a column descriptor sets the separation dis‐
324              tance (in ens) from the succeeding column; the  default  separa‐
325              tion is 3n.  This separation is proportionally multiplied if the
326              expand region option is in effect; in the case of  tables  wider
327              than  the  output line length, this separation might be zero.  A
328              negative separation cannot be specified.   A  separation  amount
329              after the last column in a row is nonsensical and provokes a di‐
330              agnostic from tbl.
331
332   Table data
333       The table data come after the format specification.   Each  input  line
334       corresponds  to  a  table  row, except that a backslash at the end of a
335       line of table data continues an entry on the next  input  line.   (Text
336       blocks,  discussed below, also spread table entries across multiple in‐
337       put lines.)  Table entries within a row are separated in the input by a
338       tab  character by default; see the tab region option above.  Excess en‐
339       tries in a row of table data (those that have no  corresponding  column
340       descriptor, not even an implicit one arising from rectangularization of
341       the table) are discarded with a diagnostic message.  roff control lines
342       are accepted between rows of table data and within text blocks.  If you
343       wish to visibly mark an empty table entry in the document source, popu‐
344       late  it  with  the \& roff dummy character.  The table data are inter‐
345       rupted by a line consisting of the .T& input token, and  conclude  with
346       the line .TE.
347
348       Ordinarily,  a  table entry is typeset rigidly.  It is not filled, bro‐
349       ken, hyphenated, adjusted, or populated with additional  inter-sentence
350       space.   tbl  instructs the formatter to measure each table entry as it
351       occurs in the input, updating the width required by  its  corresponding
352       column.   If  the z modifier applies to the column, this measurement is
353       ignored; if w applies and its argument is larger than this width,  that
354       argument  is  used  instead.   In  contrast  to conventional roff input
355       (within a paragraph, say), changes to text formatting, such as font se‐
356       lection or vertical spacing, do not persist between entries.
357
358       Several forms of table entry are interpreted specially.
359
360       • If a table row contains only an underscore or equals sign (_ or =), a
361         single or double  horizontal  rule  (line),  respectively,  is  drawn
362         across the table at that point.
363
364       • A table entry containing only _ or = on an otherwise populated row is
365         replaced by a single or double horizontal rule, respectively, joining
366         its neighbors.
367
368       • Prefixing  a lone underscore or equals sign with a backslash also has
369         meaning.  If a table entry consists only of \_ or \= on an  otherwise
370         populated  row, it is replaced by a single or double horizontal rule,
371         respectively, that does not (quite) join its neighbors.
372
373       • A table entry consisting of \Rx, where x is any roff ordinary or spe‐
374         cial character, is replaced by enough repetitions of the glyph corre‐
375         sponding to x to fill the column, albeit without joining  its  neigh‐
376         bors.
377
378       • On  any row but the first, a table entry of \^ causes the entry above
379         it to span down into the current one.
380
381       On occasion, these special tokens may  be  required  as  literal  table
382       data.   To use either _ or = literally and alone in an entry, prefix or
383       suffix it with the roff dummy character \&.  To express \_, \=, or  \R,
384       use  a roff escape sequence to interpolate the backslash (\e or \[rs]).
385       A reliable way to emplace the \^ glyph sequence within a table entry is
386       to use a pair of groff special character escape sequences (\[rs]\[ha]).
387
388       Rows  of  table  entries  can  be interleaved with groff control lines;
389       these do not count as table data.  On such lines  the  default  control
390       character  (.)  must  be  used  (and not changed); the no-break control
391       character is not recognized.  To start the first table entry in  a  row
392       with a dot, precede it with the roff dummy character \&.
393
394   Text blocks
395       An ordinary table entry's contents can make a column, and therefore the
396       table, excessively wide; the table then exceeds the line length of  the
397       page,  and  becomes  ugly or is exposed to truncation by the output de‐
398       vice.  When a  table  entry  requires  more  conventional  typesetting,
399       breaking  across  more than one output line (and thereby increasing the
400       height of its row), it can be placed within a text block.
401
402       tbl interprets a table entry beginning with “T{” at the end of an input
403       line  not  as  table data, but as a token starting a text block.  Simi‐
404       larly, “T}” at the start of an input line ends a text  block;  it  must
405       also  end  the  table entry.  Text block tokens can share an input line
406       with other table data (preceding T{ and following T}).  Input lines be‐
407       tween  these tokens are formatted in a diversion by troff.  Text blocks
408       cannot be nested.  Multiple text blocks can occur in a table row.
409
410       Text blocks are formatted as was the text prior to the table,  modified
411       by  applicable column descriptors.  Specifically, the classifiers A, C,
412       L, N, R, and S determine a text block's alignment within its cell,  but
413       not  its  adjustment.  Add na or ad requests to the beginning of a text
414       block to alter its adjustment distinctly from other text in  the  docu‐
415       ment.   As with other table entries, when a text block ends, any alter‐
416       ations to formatting parameters are discarded.  They do not affect sub‐
417       sequent table entries, not even other text blocks.
418
419       If w or x modifiers are not specified for all columns of a text block's
420       span, the default length of the text block (more  precisely,  the  line
421       length  used  to  process  the  text  block  diversion)  is computed as
422       L×C/(N+1), where L is the current line length, C the number of  columns
423       spanned  by  the  text block, and N the number of columns in the table.
424       If necessary, you can also control a text block's width by including an
425       ll  (line length) request in it prior to any text to be formatted.  Be‐
426       cause a diversion is used to format the  text  block,  its  height  and
427       width  are  subsequently  available in the registers dn and dl, respec‐
428       tively.
429
430   roff interface
431       The register TW stores the width of the table region in basic units; it
432       can't  be  used within the region itself, but is defined before the .TE
433       token is output so that a groff macro named TE can make use of it.   T.
434       is a Boolean-valued register indicating whether the bottom of the table
435       is being processed.  The #T register marks the top of the table.  Avoid
436       using these names for any other purpose.
437
438       tbl  also  defines a macro T# to produce the bottom and side lines of a
439       boxed table.  While tbl itself arranges for the  output  to  include  a
440       call  of  this macro at the end of such a table, it can also be used by
441       macro packages to create boxes for multi-page tables by calling it from
442       a  page  footer  macro that is itself called by a trap planted near the
443       bottom of the page.  See section “Limitations” below for more on multi-
444       page tables.
445
446       GNU tbl internally employs register, string, macro, and diversion names
447       beginning with the numeral 3.  A document to be preprocessed  with  GNU
448       tbl should not use any such identifiers.
449
450   Interaction with eqn
451       tbl should always be called before eqn(1).  (groff(1) automatically ar‐
452       ranges preprocessors in the correct order.)  Don't call the EQ  and  EN
453       macros  within tables; instead, set up delimiters in your eqn input and
454       use the delim region option so that tbl will recognize them.
455
456   GNU tbl enhancements
457       In addition to extensions noted above, GNU tbl removes constraints  en‐
458       dured by users of AT&T tbl.
459
460       • Region options can be specified in any lettercase.
461
462       • There  is no limit on the number of columns in a table, regardless of
463         their classification, nor any limit on the number of text blocks.
464
465       • All table rows are considered when deciding column widths,  not  just
466         those occurring in the first 200 input lines of a region.  Similarly,
467         table continuation (.T&) tokens are  recognized  outside  a  region's
468         first 200 input lines.
469
470       • Numeric and alphabetic entries may appear in the same column.
471
472       • Numeric and alphabetic entries may span horizontally.
473
474   Using GNU tbl within macros
475       You can embed a table region inside a macro definition.  However, since
476       tbl writes its own macro definitions at the beginning of each table re‐
477       gion,  it is necessary to call end macros instead of ending macro defi‐
478       nitions with “..”.  Additionally, the escape  character  must  be  dis‐
479       abled.
480
481       Not all tbl features can be exercised from such macros because tbl is a
482       roff preprocessor: it sees the input earlier than troff does.  For  ex‐
483       ample, vertically aligning decimal separators fails if the numbers con‐
484       taining them occur as macro or string parameters; the alignment is per‐
485       formed  by  tbl itself, which sees only \$1, \$2, and so on, and there‐
486       fore can't recognize a decimal separator that only appears  later  when
487       troff interpolates a macro or string definition.
488
489       Using  tbl macros within conditional input (that is, contingent upon an
490       if, ie, el, or while request) can result in misleading line numbers  in
491       subsequent  diagnostics.   tbl  unconditionally injects its output into
492       the source document, but the conditional branch containing it  may  not
493       be taken, and if it is not, the lf requests that tbl injects to restore
494       the source line number cannot take effect.  Consider copying the  input
495       line  counter register c. and restoring its value at a convenient loca‐
496       tion after applicable arithmetic.
497

Options

499       --help displays a usage message, while -v and  --version  show  version
500       information; all exit afterward.
501
502       -C     Enable  AT&T compatibility mode: recognize .TS and .TE even when
503              followed by a character other than space or  newline.   Further‐
504              more, interpret the uninterpreted leader escape sequence \a.
505

Limitations

507       Multi-page  tables,  if  boxed and/or if you want their column headings
508       repeated after page breaks, require support at the time the document is
509       formatted.   A convention for such support has arisen in macro packages
510       such as ms, mm, and me.  To use it, follow the .TS token with  a  space
511       and  then  “H”; this will be interpreted by the formatter as a TS macro
512       call with an H argument.  Then, within the  table  data,  call  the  TH
513       macro;  this informs the macro package where the headings end.  If your
514       table has no such heading rows, or you do not desire their  repetition,
515       call  TH immediately after the table format specification.  If a multi-
516       page table is boxed or has repeating column headings, do not enclose it
517       with  keep/release macros, or divert it in any other way.  Further, the
518       bp request will not cause a page break in a “TS  H”  table.   Define  a
519       macro  to wrap bp: invoke it normally if there is no current diversion.
520       Otherwise, pass the macro call to the  enclosing  diversion  using  the
521       transparent  line  escape  sequence  \!; this will “bubble up” the page
522       break to the output device.  See section “Examples” below for a  demon‐
523       stration.
524
525       Double  horizontal  rules  are not supported by grotty(1); single rules
526       are used instead.  grotty also ignores half-line motions, so the u col‐
527       umn  modifier has no effect.  On terminal devices (“nroff mode”), hori‐
528       zontal rules and box borders occupy a full vee of space; this amount is
529       doubled for doublebox tables.  Tables using these features thus require
530       more vertical space in nroff mode than in troff mode: write ne requests
531       accordingly.  Vertical rules between columns are drawn in the space be‐
532       tween columns in nroff mode; using double vertical rules and/or  reduc‐
533       ing the column separation below the default can make them ugly or over‐
534       strike them with table data.
535
536       A text block within a table must be able to fit on one page.
537
538       Using \a to put leaders in table entries does not work in GNU tbl,  ex‐
539       cept  in  compatibility mode.  This is correct behavior: \a is an unin‐
540       terpreted leader.  You can still use the roff  leader  character  (Con‐
541       trol+A)  or  define a string to use \a as it was designed: to be inter‐
542       preted only in copy mode.
543
544              .ds a \a
545              .TS
546              box center tab(;);
547              Lw(2i)0 L.
548              Population\*a;6,327,119
549              .TE
550
551                           ┌──────────────────────────────┐
552                           │Population..........6,327,119 │
553                           └──────────────────────────────┘
554       A leading  and/or  trailing  |  in  a  format  specification,  such  as
555|LCR|.”,  produces an en space between the vertical rules and the con‐
556       tent of the adjacent columns.  If no such space is desired (so that the
557       rule  abuts  the  content), you can introduce “dummy” columns with zero
558       separation and empty corresponding table entries before and/or after.
559
560              .TS
561              center tab(#);
562              R0|L C R0|L.
563              _
564              #levulose#glucose#dextrose#
565              _
566              .TE
567
568       These dummy columns have zero width and are therefore invisible; unfor‐
569       tunately they usually don't work as intended on terminal devices.
570

Examples

572       It  can  be easier to acquire the language of tbl through examples than
573       formal description, especially at first.
574
575              .TS
576              box center tab(#);
577              Cb Cb
578              L L.
579              Ability#Application
580              Strength#crushes a tomato
581              Dexterity#dodges a thrown tomato
582              Constitution#eats a month-old tomato without becoming ill
583              Intelligence#knows that a tomato is a fruit
584              Wisdom#chooses \f[I]not\f[] to put tomato in a fruit salad
585              Charisma#sells obligate carnivores tomato-based fruit salads
586              .TE
587
588        ┌───────────────────────────────────────────────────────────────────┐
589Ability                          Application                     
590        │Strength       crushes a tomato                                    │
591        │Dexterity      dodges a thrown tomato                              │
592        │Constitution   eats a month-old tomato without becoming ill        │
593        │Intelligence   knows that a tomato is a fruit                      │
594        │Wisdom         chooses not to put tomato in a fruit salad          │
595        │Charisma       sells obligate carnivores tomato-based fruit salads │
596        └───────────────────────────────────────────────────────────────────┘
597       The A and N column classifiers can be easier to grasp in visual render‐
598       ing than in description.
599
600              .TS
601              center tab(;);
602              CbS,LN,AN.
603              Daily energy intake (in MJ)
604              Macronutrients
605              .\" assume 3 significant figures of precision
606              Carbohydrates;4.5
607              Fats;2.25
608              Protein;3
609              .T&
610              LN,AN.
611              Mineral
612              Pu-239;14.6
613              _
614              .T&
615              LN.
616              Total;\[ti]24.4
617              .TE
618
619                                Daily energy intake (in MJ)
620                                Macronutrients
621                                  Carbohydrates       4.5
622                                  Fats                2.25
623                                  Protein             3
624                                Mineral
625                                  Pu-239             14.6
626                                ────────────────────────────
627                                Total               ~24.4
628
629       Next,  we'll lightly adapt a compact presentation of spanning, vertical
630       alignment, and zero-width column modifiers from  the  mandoc  reference
631       for its tbl interpreter.  It rewards close study.
632
633              .TS
634              box center tab(:);
635              Lz  S | Rt
636              Ld| Cb| ^
637              ^ | Rz  S.
638              left:r
639              l:center:
640              :right
641              .TE
642
643                                      ┌───────────┬───┐
644                                      │le│ft       │ r │
645                                      │  │ center │   │
646                                      │l │      right │
647                                      └──┴────────────┘
648       Row  staggering  is  not visually achievable on terminal devices, but a
649       table using it can remain comprehensible nonetheless.
650
651              .TS
652              center tab(|);
653              Cf(BI) Cf(BI) Cf(B), C C Cu.
654              n|n\f[B]\[tmu]\f[]n|difference
655              1|1
656              2|4|3
657              3|9|5
658              4|16|7
659              5|25|9
660              6|36|11
661              .TE
662
663                                    n   n   difference
664
665                                    1    1
666                                    2    4        3
667                                    3    9        5
668                                    4   16        7
669                                    5   25        9
670                                    6   36        11
671
672       Some tbl features cannot be illustrated in the limited environment of a
673       portable man page.
674
675       We  can  define  a  macro outside of a tbl region that we can call from
676       within it to cause a page break inside a multi-page boxed  table.   You
677       can  choose  a  different  name;  be sure to change both occurrences of
678       “BP”.
679
680              .de BP
681              .  ie '\\n(.z'' .bp \\$1
682              .  el \!.BP \\$1
683              ..
684

See also

686       “Tbl—A Program to Format Tables”, by M. E. Lesk, 1976 (revised 16 Janu‐
687       ary  1979),  AT&T  Bell Laboratories Computing Science Technical Report
688       No. 49.
689
690       The spanning example above was taken from mandoc's man page for its tbl
691       implementation ⟨https://man.openbsd.org/tbl.7⟩.
692
693       groff(1), troff(1)
694
695
696
697groff 1.23.0                    2 November 2023                         tbl(1)
Impressum