1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
|
'\" t
.ig
Copyright (C) 1989-1995, 2001, 2002, 2003, 2004, 2006, 2007, 2008,
2009, 2010
Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that this permission notice may be included in
translations approved by the Free Software Foundation instead of in
the original English.
..
.
.
.TH @G@TBL @MAN1EXT@ "@MDATE@" "Groff Version @VERSION@"
.
.
.SH NAME
@g@tbl \- format tables for troff
.
.
.SH SYNOPSIS
.SY @g@tbl
.OP \-Cv
.RI [ files\~ .\|.\|.]
.YS
.
.
.SH DESCRIPTION
This manual page describes the GNU version of
.BR tbl ,
which is part of the groff document formatting system.
.B tbl
compiles descriptions of tables embedded within
.B troff
input files into commands that are understood by
.BR troff .
Normally, it should be invoked using the
.B \-t
option of
.B groff.
It is highly compatible with Unix
.BR tbl .
The output generated by GNU
.B tbl
cannot be processed with Unix
.BR troff ;
it must be processed with GNU
.BR troff .
If no files are given on the command line or a filename of
.B \-
is given, the standard input is read.
.
.
.SH OPTIONS
.TP
.B \-C
Enable compatibility mode to
recognize
.B .TS
and
.B .TE
even when followed by a character other than space or newline.
Leader characters (\[rs]a) are handled as interpreted.
.
.TP
.B \-v
Print the version number.
.
.
.SH USAGE
.B tbl
expects to find table descriptions wrapped in the
.B .TS
(table start) and
.B .TE
(table end) macros.
.
.
.SS Global options
The line immediately following the
.B .TS
macro may contain any of the following global options (ignoring the case of
characters \[en] Unix tbl only accepts options with all characters lowercase
or all characters uppercase), separated by spaces, tabs, or commas:
.
.TP
.B allbox
Enclose each item of the table in a box.
.
.TP
.B box
Enclose the table in a box.
.
.TP
.B center
Center the table (default is left-justified).
The alternative keyword name
.B centre
is also recognized (this is a GNU tbl extension).
.
.TP
.BI decimalpoint( c )
Set the character to be recognized as the decimal point in numeric
columns (GNU tbl only).
.
.TP
.BI delim( xy )
Use
.I x
and\~\c
.I y
as start and end delimiters for
.BR @g@eqn (@MAN1EXT@).
.
.TP
.B doublebox
Enclose the table in a double box.
.
.TP
.B doubleframe
Same as doublebox (GNU tbl only).
.
.TP
.B expand
Make the table as wide as the current line length (providing a column
separation factor).
Ignored if one or more `x' column specifiers are used (see below).
.
.IP
In case the sum of the column widths is larger than the current line length,
the column separation factor is set to zero; such tables extend into the
right margin, and there is no column separation at all.
.
.TP
.B frame
Same as box (GNU tbl only).
.
.TP
.BI linesize( n )
Set lines or rules (e.g. from
.BR box )
in
.IR n -point
type.
.
.TP
.B nokeep
Don't use diversions to prevent page breaks (GNU tbl only).
Normally
.B tbl
attempts to prevent undesirable breaks in boxed tables by using diversions.
This can sometimes interact badly with macro packages' own use of
diversions, when footnotes, for example, are used.
.
.TP
.B nospaces
Ignore leading and trailing spaces in data items (GNU tbl only).
.
.TP
.B nowarn
Turn off warnings related to tables
exceeding the current line width (GNU tbl only).
.
.TP
.BI tab( x )
Use the character
.I x
instead of a tab to separate items in a line of input data.
.
.LP
The global options must end with a semicolon.
There might be whitespace between an option and its argument in parentheses.
.
.
.SS Table format specification
After global options come lines describing the format of each line of
the table.
Each such format line describes one line of the table itself, except that
the last format line (which you must end with a period) describes all
remaining lines of the table.
A single-key character describes each column of each line of the table.
Key characters can be separated by spaces or tabs.
You may run format specifications for multiple lines together on the same
line by separating them with commas.
.
.LP
You may follow each key character with specifiers that determine the font
and point size of the corresponding item, that determine column width,
inter-column spacing, etc.
.
.LP
The longest format line defines the number of columns in the table; missing
format descriptors at the end of format lines are assumed to be\~\c
.BR L .
Extra columns in the data (which have no corresponding format entry) are
ignored.
.
.LP
The available key characters are:
.
.TP
.BR a , A
Center longest line in this column and then left-justifies all other lines
in this column with respect to that centered line.
The idea is to use such alphabetic subcolumns (hence the name of the key
character) in combination with\~
.BR L ;
they are called subcolumns because
.BR A \~items
are indented by\~1n relative to
.BR L \~entries.
Example:
.RS
.IP
.EX
\&.TS
\&tab(;);
\&ln,an.
\&item one;1
\&subitem two;2
\&subitem three;3
\&.T&
\&ln,an.
\&item eleven;11
\&subitem twentytwo;22
\&subitem thirtythree;33
\&.TE
.EE
.RE
.
.IP
Result:
.
.RS
.IP
.TS
tab(;);
ln,an.
item one;1
subitem two;2
subitem three;3
.T&
ln,an.
item eleven;11
subitem twentytwo;22
subitem thirtythree;33
.TE
.RE
.
.TP
.BR c , C
Center item within the column.
.
.TP
.BR l , L
Left-justify item within the column.
.
.TP
.BR n , N
Numerically justify item in the column: Units positions of numbers are
aligned vertically.
If there is one or more dots adjacent to a digit, use the rightmost one for
vertical alignment.
If there is no dot, use the rightmost digit for vertical alignment;
otherwise, center the item within the column.
Alignment can be forced to a certain position using `\[rs]&'; if there is
one or more instances of this special (non-printing) character present
within the data, use the leftmost one for alignment.
Example:
.RS
.IP
.EX
\&.TS
\&n.
\&1
\&1.5
\&1.5.3
\&abcde
\&a\[rs]&bcde
\&.TE
.EE
.RE
.
.IP
Result:
.
.RS
.IP
.TS
n.
1
1.5
1.5.3
abcde
a\&bcde
.TE
.RE
.
.IP
If numerical entries are combined with
.B L
or
.BR R \~entries
\[en] this can happen if the table format is changed with
.B .T&
\%\[en],
center the widest
.I number
(of the data entered under the
.BR N \~specifier
regime) relative to the widest
.B L
or
.BR R \~entry,
preserving the alignment of all numerical entries.
Contrary to
.BR A \~type
entries, there is no extra indentation.
.
.IP
Using equations (to be processed with
.BR eqn )
within columns which use the
.BR N \~specifier
is problematic in most cases due to
.BR tbl 's
algorithm for finding the vertical alignment, as described above.
Using the global
.B delim
option, however, it is possible to make
.B tbl
ignore the data within
.B eqn
delimiters for that purpose.
.
.
.TP
.BR r , R
Right-justify item within the column.
.
.TP
.BR s , S
Span previous item on the left into this column.
Not allowed for the first column.
.
.TP
.B ^
Span down entry from previous row in this column.
Not allowed for the first row.
.
.TP
.BR _ , -
Replace this entry with a horizontal line.
.
.TP
.B =
.
Replace this entry with a double horizontal line.
.
.TP
.B |
The corresponding column becomes a vertical rule (if two of these are
adjacent, a double vertical rule).
.
.LP
A vertical bar to the left of the first key letter or to the right of the
last one produces a line at the edge of the table.
.
.LP
To change the data format within a table, use the
.B .T&
command (at the start of a line).
It is followed by format and data lines (but no global options) similar to
the
.B .TS
request.
.
.
.SS Column specifiers
Here are the specifiers that can appear in suffixes to column key letters
(in any order):
.
.TP
.BR b , B
Short form of
.B fB
(make affected entries bold).
.
.TP
.BR d , D
Start an item vertically spanning rows at the bottom of its range rather
than vertically centering it (GNU tbl only).
.
.TP
.BR e , E
Make equally-spaced columns.
All columns marked with this specifier get the same width; this happens
after the affected column widths have been computed (this means that the
largest width value rules).
.
.TP
.BR f , F
Either of these specifiers may be followed by a font name (either one or two
characters long), font number (a single digit), or long name in parentheses
(the last form is a GNU tbl extension).
A one-letter font name must be separated by one or more blanks from whatever
follows.
.
.TP
.BR i , I
Short form of
.B fI
(make affected entries italic).
.
.TP
.BR m , M
This is a GNU tbl extension.
Either of these specifiers may be followed by a macro name
(either one or two characters long),
or long name in parentheses.
A one-letter macro name must be separated by one or more blanks
from whatever follows.
The macro which name can be specified here
must be defined before creating the table.
It is called just before the table's cell text is output.
As implemented currently, this macro is only called if block input is used,
that is, text between `T{' and `T}'.
The macro should contain only simple
.B troff
requests to change the text block formatting, like text adjustment,
hyphenation, size, or font.
The macro is called
.I after
other cell modifications like
.BR b ,
.B f
or
.B v
are output.
Thus the macro can overwrite other modification specifiers.
.
.TP
.BR p , P
Followed by a number, this does a point size change for the affected fields.
If signed, the current point size is incremented or decremented (using a
signed number instead of a signed digit is a GNU tbl extension).
A point size specifier followed by a column separation number must be
separated by one or more blanks.
.
.TP
.BR t , T
Start an item vertically spanning rows at the top of its range rather than
vertically centering it.
.
.TP
.BR u , U
Move the corresponding column up one half-line.
.
.TP
.BR v , V
Followed by a number, this indicates the vertical line spacing to be used in
a multi-line table entry.
If signed, the current vertical line spacing is incremented or decremented
(using a signed number instead of a signed digit is a GNU tbl extension).
A vertical line spacing specifier followed by a column separation number
must be separated by one or more blanks.
No effect if the corresponding table entry isn't a text block.
.
.TP
.BR w , W
Minimal column width value.
Must be followed either by a
.BR @g@troff (@MAN1EXT@)
width expression in parentheses or a unitless integer.
If no unit is given, en units are used.
Also used as the default line length for included text blocks.
If used multiple times to specify the width for a particular column,
the last entry takes effect.
.
.TP
.BR x , X
An expanded column.
After computing all column widths without an
.BR x \~specifier,
use the remaining line width for this column.
If there is more than one expanded column, distribute the remaining
horizontal space evenly among the affected columns (this is a GNU
extension).
This feature has the same effect as specifying a minimum column width.
.
.TP
.BR z , Z
Ignore the corresponding column for width-calculation purposes, this is,
don't use the fields but only the specifiers of this column to compute
its width.
.
.LP
A number suffix on a key character is interpreted as a column
separation in en units (multiplied in proportion if the
.B expand
option is on \[en] in case of overfull tables this might be zero).
Default separation is 3n.
.
.LP
The column
.RB specifier\~ x
is mutually exclusive with
.B e
.RB and\~ w
(but
.B e
is not mutually exclusive
.RB with\~ w );
if specified multiple times for a particular column, the last entry takes
effect:
.BR x \~unsets
both
.B e
.RB and\~ w ,
while either
.B e
or
.B w
.RB overrides\~ x .
.
.
.SS Table data
The format lines are followed by lines containing the actual data for the
table, followed finally by
.BR .TE .
Within such data lines, items are normally separated by tab characters (or
the character specified with the
.B tab
option).
Long input lines can be broken across multiple lines if the last character
on the line is `\[rs]' (which vanishes after concatenation).
.
.LP
Note that
.B @g@tbl
computes the column widths line by line, applying \[rs]w on each entry
which isn't a text block.
As a consequence, constructions like
.IP
.EX
\&.TS
\&c,l.
\&\[rs]s[20]MM
\&MMMM
\&.TE
.EE
.
.LP
fail; you must either say
.IP
.EX
\&.TS
\&cp20,lp20.
\&MM
\&MMMM
\&.TE
.EE
.
.LP
or
.
.IP
.EX
\&.TS
\&c,l.
\&\[rs]s[20]MM
\&\[rs]s[20]MMMM
\&.TE
.EE
.
.LP
A dot starting a line, followed by anything but a digit is handled as a
troff command, passed through without changes.
The table position is unchanged in this case.
.
.LP
If a data line consists of only `_' or `=', a single or double line,
respectively, is drawn across the table at that point; if a single item in a
data line consists of only `_' or `=', then that item is replaced by a
single or double line, joining its neighbours.
If a data item consists only of `\[rs]_' or `\[rs]=', a single or double line,
respectively, is drawn across the field at that point which does not join
its neighbours.
.
.LP
A data item consisting only of `\[rs]Rx' (`x' any character) is replaced by
repetitions of character `x' as wide as the column (not joining its
neighbours).
.
.LP
A data item consisting only of `\[rs]^' indicates that the field immediately
above spans downward over this row.
.
.
.SS Text blocks
A text block can be used to enter data as a single entry which would be
too long as a simple string between tabs.
It is started with `T{' and closed with `T}'.
The former must end a line, and the latter must start a line, probably
followed by other data columns (separated with tabs or the character given
with the
.B tab
global option).
.
.LP
By default, the text block is formatted with the settings which were
active before entering the table, possibly overridden by the
.BR m ,
.BR v ,
and
.B w
tbl specifiers.
For example, to make all text blocks ragged-right, insert
.B .na
right before the starting
.B .TS
(and
.B .ad
after the table).
.
.LP
If either `w' or `x' specifiers are not given for
.I all
columns of a text block span, the default length of the text block (to be
more precise, the line length used to process the text block diversion) is
computed as L\[tmu]C/(N+1), where `L' is the current line length, `C' the
number of columns spanned by the text block, and `N' the total number of
columns in the table.
Note, however, that the actual diversion width as returned in register
.B \[rs]n[dl]
is used eventually as the text block width.
If necessary, you can also control the text block width with a direct
insertion of a
.B .ll
request right after `T{'.
.
.
.SS Miscellaneous
The number register
.B \[rs]n[TW]
holds the table width; it can't be used within the table itself but is defined
right before calling
.B .TE
so that this macro can make use of it.
.
.LP
.B tbl
also defines a macro
.B .T#
which produces the bottom and side lines of a boxed table.
While
.B tbl
does call this macro itself at the end of the table, it can be used by
macro packages to create boxes for multi-page tables by calling it within the
page footer.
An example of this is shown by the
.B \-ms
macros which provide this functionality if a table starts with
.B .TS\ H
instead of the standard call to the
.B .TS
macro.
.
.
.SH "INTERACTION WITH @G@EQN"
.BR @g@tbl (@MAN1EXT@)
should always be called before
.BR @g@eqn (@MAN1EXT@)
.RB ( groff (@MAN1EXT@)
automatically takes care of the correct order of preprocessors).
.
.LP
It is not advisable to use the hash character (#) as a delimiter for in-line
equations in
.BR @g@eqn (@MAN1EXT@)
since
.B @g@tbl
uses a macro called
.BR .T# ,
causing a clash.
.
.
.SH "GNU TBL ENHANCEMENTS"
There is no limit on the number of columns in a table, nor any limit on the
number of text blocks.
All the lines of a table are considered in deciding column widths, not just
the first 200.
Table continuation
.RB ( .T& )
lines are not restricted to the first 200 lines.
.
.LP
Numeric and alphabetic items may appear in the same column.
.
.LP
Numeric and alphabetic items may span horizontally.
.
.LP
.B @g@tbl
uses register, string, macro and diversion names beginning with the digit\~\c
.BR 3 .
When using
.B @g@tbl
you should avoid using any names beginning with a\~\c
.BR 3 .
.
.
.SH "GNU TBL WITHIN MACROS"
Since
.B @g@tbl
defines its own macros (right before each table) it is necessary to use
an `end-of-macro' macro. Additionally, the escape character has to be switched
off. Here an example.
.IP
.EX
\&.eo
\&.de ATABLE ..
\&.TS
\&allbox tab(;);
\&cl.
\&\[rs]$1;\[rs]$2
\&.TE
\&...
\&.ec
\&.ATABLE A table
\&.ATABLE Another table
\&.ATABLE And \[dq]another one\[dq]
.EE
.
.LP
Note, however, that not all features of
.B @g@tbl
can be wrapped into a macro because
.B @g@tbl
sees the input earlier than
.BR @g@troff .
For example, number formatting with vertically aligned decimal points
fails if those numbers are passed on as macro parameters because
decimal point alignment is handled by
.B @g@tbl
itself: It only sees `\[rs]$1', `\[rs]$2', etc., and therefore can't
recognize the decimal point.
.
.
.SH BUGS
You should use
.BR .TS\ H / .TH
in conjunction with a supporting macro package for
.I all
multi-page boxed tables.
If there is no header that you wish to appear at the top of each page
of the table, place the
.B .TH
line immediately after the format section.
Do not enclose a multi-page table within keep/release macros,
or divert it in any other way.
.
.LP
A text block within a table must be able to fit on one page.
.
.LP
The
.B bp
request cannot be used to force a page-break in a multi-page table.
Instead, define
.B BP
as follows
.
.IP
.EX
\&.de BP
\&. ie '\[rs]\[rs]n(.z'' .bp \[rs]\[rs]$1
\&. el \[rs]!.BP \[rs]\[rs]$1
\&..
.EE
.
.LP
and use
.B BP
instead of
.BR bp .
.
.LP
Using \[rs]a directly in a table to get leaders does not work (except in
compatibility mode).
This is correct behaviour: \[rs]a is an
.B uninterpreted
leader.
To get leaders use a real leader, either by using a control A or like
this:
.
.IP
.EX
\&.ds a \[rs]a
\&.TS
\&tab(;);
\&lw(1i) l.
\&A\[rs]*a;B
\&.TE
.EE
.
.
.SH REFERENCE
Lesk, M.E.: "TBL \[en] A Program to Format Tables".
For copyright reasons it cannot be included in the groff distribution,
but copies can be found with a title search on the World Wide Web.
.
.
.SH "SEE ALSO"
.BR groff (@MAN1EXT@),
.BR @g@troff (@MAN1EXT@)
.
.\" Local Variables:
.\" mode: nroff
.\" End:
|