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