|
|
1.1 root 1: ....if \nM=0 .RP
2: ....TM 76-1274-5 39199 39199-11
3: .if \n(tm>0 .ND June 11, 1976*
4: .TL
5: Tbl \(em A Program to Format Tables\(dg
6: .AU "MH 2C-569" 6377
7: L. L. Cherry
8: M. E. Lesk
9: .AI
10: .MH
11: .AB
12: .I Tbl
13: is a document formatting preprocessor for
14: .I troff
15: or
16: .I nroff
17: which makes
18: even
19: fairly complex tables easy to specify and enter.
20: Tables are made up of columns which may be independently centered, right-adjusted,
21: left-adjusted, or aligned by decimal points.
22: Headings may be placed over single columns or groups of columns.
23: A table entry may contain equations, or may consist of several rows of text.
24: Horizontal or vertical lines may be drawn as desired
25: in the table,
26: and any table or element may be enclosed in a box.
27: For example:
28: .TS
29: center, box;
30: c s s s
31: c s s s
32: c |c |c |c
33: c |cp-2 |c |c
34: l |n |n |n.
35: U. S. Energy Production/Consumption
36: \s-2(in quadrillion Btu)\s0
37: =
38: Year Production Consumption Net
39: \^ all sources \^
40: _
41: 1953 36.77 36.27 +0.51
42: 1958 38.81 40.35 \-1.54
43: 1963 45.85 48.32 \-2.47
44: 1968 56.81 61.00 \-4.19
45: 1973 62.06 74.28 \-12.22
46: 1978 61.01 78.09 \-17.08
47: 1983 61.19 70.05 \-8.86
48: 1987 64.55 76.01 \-11.46
49: .TE
50: .AE
51: .tr #
52: .de e1
53: .nr \\$1 \\$2
54: ..
55: .de e2
56: .if !\\n(\\$1=\\n% .tm Error in example \\$1: referred to page \\n(\\$1, is on page \\n%
57: .rr \\$1
58: ..
59: .di qq
60: .EQ
61: delim $$
62: .EN
63: .di
64: .rm qq
65: .FS
66: \(dg This is version of |reference(v7tbl) revised by Lorinda Cherry.
67: .FE
68: .2C
69: .NH
70: Introduction.
71: .PP
72: .I Tbl
73: turns a simple description
74: of a table into a
75: .I troff
76: or
77: .I nroff |reference(troff reference)
78: program (list of commands) that prints the table.
79: It
80: attempts to isolate a portion of a job that it can
81: successfully
82: handle and leave the remainder for other programs.
83: Thus
84: .I tbl
85: may be used with the equation formatting
86: program
87: .I eqn |reference(latest eqn)
88: or various
89: layout macro packages |reference(msmacros)|reference(lesk kernighan typesetting)|reference(mashey smith documentation),
90: but does not duplicate their functions.
91: .PP
92: This memorandum is divided into two parts.
93: First we give the rules for preparing
94: .I tbl
95: input; then some examples are shown.
96: The description of rules is precise but technical, and
97: the beginning user may prefer to read the examples first,
98: as they show some common table arrangements.
99: A section explaining how to invoke
100: .I tbl
101: precedes the examples.
102: To avoid repetition, henceforth read
103: .I troff
104: as
105: .I
106: ``troff
107: .R
108: or
109: .I
110: nroff.''
111: .R
112: .ds . \^\s14.\s0
113: .PP
114: The input to
115: .I
116: tbl
117: .R
118: is text for a document, with tables preceded by a ``\f(CW.TS\fP''
119: (table start)
120: command and followed by a ``\f(CW.TE\fP''
121: (table end) command.
122: .I Tbl
123: processes the tables, generating
124: .I troff
125: formatting commands,
126: and leaves the remainder of the text unchanged.
127: The
128: .CW .TS
129: and
130: .CW .TE
131: lines are copied, too, so that
132: .I troff
133: page layout macros
134: (such as the memo formatting macros|reference(msmacros)) can use these lines
135: to delimit and place tables as they see fit.
136: In particular, any arguments on the
137: .CW .TS
138: or
139: .CW .TE
140: lines
141: are copied but otherwise ignored, and may be used by document layout
142: macro commands.
143: .PP
144: The format of the input is as follows:
145: .DS
146: \&text
147: .CW .TS
148: \&\fItable\fR
149: .CW .TE
150: \&text
151: .CW .TS
152: \&\fItable\fR
153: .CW .TE
154: \&text
155: \&\&\*. \*. \*.
156: .DE
157: where the format of each table is as follows:
158: .DS
159: .CW .TS
160: \fIoptions \f(CW;\fR
161: \fIformat \f(CW.\fP
162: data
163: .CW .TE
164: .DE
165: .R
166: Each table is independent, and must contain formatting
167: information
168: followed by the data to be entered in the table.
169: The formatting information, which describes the
170: individual columns and rows of the table, may be preceded
171: by a few options that affect the entire table.
172: A detailed description of tables is given in the next section.
173: .NH
174: Input commands.
175: .PP
176: As indicated above, a table contains, first, global options,
177: then a format section describing the layout of the table
178: entries, and then the data to be printed. The format and data
179: are always required, but not the options.
180: The various parts of the table are entered as follows:
181: .NH 2
182: Options
183: .PP
184: There may be a single line of options
185: affecting the whole table.
186: If present, this line must follow the
187: .CW .TS
188: line immediately
189: and must contain a list of option names
190: separated by spaces, tabs, or commas, and must be terminated by a semicolon.
191: The allowable options are:
192: .IP \f(CW##center\fR 15
193: center the table (default is left-adjust);
194: .IP \f(CW##expand\fR
195: make the table as wide as the current line length;
196: .IP \f(CW##box\fR
197: enclose the table in a box;
198: .IP \f(CW##allbox\fR
199: enclose each item in the table in a box;
200: .IP \f(CW##doublebox\fR
201: enclose the table in two boxes;
202: .IP \f(CW##tab#\fR(\fIx\fR\^)
203: use \fIx\fR instead of tab to separate data items.
204: .IP \f(CW##linesize(\fIn\fP)\fR
205: set lines or rules (e.g. from \f(CWbox\fR\^) in \fIn\fR point type;
206: .IP \f(CW##delim(\fIxy\fP)\fR
207: recognize \fIx\fR and \fIy\fR as the \fIeqn\fR delimiters.
208: .PP
209: .I Tbl
210: tries to keep boxed tables on one page by issuing
211: appropriate
212: .I troff
213: \&``need''
214: .CW .ne ) (
215: commands.
216: These requests are calculated from the number of lines in the tables,
217: and if there are spacing commands embedded in the input, these requests may be inaccurate;
218: use normal
219: .I troff
220: procedures, such as keep-release macros, in that case.
221: The user who must have a multi-page boxed table
222: should use macros designed for this purpose,
223: as explained below under `Usage.'
224: .NH 2
225: Format
226: .PP
227: The format section of the table specifies the layout
228: of the columns.
229: Each line in this section corresponds to one line
230: of the table (except that the last line corresponds to all following
231: lines up to the next
232: .CW .T& ,
233: if any \(em see below),
234: and each line contains a key-letter for each column
235: of the table.
236: It is good practice to separate the key letters for each
237: column by spaces or tabs.
238: Each key-letter is one of the following:
239: .cs B 25
240: .IP "##\f(CWL\fR#or#\f(CWl\fR" 10
241: to indicate a left-adjusted column entry;
242: .IP "##\f(CWR\fR#or#\f(CWr\fR
243: to indicate a right-adjusted column entry;
244: .IP "##\f(CWC\fR#or#\f(CWc\fR
245: to indicate a centered column entry;
246: .IP "##\f(CWN\fR#or#\f(CWn\fR
247: to indicate a numerical column entry, to be aligned with other
248: numerical entries so that the units digits of numbers line up;
249: .IP "##\f(CWA\fR#or#\f(CWa\fR
250: to indicate an alphabetic subcolumn;
251: all corresponding entries are aligned on the left, and positioned
252: so that the widest is centered within the column (see
253: example on page 12);
254: .IP "##\f(CWS\fR#or#\f(CWs\fR
255: to indicate a spanned heading, i.e. to indicate that the
256: entry from the previous column continues across this
257: column
258: (not allowed for the first column, obviously); or
259: .IP ##\f(CW\s+4\v'6p'^\v'-6p'\s0\fR
260: to indicate a vertically spanned heading, i.e. to indicate that
261: the entry from the previous row continues down through this row.
262: (Not allowed for the first row of the table, obviously).
263: .cs B
264: .PP
265: When numerical alignment is specified, a location for the decimal
266: point is sought. The rightmost dot
267: .CW . ) (
268: adjacent to a digit is used as a decimal point; if there is no
269: dot adjoining a digit, the rightmost digit is used as a units digit;
270: if no alignment is indicated, the item is centered in the column.
271: However, the special non-printing character string
272: .CW \e&
273: may be used
274: to override unconditionally dots
275: and digits, or to align alphabetic data;
276: this string lines up where a dot normally would,
277: and then disappears from the final output.
278: In the example below, the items shown at the left will be
279: aligned (in a numerical column) as shown on the right:
280: .KS
281: .TS
282: center;
283: l6 n.
284: 13 13
285: 4\*.2 4\&\*.2
286: 26\*.4\*.12 26\*.4\&\*.12
287: abc abc
288: abc\e& abc\&
289: 43\e&3\*.22 43\&3\*.22
290: 749\*.12 749\&\*.12
291: .TE
292: .KE
293: .PP
294: \fBNote:\fR
295: If numerical data are used in the same column with wider
296: .CW L
297: or
298: .CW r
299: type table entries, the widest \fInumber\fR is centered relative
300: to the wider
301: .CW L
302: or
303: .CW r
304: items (\f(CWL\fR is used instead of \f(CWl\fR for readability;
305: they have the same meaning as key-letters).
306: Alignment within the numerical items is preserved.
307: This is similar to the behavior of
308: .CW a
309: type data, as explained above.
310: However,
311: alphabetic subcolumns (requested by the
312: .CW a
313: key-letter)
314: are always slightly indented relative to
315: .CW L
316: items;
317: if necessary, the column width is increased to force this.
318: This is not true for \f(CWn\fR type entries.
319: .PP
320: .ft BI
321: Warning:
322: .ft 1
323: the \f(CWn\fR and \f(CWa\fR items should not be used in
324: the same column.
325: .PP
326: For readability, the key-letters describing each column should
327: be separated by spaces.
328: The end of the format section is indicated by a period.
329: The layout of the key-letters in the format section resembles
330: the layout of the actual data in the table.
331: Thus a simple format might appear as:
332: .P1
333: c s s
334: l n n .
335: .P2
336: which specifies a table of three columns. The first line
337: of the table contains a heading centered across all three
338: columns; each remaining line contains a left-adjusted item
339: in the first column followed by two columns of numerical
340: data.
341: A sample table in this format might be:
342: .br
343: .ne 6v
344: .br
345: .in +4
346: .TS
347: c s s
348: l n n.
349: Overall title
350: Item-a 34.22 9.1
351: Item-b 12.65 .02
352: Items: c,d,e 23 5.8
353: Total 69.87 14.92
354: .TE
355: .in -4
356: There are some additional features of the key-letter system:
357: .IP "\fI##Horizontal lines#\fR"
358: \(em A key-letter may be replaced by
359: .CW _
360: (underscore) to indicate
361: a horizontal line in place of the corresponding column entry,
362: or by
363: .CW =
364: to indicate a double horizontal line.
365: If an adjacent column contains a horizontal line, or if
366: there are vertical lines adjoining this column,
367: this horizontal line is extended to meet the nearby lines.
368: If any data entry is provided for this column, it is ignored and
369: a warning message is printed.
370: .QQ do the D(x) and M(x) to draw a line of 'x' characters.
371: .QQ D will draw divided lines, M merged lines. thus - is simplh M(\(ru)
372: .IP "\fI##Vertical lines#\fR"
373: \(em A vertical bar may be placed between column key-letters. This will
374: cause a vertical line between the corresponding columns of the table.
375: A vertical bar to the left of the first key-letter
376: or to the right of the last one produces a line at the
377: edge of the table.
378: If two vertical bars appear between key-letters, a double vertical
379: line is drawn.
380: .IP "\fI##Space between columns#\fR"
381: \(em A number may follow the key-letter. This indicates the amount of separation
382: between this column and the next column.
383: The number normally specifies the separation in
384: .I
385: ens
386: .R
387: (one
388: en
389: .ne 3
390: is about the width of the letter `n').*
391: .FS
392: * More precisely, an en is a number of points (1 point = 1/72 inch)
393: equal to half the current type size.
394: .FE
395: If the ``expand'' option is used, then these numbers are multiplied
396: by a constant such that the table is as wide as the current line length.
397: The default column separation number is 3.
398: If the separation is changed the worst case (largest space requested) governs.
399: .IP "\fI##Vertical spanning#\fR"
400: \(em Normally, vertically spanned items extending over several
401: rows of the table are centered in their vertical range.
402: If a key-letter is followed by
403: .CW t
404: or
405: .CW T ,
406: any corresponding vertically spanned item
407: will begin at the top line of its range.
408: .IP "\fI##Font changes#\fR"
409: \(em A key-letter may be followed by a string containing a font
410: name or number
411: preceded by the letter
412: .CW f
413: or
414: .CW F .
415: This indicates that the corresponding column should be in a different
416: font from the default font (usually Roman).
417: All font names are one or two letters; a one-letter font
418: name should be separated from whatever follows by a space or tab.
419: The single letters
420: .CW B ,
421: .CW b ,
422: .CW I ,
423: and
424: .CW i
425: are shorter synonyms for
426: .CW fB
427: and
428: .CW fI
429: and refer to the bold and italic fonts in the current font family.
430: Font change commands given with the table entries
431: override these specifications.
432: .IP "\fI##Point size changes#\fR"
433: \(em A key-letter may be followed by the letter
434: .CW p
435: or
436: .CW P
437: and a number to indicate the point size of the corresponding table entries.
438: The number may be a signed digit, in which case it is taken as
439: an increment or decrement
440: from the current point size.
441: If both a point size and a column separation value are given,
442: one or more blanks must separate them.
443: .IP "\fI##Vertical spacing changes#\fR"
444: \(em A key-letter may be followed by the letter
445: .CW v
446: or
447: .CW V
448: and a number to indicate the vertical line spacing to be used
449: within a multi-line corresponding table entry.
450: The number may be a signed digit, in which case it is taken as an increment
451: or decrement from the current vertical spacing.
452: A column separation value must be separated by blanks or some other
453: specification from a vertical spacing request.
454: This request has no effect unless the corresponding table entry
455: is a text block (see below).
456: .IP "\fI##Column width indication#\fR"
457: \(em A key-letter may be followed by the letter
458: .CW w
459: or
460: .CW W
461: and a width value in parentheses.
462: This width is used as a minimum column width.
463: If the largest element in the column is not as wide as the width value
464: given after the \f(CWw\fR, the largest element is assumed to be that wide.
465: If the largest element in the column is wider than the specified value,
466: its width is used.
467: The width is also used as a default line
468: length for included text blocks.
469: Normal
470: .I troff
471: units can be used to scale the width value; if none are used,
472: the default is
473: ens.
474: If the width specification is a unitless integer
475: the parentheses may be omitted.
476: If the width value is changed in a column, the \fIlast\fR one given controls.
477: .IP "\fI##Equal width columns#\fR"
478: \(em A key-letter may be followed by the letter
479: .CW e
480: or
481: .CW E
482: to indicate equal width columns.
483: All columns whose
484: key-letters are followed by \f(CWe\fR or \f(CWE\fR are made the same width.
485: This permits the user to get a group of regularly spaced
486: columns.
487: .IP "\fI##Staggered columns#\fR"
488: \(em A key-letter may be followed by the letter
489: .CW u
490: or
491: .CW U
492: to indicate that the corresponding entry is to be moved up one half line.
493: This makes it easy, for example, to have a column of differences
494: between numbers in an adjoining column.
495: The
496: .CW allbox
497: option does not work with staggered columns.
498: .IP "\fI##Zero-width item#\fR"
499: \(em A key-letter may be followed by the letter
500: .CW z
501: or
502: .CW Z
503: to indicate that the corresponding
504: data item is to be ignored in calculating column widths.
505: This may be useful, for example, in allowing headings
506: to run across adjacent columns where spanned headings
507: would be inappropriate.
508: .IP "##\f(CWNote:\fR#"
509: The order of the above features is immaterial; they need not be separated
510: by spaces, except as indicated above to avoid ambiguities involving
511: point size and font changes. Thus
512: a numerical column entry in italic font and 12 point type with a minimum
513: width of 2.5 inches and separated by 6 ens from the next column could
514: be specified as
515: .P1
516: np12w(2.5i)fI 6
517: .P2
518: .IP "\fI##Alternative notation#\fR"
519: \(em Instead of listing the format of successive lines of a table
520: on consecutive lines of the format section,
521: successive line formats may be given on the same line, separated
522: by commas, so that the format for the example
523: above might have been written:
524: .P1
525: c s s, l n n .
526: .P2
527: .IP "\fI##Default#\fR"
528: \(em Column descriptors missing from the end
529: of a format line are assumed to be \f(CWL\fR.
530: The longest line in the format section, however,
531: defines the number of columns
532: in the table;
533: extra columns in the data are ignored silently.
534: .QQ put in the diagnostics.
535: .NH 2
536: Data
537: .PP
538: The data for the table are typed after the format.
539: Normally, each table line is typed as one line of data.
540: Very long input lines can be broken: any line whose last character is
541: .CW \e
542: is combined with the following line (and the
543: .CW \e
544: vanishes).
545: The data for different columns (the table entries) are separated by tabs,
546: or by whatever character has been specified with the option
547: .I tabs .
548: There are a few special cases:
549: .IP "\fI##Troff commands within tables\fR#"
550: \(em An input line
551: beginning with a
552: .CW .
553: followed by anything
554: but a number is assumed to be a command to
555: .I troff
556: and is passed through unchanged, retaining its position in the table.
557: So, for example, vertical space within a table may be produced by
558: .CW .sp
559: commands
560: in the data.
561: .IP "\fI##Full width horizontal lines\fR#"
562: \(em An input
563: .I line
564: containing only
565: .CW _
566: (underscore)
567: or
568: .CW =
569: (equal sign) is taken to be a single or double
570: line, respectively, extending the
571: full width
572: of the
573: .I table.
574: .IP "\fI##Single column horizontal lines\fR#"
575: \(em An input table
576: .I entry
577: containing only the character $fat "\(ul" $ or \f(CW=\fR
578: is taken to be a single or double line extending
579: the full width of the
580: .I column.
581: Such lines are extended to meet horizontal or vertical
582: lines adjoining this column.
583: To obtain these characters explicitly in a column, either
584: precede them by
585: .CW \e&
586: or
587: follow them by a space before the usual tab or newline.
588: .IP "\fI##Short horizontal lines\fR#"
589: \(em An input table
590: .I entry
591: containing only the string
592: .CW \e_
593: is taken to be a single line as wide as the contents of
594: the column. It is not extended to meet
595: adjoining lines.
596: .IP "\fI##Repeated characters\fR#"
597: \(em An input table
598: .I entry
599: containing only a string of the form
600: .CW \eR \fIx\fR
601: where
602: .I x
603: is any character is replaced by repetitions of the character
604: .I x
605: as wide as the data in the column.
606: The sequence of
607: .I x 's
608: is not extended to meet adjoining columns.
609: .IP "\fI##Vertically spanned items\fR#"
610: \(em An input table entry containing only the
611: character string
612: .CW \e^
613: indicates that the table entry immediately
614: above spans downward over this row. It is equivalent
615: to a table format key-letter of
616: .CW ^ .
617: .IP "\fI##Text blocks\fR#"
618: \(em In order to include a block of text as a table entry,
619: precede it by
620: .CW T{
621: and follow
622: it by
623: .CW T} .
624: Thus the sequence
625: .P1
626: \&\fR. . .\fP T{
627: .I
628: block of
629: text
630: .CW
631: T}\fR . . .
632: .P2
633: is the way to enter, as a single entry in the table, something
634: that cannot conveniently be typed as a simple string between
635: tabs.
636: Note that the
637: .CW T}
638: end delimiter must begin a line;
639: additional columns of data may follow after a tab on the same line.
640: See the example on page 10 for an illustration of included text blocks
641: .e1 aa 10
642: in a table.
643: If more than fifty or so text blocks are used in a table,
644: various limits in the
645: .I troff
646: program are likely to be exceeded,
647: producing diagnostics such as `too many string/macro names' or `too many
648: number registers.'
649: .IP
650: Text blocks are pulled out from the table, processed separately by
651: .I
652: troff,
653: .R
654: and replaced in the table as a solid block. If no line length
655: is specified in the
656: .I
657: block of text
658: .R
659: itself, or in the table format,
660: the default is to use
661: $ L times C / (N+1) $
662: where $L$ is the current line length,
663: $C$ is the number of table columns spanned by the text,
664: and $N$ is the total number of columns in the table.
665: The other parameters (point size, font, etc.) used in setting the
666: .I
667: block of text
668: .R
669: are those in effect at the beginning of the table (including
670: the effect of the
671: .CW .TS
672: macro)
673: and any table format specifications of size, spacing and font,
674: using the \f(CWp\fR, \f(CWv\fR and \f(CWf\fR modifiers to the column key-letters.
675: Commands within the text block itself are also recognized, of course.
676: However,
677: .I troff
678: commands within the table data but not within the text block
679: do not affect that block.
680: .br
681: .di RR
682: . this is going down a rathole
683: .EQ
684: delim off
685: .EN
686: .di
687: .rm RR
688: .IP "##\fBWarnings:\fR#"
689: Although any number of lines may be present in a table,
690: only the first 200 lines are used in calculating
691: the widths of the various columns.
692: A multi-page table,
693: of course, may be arranged as several single-page tables
694: if this proves to be a problem.
695: Other difficulties with formatting may arise because,
696: in the calculation of column widths all table entries
697: are assumed to be in the font and size being used when
698: the
699: .CW .TS
700: command was encountered, except for font and size changes
701: indicated (a) in the table format section and (b)
702: within the table data (as in the entry
703: .CW \es+3\efIdata\efP\es0 ).
704: Therefore, although arbitrary
705: .I troff
706: requests may be sprinkled in a table, care must be taken
707: to avoid confusing the width calculations;
708: use requests such as
709: .CW .ps
710: with care.
711: .tr ##
712: .sp .5v
713: .NH 2
714: Additional Command Lines
715: .PP
716: If the format of a table must be changed after
717: many similar lines, as with sub-headings or summarizations, the
718: .CW .T&
719: (table continue)
720: command can be used
721: to change column parameters.
722: The outline of such a table input is:
723: .DS
724: .ft CW
725: \&.TS
726: .ft I
727: \&options \f(CW;\fP
728: \&format \*.
729: \&data
730: \&\*. \*. \*.
731: .ft CW
732: \&.T&
733: .ft I
734: \&format \*.
735: \&data
736: .ft CW
737: \&.T&
738: .ft I
739: \&format \*.
740: \&data
741: .ft CW
742: \&.TE
743: .DE
744: .R
745: as in the examples on pages 9 and 12.
746: .e1 ab 9
747: .e1 ac 12
748: Using this procedure, each table line can be close to its corresponding format line.
749: .sp 3p
750: .ft BI
751: Warning:
752: .ft R
753: it is not possible to change the number of columns, the space
754: between columns, the global options such as \fIbox,\fR
755: or the selection of columns to be made equal width.
756: Nor is
757: .CW .T&
758: recognized after the first 200 lines of a table.
759: .NH
760: Usage.
761: .PP
762: On
763: .UX ,
764: .I tbl
765: can be run on a simple table with the command
766: .P1
767: tbl input-file | troff
768: .P2
769: but
770: for more complicated use, where there are several input files,
771: and they contain equations and \fIms\fR memorandum layout commands as well
772: as tables, the normal command would be
773: .P1
774: tbl \fIfiles ...\fP | eqn | troff -ms
775: .P2
776: and, of course, the usual options may be used on the
777: .I troff
778: and
779: .I eqn
780: commands. If any of the file names are
781: .CW -
782: the standard input is read at that point.
783: .PP
784: For the convenience of users employing line printers without
785: adequate driving tables or post-filters, there is a special
786: .CW -TX
787: command line option to
788: .I tbl
789: which produces output that does not have fractional line
790: motions in it.
791: .PP
792: Note that when
793: .I eqn
794: and
795: .I tbl
796: are used together on the same file,
797: .I tbl
798: should be used first.
799: If there are no equations within tables,
800: either order works, but it is usually faster
801: to run
802: .I tbl
803: first, since
804: .I eqn
805: normally produces a larger expansion of the input
806: than
807: .I tbl .
808: However, if there are equations within tables
809: (using the
810: .I delim
811: mechanism in
812: .I eqn ),
813: .I tbl
814: must be first or the output will be scrambled.
815: Users must also beware of using equations in
816: \f(CWn\fR-style columns; this is nearly always wrong,
817: since
818: .I tbl
819: attempts to split numerical format items into two parts and this
820: is not possible with equations.
821: The user can defend against this by giving the
822: .I delim(xx)
823: table option;
824: this prevents splitting of numerical columns within the delimiters.
825: For example, if the
826: .I eqn
827: delimiters
828: are
829: .I $$ ,
830: giving
831: .I delim($$)
832: a numerical column such as
833: .CW "1245$+- 16$"
834: will be divided after 1245, not after 16.
835: .PP
836: .I Tbl
837: accepts up to about 35 columns, the exact number
838: depending on the availability
839: of number registers.
840: The user must avoid number register names used
841: by tbl, which include two-digit numbers from 31 to 97,
842: and strings of the form
843: .CW 4\fIx\fR,
844: .CW 5\fIx\fR,
845: .CW #\fIx\fR,
846: \fIx\f(CW+\fR, \fIx\f(CW|\fR, \f(CW^\fIx\fR, and \fIx\f(CW-\fR,
847: where
848: \fIx\fR is any lower case letter.
849: The names
850: .CW ## ,
851: .CW #- ,
852: and
853: .CW #^
854: are also used in certain circumstances.
855: To conserve number register names, the
856: .CW n
857: and
858: .CW a
859: formats share a register;
860: hence the restriction above that they may not be used in the same column.
861: .PP
862: For aid in writing layout macros,
863: .I tbl
864: defines a number register
865: .CW TW
866: which is
867: the table width; it is defined by the time that the
868: .CW .TE
869: macro
870: is invoked and may be used in the expansion of that macro.
871: More importantly, to assist in laying out multi-page boxed tables
872: the macro T# is defined to produce the bottom lines and side lines of a boxed
873: table, and then invoked at its end. By use of this macro
874: in the page footer a multi-page table can be boxed.
875: In particular, the
876: .I ms
877: macros can be used to print a multi-page boxed table with a repeated heading
878: by giving the
879: argument
880: .CW H
881: to the
882: .CW .TS
883: macro.
884: If the table start macro is written
885: .P1
886: \&\*.TS H
887: .P2
888: a line of the form
889: .P1
890: \&\*.TH
891: .P2
892: must be given in the table after any table heading (or at the start if none).
893: Material up to the
894: .CW .TH
895: is placed at the top of each page of table;
896: the remaining lines in the table are placed on several pages as required.
897: Note that this is
898: .I not
899: a feature of
900: .I tbl ,
901: but of the \fIms\fR layout macros.
902: .FC
903: .1C
904: .NH
905: Examples.
906: .PP
907: Here are some examples illustrating features of
908: .I
909: tbl.
910: .R
911: .ds T \|\h'.4n'\v'-.2n'\s6\zT\s0\s10\v'.2n'\h'-.4n'\(ci\|\s0
912: The symbol \*T in the input represents a tab character.
913: .de IN
914: .po \\n(POu
915: .sp |\\n(.hu
916: .sp
917: .NE \\$1
918: .mk
919: .B
920: Input:
921: .R
922: .sp .5
923: .nf
924: .in +3n
925: ..
926: .de OU
927: .br
928: .in -3n
929: .rt
930: .po +3i
931: .B
932: Output:
933: .R
934: .sp .5
935: ..
936: .rm TS
937: .rm TE
938: .nf
939: .KS
940: .IN 2.5i
941: \&\*.TS
942: \&box;
943: \&c c c
944: \&l l r\*.
945: \&Fact\*TLocation\*TStatistic
946: \&
947: \&Largest state\*TAlaska\*T591,004 sq. mi.
948: \&Smallest state\*TRhode Island\*T1,212 sq. mi.
949: \&Longest river\*TMississippi-Missouri\*T3,710 mi.
950: \&Highest mountain\*TMount McKinley, AK\*T20,320 ft.
951: \&Lowest point\*TDeath Valley, CA\*T\-282 ft.
952: \&\*.TE
953: .OU
954: .TS
955: box;
956: c c c
957: l l r.
958: Fact Location Statistic
959:
960: Largest state Alaska 591,004 sq. mi.
961: Smallest state Rhode Island 1,212 sq. mi.
962: Longest river Mississippi-Missouri 3,710 mi.
963: Highest mountain Mount McKinley, AK 20,320 ft.
964: Lowest point Death Valley, CA \-282 ft.
965: .TE
966: .IN 2.8i
967: \&\*.TS
968: \&allbox;
969: \&c s s
970: \&c c c
971: \&n n n\*.
972: \&AT&T Common Stock
973: \&Year\*TPrice\*TDividend
974: \&1984\*T15-20\*T$1\*.20
975: \&5\*T19-25\*T1\*.20
976: \&6\*T21-28\*T1\*.20
977: \&7\*T20-36\*T1\*.20
978: \&8\*T24-30\*T1\*.20
979: \&9\*T29-37\*T\*.30*
980: \&\*.TE
981: \&* (first quarter only)
982: .OU
983: .TS
984: allbox;
985: c s s
986: c c c
987: n n n.
988: AT&T Common Stock
989: Year Price Dividend
990: 1984 15-20 $1.20
991: 5 19-25 1.20
992: 6 21-28 1.20
993: 7 20-36 1.20
994: 8 24-30 1.20
995: 9 29-37 .30*
996: .TE
997: * (first quarter only)
998: .KE
999: .BP
1000: .KS
1001: .IN 4i
1002: \&\*.TS
1003: \&box;
1004: \&c s s
1005: \&c | c | c
1006: \&l | l | n\*.
1007: \&Major New York Bridges
1008: \&=
1009: \&Bridge\*TDesigner\*TLength
1010: \&\(ul
1011: \&Brooklyn\*TJ\*. A\*. Roebling\*T1595
1012: \&Manhattan\*TG\*. Lindenthal\*T1470
1013: \&Williamsburg\*TL\*. L\*. Buck\*T1600
1014: \&\(ul
1015: \&Queensborough\*TPalmer &\*T1182
1016: \&\*T Hornbostel
1017: \&\(ul
1018: \&\*T\*T1380
1019: \&Triborough\*TO\*. H\*. Ammann\*T\(ul
1020: \&\*T\*T383
1021: \&\(ul
1022: \&Bronx Whitestone\*TO\*. H\*. Ammann\*T2300
1023: \&Throgs Neck\*TO\*. H\*. Ammann\*T1800
1024: \&\(ul
1025: \&George Washington\*TO\*. H\*. Ammann\*T3500
1026: \&\*.TE
1027: .OU
1028: .TS
1029: box;
1030: c s s
1031: c | c | c
1032: l | l | n.
1033: Major New York Bridges
1034: =
1035: Bridge Designer Length
1036: _
1037: Brooklyn J. A. Roebling 1595
1038: Manhattan G. Lindenthal 1470
1039: Williamsburg L. L. Buck 1600
1040: _
1041: Queensborough Palmer & 1182
1042: Hornbostel
1043: _
1044: 1380
1045: Triborough O. H. Ammann _
1046: 383
1047: _
1048: Bronx Whitestone O. H. Ammann 2300
1049: Throgs Neck O. H. Ammann 1800
1050: _
1051: George Washington O. H. Ammann 3500
1052: .TE
1053: .IN 3.0i
1054: \&\*.TS
1055: \&c c
1056: \&np-2 | n | \*.
1057: \&\*TStack
1058: \&\*T\(ul
1059: \&1\*T46
1060: \&\*T\(ul
1061: \&2\*T23
1062: \&\*T\(ul
1063: \&3\*T15
1064: \&\*T\(ul
1065: \&4\*T6\*.5
1066: \&\*T\(ul
1067: \&5\*T2\*.1
1068: \&\*T\(ul
1069: \&\*.TE
1070: .OU
1071: .TS
1072: c c
1073: np-2 | n |.
1074: Stack
1075: _
1076: 1 46
1077: _
1078: 2 23
1079: _
1080: 3 15
1081: _
1082: 4 6.5
1083: _
1084: 5 2.1
1085: _
1086: .TE
1087: .KE
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.