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

NAME

6       tbl - format tables for troff
7

SYNOPSIS

9       tbl [-Cv] [files ...]
10

DESCRIPTION

12       This manual page describes the GNU version of tbl, which is part of the
13       groff document formatting system.  tbl compiles descriptions of  tables
14       embedded  within troff input files into commands that are understood by
15       troff.  Normally, it should be invoked using the -t  option  of  groff.
16       It is highly compatible with Unix tbl.  The output generated by GNU tbl
17       cannot be processed with Unix troff; it  must  be  processed  with  GNU
18       troff.  If no files are given on the command line or a filename of - is
19       given, the standard input is read.
20

OPTIONS

22       -C     Enable compatibility mode to recognize .TS  and  .TE  even  when
23              followed  by  a  character  other than space or newline.  Leader
24              characters (\a) are handled as interpreted.
25
26       -v     Print the version number.
27

USAGE

29       tbl expects to find table descriptions wrapped in the .TS (table start)
30       and .TE (table end) macros.
31
32   Global options
33       The  line  immediately  following  the .TS macro may contain any of the
34       following global options (ignoring the case of characters  –  Unix  tbl
35       only  accepts  options  with all characters lowercase or all characters
36       uppercase), separated by spaces, tabs, or commas:
37
38       allbox Enclose each item of the table in a box.
39
40       box    Enclose the table in a box.
41
42       center Center the table (default is left-justified).   The  alternative
43              keyword name centre is also recognized (this is a GNU tbl exten‐
44              sion).
45
46       decimalpoint(c)
47              Set the character to be  recognized  as  the  decimal  point  in
48              numeric columns (GNU tbl only).
49
50       delim(xy)
51              Use x and y as start and end delimiters for eqn(1).
52
53       doublebox
54              Enclose the table in a double box.
55
56       doubleframe
57              Same as doublebox (GNU tbl only).
58
59       expand Make  the  table as wide as the current line length (providing a
60              column separation factor).  Ignored if one or  more  `x'  column
61              specifiers are used (see below).
62
63              In  case the sum of the column widths is larger than the current
64              line length, the column separation factor is set to  zero;  such
65              tables extend into the right margin, and there is no column sep‐
66              aration at all.
67
68       frame  Same as box (GNU tbl only).
69
70       linesize(n)
71              Set lines or rules (e.g. from box) in n-point type.
72
73       nokeep Don't use diversions to prevent  page  breaks  (GNU  tbl  only).
74              Normally  tbl  attempts  to  prevent undesirable breaks in boxed
75              tables by using diversions.  This can sometimes  interact  badly
76              with  macro packages' own use of diversions, when footnotes, for
77              example, are used.
78
79       nospaces
80              Ignore leading and trailing spaces in data items (GNU tbl only).
81
82       tab(x) Use the character x instead of a tab to separate items in a line
83              of input data.
84
85       The  global  options  must end with a semicolon.  There might be white‐
86       space between an option and its argument in parentheses.
87
88   Table format specification
89       After global options come lines describing the format of each  line  of
90       the  table.   Each  such  format  line  describes one line of the table
91       itself, except that the last format line (which you  must  end  with  a
92       period) describes all remaining lines of the table.  A single-key char‐
93       acter describes each column of each line of the table.  Key  characters
94       can  be separated by spaces or tabs.  You may run format specifications
95       for multiple lines together on the same line by  separating  them  with
96       commas.
97
98       You  may  follow  each key character with specifiers that determine the
99       font and point size of the corresponding item,  that  determine  column
100       width, inter-column spacing, etc.
101
102       The  longest  format  line  defines the number of columns in the table;
103       missing format descriptors at the end of format lines  are  assumed  to
104       be  L.   Extra  columns in the data (which have no corresponding format
105       entry) are ignored.
106
107       The available key characters are:
108
109       a,A    Center longest line in this column and then  left-justifies  all
110              other  lines  in this column with respect to that centered line.
111              The idea is to use such alphabetic subcolumns (hence the name of
112              the  key  character) in combination with L; they are called sub‐
113              columns  because  A  items  are  indented  by  1n  relative   to
114              L entries.  Example:
115
116                     .TS
117                     tab(;);
118                     ln,an.
119                     item one;1
120                     subitem two;2
121                     subitem three;3
122                     .T&
123                     ln,an.
124                     item eleven;11
125                     subitem twentytwo;22
126                     subitem thirtythree;33
127                     .TE
128
129              Result:
130
131                     item one                 1
132
133                      subitem two             2
134                      subitem three           3
135                     item eleven             11
136                      subitem twentytwo      22
137                      subitem thirtythree    33
138
139       c,C    Center item within the column.
140
141       l,L    Left-justify item within the column.
142
143       n,N    Numerically  justify item in the column: Units positions of num‐
144              bers are aligned vertically.  If there is one or more dots adja‐
145              cent  to  a digit, use the rightmost one for vertical alignment.
146              If there is no dot, use the rightmost digit for vertical  align‐
147              ment;  otherwise,  center the item within the column.  Alignment
148              can be forced to a certain position using `\&'; if there is  one
149              or  more  instances  of  this  special  (non-printing) character
150              present within the data, use the  leftmost  one  for  alignment.
151              Example:
152
153                     .TS
154                     n.
155                     1
156                     1.5
157                     1.5.3
158                     abcde
159                     a\&bcde
160                     .TE
161
162              Result:
163
164                       1
165                       1.5
166                     1.5.3
167                      abcde
168                       abcde
169
170              If numerical entries are combined with L or R entries – this can
171              happen if the table format is changed with  .T&  –,  center  the
172              widest number (of the data entered under the N specifier regime)
173              relative to the widest L or R entry, preserving the alignment of
174              all  numerical entries.  Contrary to A type entries, there is no
175              extra indentation.
176
177              Using equations (to be processed with eqn) within columns  which
178              use  the  N  specifier is problematic in most cases due to tbl's
179              algorithm for  finding  the  vertical  alignment,  as  described
180              above.   Using  the global delim option, however, it is possible
181              to make tbl ignore the data within eqn delimiters for that  pur‐
182              pose.
183
184       r,R    Right-justify item within the column.
185
186       s,S    Span  previous  item  on the left into this column.  Not allowed
187              for the first column.
188
189       ^      Span down entry from previous row in this column.   Not  allowed
190              for the first row.
191
192       _,-    Replace this entry with a horizontal line.
193
194       =      Replace this entry with a double horizontal line.
195
196       |      The  corresponding  column  becomes  a  vertical rule (if two of
197              these are adjacent, a double vertical rule).
198
199       A vertical bar to the left of the first key letter or to the  right  of
200       the last one produces a line at the edge of the table.
201
202       To  change  the data format within a table, use the .T& command (at the
203       start of a line).  It is followed by format  and  data  lines  (but  no
204       global options) similar to the .TS request.
205
206   Column specifiers
207       Here  are the specifiers that can appear in suffixes to column key let‐
208       ters (in any order):
209
210       b,B    Short form of fB (make affected entries bold).
211
212       d,D    Start an item vertically spanning rows  at  the  bottom  of  its
213              range rather than vertically centering it (GNU tbl only).
214
215       e,E    Make equally-spaced columns.  All columns marked with this spec‐
216              ifier get the same width; this happens after the affected column
217              widths  have  been  computed  (this means that the largest width
218              value rules).
219
220       f,F    Either of these specifiers  may  be  followed  by  a  font  name
221              (either  one  or  two  characters  long),  font number (a single
222              digit), or long name in parentheses (the last form is a GNU  tbl
223              extension).   A one-letter font name must be separated by one or
224              more blanks from whatever follows.
225
226       i,I    Short form of fI (make affected entries italic).
227
228       m,M    This is a GNU tbl extension.  Either of these specifiers may  be
229              followed by a macro name (either one or two characters long), or
230              long name in parentheses.  A one-letter macro name must be sepa‐
231              rated  by  one  or more blanks from whatever follows.  The macro
232              which name can be specified here must be defined before creating
233              the  table.   It  is called just before the table's cell text is
234              output.  As implemented currently, this macro is only called  if
235              block  input  is used, that is, text between `T{' and `T}'.  The
236              macro should contain only simple troff requests  to  change  the
237              text  block formatting, like text adjustment, hyphenation, size,
238              or font.  The macro is called  after  other  cell  modifications
239              like  b,  f or v are output.  Thus the macro can overwrite other
240              modification specifiers.
241
242       p,P    Followed by a number, this does a  point  size  change  for  the
243              affected  fields.   If  signed, the current point size is incre‐
244              mented or decremented (using a signed number instead of a signed
245              digit  is a GNU tbl extension).  A point size specifier followed
246              by a column separation number must be separated by one  or  more
247              blanks.
248
249       t,T    Start  an  item vertically spanning rows at the top of its range
250              rather than vertically centering it.
251
252       u,U    Move the corresponding column up one half-line.
253
254       v,V    Followed by a number, this indicates the vertical  line  spacing
255              to  be used in a multi-line table entry.  If signed, the current
256              vertical line spacing is incremented  or  decremented  (using  a
257              signed number instead of a signed digit is a GNU tbl extension).
258              A vertical line spacing specifier followed by a  column  separa‐
259              tion  number must be separated by one or more blanks.  No effect
260              if the corresponding table entry isn't a text block.
261
262       w,W    Minimal column width  value.   Must  be  followed  either  by  a
263              troff(1)  width expression in parentheses or a unitless integer.
264              If no unit is given, en  units  are  used.   Also  used  as  the
265              default  line length for included text blocks.  If used multiple
266              times to specify the width for a  particular  column,  the  last
267              entry takes effect.
268
269       x,X    An  expanded  column.  After computing all column widths without
270              an x specifier, use the remaining line width  for  this  column.
271              If  there  is  more  than  one  expanded  column, distribute the
272              remaining horizontal space evenly  among  the  affected  columns
273              (this  is a GNU extension).  This feature has the same effect as
274              specifying a minimum column width.
275
276       z,Z    Ignore the corresponding column for width-calculation  purposes,
277              this  is,  don't  use the fields but only the specifiers of this
278              column to compute its width.
279
280       A number suffix on a key character is interpreted as a  column  separa‐
281       tion in en units (multiplied in proportion if the expand option is on –
282       in case of overfull tables this might be zero).  Default separation  is
283       3n.
284
285       The column specifier x is mutually exclusive with e and w (but e is not
286       mutually exclusive with w); if specified multiple times for a  particu‐
287       lar  column,  the last entry takes effect: x unsets both e and w, while
288       either e or w overrides x.
289
290   Table data
291       The format lines are followed by lines containing the actual  data  for
292       the  table, followed finally by .TE.  Within such data lines, items are
293       normally separated by tab characters (or the character  specified  with
294       the  tab option).  Long input lines can be broken across multiple lines
295       if the last character on the line is `\' (which vanishes after concate‐
296       nation).
297
298       Note  that  tbl computes the column widths line by line, applying \w on
299       each entry which isn't a text block.  As a  consequence,  constructions
300       like
301
302              .TS
303              c,l.
304              \s[20]MM
305              MMMM
306              .TE
307
308       fail; you must either say
309
310              .TS
311              cp20,lp20.
312              MM
313              MMMM
314              .TE
315
316       or
317
318              .TS
319              c,l.
320              \s[20]MM
321              \s[20]MMMM
322              .TE
323
324       A dot starting a line, followed by anything but a digit is handled as a
325       troff command, passed through without changes.  The table  position  is
326       unchanged in this case.
327
328       If  a  data  line consists of only `_' or `=', a single or double line,
329       respectively, is drawn across the table at that point; if a single item
330       in  a data line consists of only `_' or `=', then that item is replaced
331       by a single or double line, joining its neighbours.   If  a  data  item
332       consists  only  of `\_' or `\=', a single or double line, respectively,
333       is drawn across the field at that point which does not join its  neigh‐
334       bours.
335
336       A data item consisting only of `\Rx' (`x' any character) is replaced by
337       repetitions of character `x' as wide as the  column  (not  joining  its
338       neighbours).
339
340       A  data  item  consisting only of `\^' indicates that the field immedi‐
341       ately above spans downward over this row.
342
343   Text blocks
344       A text block can be used to enter data as a single entry which would be
345       too  long as a simple string between tabs.  It is started with `T{' and
346       closed with `T}'.  The former must end a  line,  and  the  latter  must
347       start  a  line, probably followed by other data columns (separated with
348       tabs or the character given with the tab global option).
349
350       By default, the text block is formatted with the  settings  which  were
351       active  before entering the table, possibly overridden by the m, v, and
352       w tbl specifiers.  For example, to make all text  blocks  ragged-right,
353       insert .na right before the starting .TS (and .ad after the table).
354
355       If either `w' or `x' specifiers are not given for all columns of a text
356       block span, the default length of the text block (to be  more  precise,
357       the  line  length used to process the text block diversion) is computed
358       as L×C/(N+1), where `L' is the current line length, `C' the  number  of
359       columns  spanned by the text block, and `N' the total number of columns
360       in the table.  Note,  however,  that  the  actual  diversion  width  as
361       returned in register \n[dl] is used eventually as the text block width.
362       If necessary, you can also control the text block width with  a  direct
363       insertion of a .ll request right after `T{'.
364
365   Miscellaneous
366       The  number  register  \n[TW]  holds  the table width; it can't be used
367       within the table itself but is defined right before calling .TE so that
368       this macro can make use of it.
369
370       tbl  also  defines a macro .T# which produces the bottom and side lines
371       of a boxed table.  While tbl does call this macro itself at the end  of
372       the  table, it can be used by macro packages to create boxes for multi-
373       page tables by calling it within the page footer.  An example  of  this
374       is  shown by the -ms macros which provide this functionality if a table
375       starts with .TS H instead of the standard call to the .TS macro.
376

INTERACTION WITH EQN

378       tbl(1) should always be called before  eqn(1)  (groff(1)  automatically
379       takes care of the correct order of preprocessors).
380

GNU TBL ENHANCEMENTS

382       There is no limit on the number of columns in a table, nor any limit on
383       the number of text blocks.  All the lines of a table are considered  in
384       deciding  column  widths,  not  just the first 200.  Table continuation
385       (.T&) lines are not restricted to the first 200 lines.
386
387       Numeric and alphabetic items may appear in the same column.
388
389       Numeric and alphabetic items may span horizontally.
390
391       tbl uses register, string, macro and diversion names beginning with the
392       digit  3.   When  using  tbl you should avoid using any names beginning
393       with a 3.
394

GNU TBL WITHIN MACROS

396       Since tbl defines its own macros (right before each table) it is neces‐
397       sary  to use an `end-of-macro' macro.  Additionally, the escape charac‐
398       ter has to be switched off.  Here an example.
399
400              .eo
401              .de ATABLE ..
402              .TS
403              allbox tab(;);
404              cl.
405              \$1;\$2
406              .TE
407              ...
408              .ec
409              .ATABLE A table
410              .ATABLE Another table
411              .ATABLE And "another one"
412
413       Note, however, that not all features of tbl can be wrapped into a macro
414       because  tbl  sees  the  input earlier than troff.  For example, number
415       formatting with vertically aligned decimal points fails if  those  num‐
416       bers  are passed on as macro parameters because decimal point alignment
417       is handled by tbl itself: It only sees `\$1', `\$2', etc.,  and  there‐
418       fore can't recognize the decimal point.
419

BUGS

421       You should use .TS H/.TH in conjunction with a supporting macro package
422       for all multi-page boxed tables.  If there is no header that  you  wish
423       to  appear  at  the  top  of each page of the table, place the .TH line
424       immediately after the format section.  Do not enclose a multi-page  ta‐
425       ble within keep/release macros, or divert it in any other way.
426
427       A text block within a table must be able to fit on one page.
428
429       The bp request cannot be used to force a page-break in a multi-page ta‐
430       ble.  Instead, define BP as follows
431
432              .de BP
433              .  ie '\\n(.z'' .bp \\$1
434              .  el \!.BP \\$1
435              ..
436
437       and use BP instead of bp.
438
439       Using \a directly in a table to get leaders does not  work  (except  in
440       compatibility mode).  This is correct behaviour: \a is an uninterpreted
441       leader.  To get leaders use a real leader, either by using a control  A
442       or like this:
443
444              .ds a \a
445              .TS
446              tab(;);
447              lw(1i) l.
448              A\*a;B
449              .TE
450

REFERENCE

452       Lesk,  M.E.: "TBL – A Program to Format Tables".  For copyright reasons
453       it cannot be included in the groff  distribution,  but  copies  can  be
454       found with a title search on the World Wide Web.
455

SEE ALSO

457       groff(1), troff(1)
458
459
460
461Groff Version 1.20.1            9 January 2009                          TBL(1)
Impressum