Tbl - A Program to Format Tables USD:28-1
Tbl - A Program to Format Tables
M. E. Lesk
AT&T Bell Laboratories
Murray Hill, New Jersey 07974
ABSTRACT
Tbl is a document formatting preprocessor for
troff or nroff which makes even fairly complex tables
easy to specify and enter. It is available on the UNIX-
system and on Honeywell 6000 GCOS. Tables are made up
of columns which may be independently centered, right-
adjusted, left-adjusted, or aligned by decimal points.
Headings may be placed over single columns or groups of
columns. A table entry may contain equations, or may
consist of several rows of text. Horizontal or vertical
lines may be drawn as desired in the table, and any
table or element may be enclosed in a box. For example:
_________________________________________
| 1970 Federal Budget Transfers |
| (in billions of dollars) |
|_____________|____________|________|________|
| | Taxes | Money| |
| State | collected| spent| Net |
|____________|___________|_______|_______|
| New York | 22.91 | 21.35| -1.56|
| New Jersey | 8.33 | 6.96| -1.37|
| Connecticut| 4.12 | 3.10| -1.02|
| Maine | 0.74 | 0.67| -0.07|
| California | 22.29 | 22.42| +0.13|
| New Mexico | 0.70 | 1.49| +0.79|
| Georgia | 3.30 | 4.28| +0.98|
| Mississippi| 1.15 | 2.32| +1.17|
| Texas | 9.33 | 11.13| +1.80|
|____________|___________|_______|_______|
Introduction.
Tbl turns a simple description of a table into a troff or
_________________________
- UNIX is a registered trademark of AT&T Bell Labora-
tories in the USA and other countries.
April 27, 2013
USD:28-2 Tbl - A Program to Format Tables
nroff [1] program (list of commands) that prints the table. Tbl
may be used on the UNIX [2] system and on the Honeywell 6000 GCOS
system. It attempts to isolate a portion of a job that it can
successfully handle and leave the remainder for other programs.
Thus tbl may be used with the equation formatting program eqn [3]
or various layout macro packages [4,5,6], but does not duplicate
their functions.
This memorandum is divided into two parts. First we give the
rules for preparing tbl input; then some examples are shown. The
description of rules is precise but technical, and the beginning
user may prefer to read the examples first, as they show some
common table arrangements. A section explaining how to invoke tbl
precedes the examples. To avoid repetition, henceforth read troff
as ``troff or nroff.''
The input to tbl is text for a document, with tables pre-
ceded by a ``.TS'' (table start) command and followed by a
``.TE'' (table end) command. Tbl processes the tables, generating
troff formatting commands, and leaves the remainder of the text
unchanged. The ``.TS'' and ``.TE'' lines are copied, too, so that
troff page layout macros (such as the memo formatting macros [4])
can use these lines to delimit and place tables as they see fit.
In particular, any arguments on the ``.TS'' or ``.TE'' lines are
copied but otherwise ignored, and may be used by document layout
macro commands.
The format of the input is as follows:
text
.TS
table
.TE
text
.TS
table
.TE
text
. . .
where the format of each table is as follows:
.TS
options ;
format .
data
.TE
Each table is independent, and must contain formatting informa-
tion followed by the data to be entered in the table. The format-
ting information, which describes the individual columns and rows
of the table, may be preceded by a few options that affect the
entire table. A detailed description of tables is given in the
next section.
April 27, 2013
Tbl - A Program to Format Tables USD:28-3
Input commands.
As indicated above, a table contains, first, global options,
then a format section describing the layout of the table entries,
and then the data to be printed. The format and data are always
required, but not the options. The various parts of the table are
entered as follows:
1) OPTIONS. There may be a single line of options affecting the
whole table. If present, this line must follow the .TS line
immediately and must contain a list of option names
separated by spaces, tabs, or commas, and must be terminated
by a semicolon. The allowable options are:
center - center the table (default is left-adjust);
expand - make the table as wide as the current line
length;
box - enclose the table in a box;
allbox - enclose each item in the table in a box;
doublebox - enclose the table in two boxes;
tab (x) - use x instead of tab to separate data items.
linesize (n)- set lines or rules (e.g. from box) in n
point type;
delim (xy) - recognize x and y as the eqn delimiters.
The tbl program tries to keep boxed tables on one page by
issuing appropriate ``need'' (.ne) commands. These requests
are calculated from the number of lines in the tables, and
if there are spacing commands embedded in the input, these
requests may be inaccurate; use normal troff procedures,
such as keep-release macros, in that case. The user who must
have a multi-page boxed table should use macros designed for
this purpose, as explained below under `Usage.'
2) FORMAT. The format section of the table specifies the layout
of the columns. Each line in this section corresponds to one
line of the table (except that the last line corresponds to
all following lines up to the next .T&, if any - see below),
and each line contains a key-letter for each column of the
table. It is good practice to separate the key letters for
each column by spaces or tabs. Each key-letter is one of the
following:
L or l to indicate a left-adjusted column entry;
R or r to indicate a right-adjusted column entry;
April 27, 2013
USD:28-4 Tbl - A Program to Format Tables
C or c to indicate a centered column entry;
N or n to indicate a numerical column entry, to be
aligned with other numerical entries so that the
units digits of numbers line up;
A or a to indicate an alphabetic subcolumn; all
corresponding entries are aligned on the left, and
positioned so that the widest is centered within
the column (see example on page 12);
S ori s to indicate a spanned heading, i.e. to indicate
that the entry from the previous column continues
across this column (not allowed for the first
column, obviously); or
^ to indicate a vertically spanned heading, i.e. to
indicate that the entry from the previous row con-
tinues down through this row. (Not allowed for the
first row of the table, obviously).
When numerical alignment is specified, a location for the
decimal point is sought. The rightmost dot (.) adjacent to
a digit is used as a decimal point; if there is no dot
adjoining a digit, the rightmost digit is used as a units
digit; if no alignment is indicated, the item is centered in
the column. However, the special non-printing character
string \& may be used to override unconditionally dots and
digits, or to align alphabetic data; this string lines up
where a dot normally would, and then disappears from the
final output. In the example below, the items shown at the
left will be aligned (in a numerical column) as shown on the
right:
13 13
4.2 4.2
26.4.12 26.4.12
abc abc
abc\& abc
43\&3.22 433.22
749.12 749.12
Note: If numerical data are used in the same column with
wider L or r type table entries, the widest number is cen-
tered relative to the wider L or r items (L is used instead
of l for readability; they have the same meaning as key-
letters). Alignment within the numerical items is preserved.
This is similar to the behavior of a type data, as explained
above. However, alphabetic subcolumns (requested by the a
key-letter) are always slightly indented relative to L
items; if necessary, the column width is increased to force
this. This is not true for n type entries.
April 27, 2013
Tbl - A Program to Format Tables USD:28-5
Warning: the n and a items should not be used in the same
column.
For readability, the key-letters describing each column
should be separated by spaces. The end of the format section
is indicated by a period. The layout of the key-letters in
the format section resembles the layout of the actual data
in the table. Thus a simple format might appear as:
c s s
l n n .
which specifies a table of three columns. The first line of
the table contains a heading centered across all three
columns; each remaining line contains a left-adjusted item
in the first column followed by two columns of numerical
data. A sample table in this format might be:
Overall title
Item-a 34.22 9.1
Item-b 12.65 .02
Items: c,d,e 23 5.8
Total 69.87 14.92
There are some additional features of the key-letter system:
Horizontal lines
- A key-letter may be replaced by `_' (underscore) to
indicate a horizontal line in place of the correspond-
ing column entry, or by `=' to indicate a double hor-
izontal line. If an adjacent column contains a horizon-
tal line, or if there are vertical lines adjoining this
column, this horizontal line is extended to meet the
nearby lines. If any data entry is provided for this
column, it is ignored and a warning message is printed.
Vertical lines
- A vertical bar may be placed between column key-
letters. This will cause a vertical line between the
corresponding columns of the table. 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. If
two vertical bars appear between key-letters, a double
vertical line is drawn.
Space between columns
- A number may follow the key-letter. This indicates
the amount of separation between this column and the
next column. The number normally specifies the separa-
tion in ens (one en is about the width of the letter
`n').* If the ``expand'' option is used, then these
numbers are multiplied by a constant such that the
_________________________
* More precisely, an en is a number of points (1 point
= 1/72 inch) equal to half the current type size.
April 27, 2013
USD:28-6 Tbl - A Program to Format Tables
table is as wide as the current line length. The
default column separation number is 3. If the separa-
tion is changed the worst case (largest space
requested) governs.
Vertical spanning
- Normally, vertically spanned items extending over
several rows of the table are centered in their verti-
cal range. If a key-letter is followed by t or T, any
corresponding vertically spanned item will begin at the
top line of its range.
Font changes
- A key-letter may be followed by a string containing a
font name or number preceded by the letter f or F. This
indicates that the corresponding column should be in a
different font from the default font (usually Roman).
All font names are one or two letters; a one-letter
font name should be separated from whatever follows by
a space or tab. The single letters B, b, I, and i are
shorter synonyms for fB and fI. Font change commands
given with the table entries override these specifica-
tions.
Point size changes
- A key-letter may be followed by the letter p or P and
a number to indicate the point size of the correspond-
ing table entries. The number may be a signed digit, in
which case it is taken as an increment or decrement
from the current point size. If both a point size and a
column separation value are given, one or more blanks
must separate them.
Vertical spacing changes
- A key-letter may be followed by the letter v or V and
a number to indicate the vertical line spacing to be
used within a multi-line corresponding table entry. The
number may be a signed digit, in which case it is taken
as an increment or decrement from the current vertical
spacing. A column separation value must be separated by
blanks or some other specification from a vertical
spacing request. This request has no effect unless the
corresponding table entry is a text block (see below).
Column width indication
- A key-letter may be followed by the letter w or W and
a width value in parentheses. This width is used as a
minimum column width. If the largest element in the
column is not as wide as the width value given after
the w, the largest element is assumed to be that wide.
If the largest element in the column is wider than the
specified value, its width is used. The width is also
used as a default line length for included text blocks.
Normal troff units can be used to scale the width
April 27, 2013
Tbl - A Program to Format Tables USD:28-7
value; if none are used, the default is ens. If the
width specification is a unitless integer the
parentheses may be omitted. If the width value is
changed in a column, the last one given controls.
Equal width columns
- A key-letter may be followed by the letter e or E to
indicate equal width columns. All columns whose key-
letters are followed by e or E are made the same width.
This permits the user to get a group of regularly
spaced columns.
Note:
The order of the above features is immaterial; they
need not be separated by spaces, except as indicated
above to avoid ambiguities involving point size and
font changes. Thus a numerical column entry in italic
font and 12 point type with a minimum width of 2.5
inches and separated by 6 ens from the next column
could be specified as
np12w(2.5i)fI 6
Alternative notation
- Instead of listing the format of successive lines of
a table on consecutive lines of the format section,
successive line formats may be given on the same line,
separated by commas, so that the format for the example
above might have been written:
c s s, l n n .
Default
- Column descriptors missing from the end of a format
line are assumed to be L. The longest line in the for-
mat section, however, defines the number of columns in
the table; extra columns in the data are ignored
silently.
3) DATA. The data for the table are typed after the format.
Normally, each table line is typed as one line of data. Very
long input lines can be broken: any line whose last charac-
ter is \ is combined with the following line (and the \ van-
ishes). The data for different columns (the table entries)
are separated by tabs, or by whatever character has been
specified in the option tabs option. There are a few special
cases:
Troff commands within tables
- An input line beginning with a `.' followed by any-
thing but a number is assumed to be a command to troff
and is passed through unchanged, retaining its position
in the table. So, for example, space within a table may
be produced by ``.sp'' commands in the data.
Full width horizontal lines
April 27, 2013
USD:28-8 Tbl - A Program to Format Tables
- An input line containing only the character $fat "_"
$ (underscore) or = (equal sign) is taken to be a sin-
gle or double line, respectively, extending the full
width of the table.
Single column horizontal lines
- An input table entry containing only the character
$fat "_" $ or = is taken to be a single or double line
extending the full width of the column. Such lines are
extended to meet horizontal or vertical lines adjoining
this column. To obtain these characters explicitly in a
column, either precede them by \& or follow them by a
space before the usual tab or newline.
Short horizontal lines
- An input table entry containing only the string $fat
"\_"$ is taken to be a single line as wide as the con-
tents of the column. It is not extended to meet
adjoining lines.
Vertically spanned items
- An input table entry containing only the character
string \^ indicates that the table entry immediately
above spans downward over this row. It is equivalent
to a table format key-letter of `^'.
Text blocks
- In order to include a block of text as a table entry,
precede it by $fat roman "T{" $ and follow it by $fat
roman "T}" $. Thus the sequence
. . . $fat roman "T{"$
block of
text
$fat roman "T}"$ . . .
is the way to enter, as a single entry in the table,
something that cannot conveniently be typed as a simple
string between tabs. Note that the $fat roman "T}" $
end delimiter must begin a line; additional columns of
data may follow after a tab on the same line. See the
example on page 14 for an illustration of included text
blocks in a table. If more than twenty or thirty text
blocks are used in a table, various limits in the troff
program are likely to be exceeded, producing diagnos-
tics such as `too many string/macro names' or `too many
number registers.'
Text blocks are pulled out from the table, processed
separately by troff, and replaced in the table as a
solid block. If no line length is specified in the
block of text itself, or in the table format, the
default is to use $ L times C / (N+1) $ where L is the
current line length, C is the number of table columns
spanned by the text, and N is the total number of
columns in the table. The other parameters (point size,
April 27, 2013
Tbl - A Program to Format Tables USD:28-9
font, etc.) used in setting the block of text are those
in effect at the beginning of the table (including the
effect of the ``.TS'' macro) and any table format
specifications of size, spacing and font, using the p,
v and f modifiers to the column key-letters. Commands
within the text block itself are also recognized, of
course. However, troff commands within the table data
but not within the text block do not affect that block.
Warnings:
- Although any number of lines may be present in a
table, only the first 200 lines are used in calculating
the widths of the various columns. A multi-page table,
of course, may be arranged as several single-page
tables if this proves to be a problem. Other difficul-
ties with formatting may arise because, in the calcula-
tion of column widths all table entries are assumed to
be in the font and size being used when the ``.TS''
command was encountered, except for font and size
changes indicated (a) in the table format section and
(b) within the table data (as in the entry
\s+3\fIdata\fP\s0). Therefore, although arbitrary troff
requests may be sprinkled in a table, care must be
taken to avoid confusing the width calculations; use
requests such as `.ps' with care.
4) ADDITIONAL COMMAND LINES. If the format of a table must be
changed after many similar lines, as with sub-headings or
summarizations, the ``.T&'' (table continue) command can be
used to change column parameters. The outline of such a
table input is:
.TS
options ;
format .
data
. . .
.T&
format .
data
.T&
format .
data
.TE
as in the examples on pages 14 and 16. Using this procedure,
each table line can be close to its corresponding format
line.
Warning: it is not possible to change the number of columns,
the space between columns, the global options such as box,
or the selection of columns to be made equal width.
April 27, 2013
USD:28-10 Tbl - A Program to Format Tables
Usage.
On UNIX, tbl can be run on a simple table with the command
tbl input-file | troff
but for more complicated use, where there are several input
files, and they contain equations and ms memorandum layout com-
mands as well as tables, the normal command would be
tbl file-1 file-2 . . . | eqn | troff -ms
and, of course, the usual options may be used on the troff and
eqn commands. The usage for nroff is similar to that for troff,
but only TELETYPE(R) Model 37 and Diablo-mechanism (DASI or GSI)
terminals can print boxed tables directly.
For the convenience of users employing line printers without
adequate driving tables or post-filters, there is a special -TX
command line option to tbl which produces output that does not
have fractional line motions in it. The only other command line
options recognized by tbl are -ms and -mm which are turned into
commands to fetch the corresponding macro files; usually it is
more convenient to place these arguments on the troff part of the
command line, but they are accepted by tbl as well.
Note that when eqn and tbl are used together on the same
file tbl should be used first. If there are no equations within
tables, either order works, but it is usually faster to run tbl
first, since eqn normally produces a larger expansion of the
input than tbl. However, if there are equations within tables
(using the delim mechanism in eqn), tbl must be first or the out-
put will be scrambled. Users must also beware of using equations
in n-style columns; this is nearly always wrong, since tbl
attempts to split numerical format items into two parts and this
is not possible with equations. The user can defend against this
by giving the delim(xx) table option; this prevents splitting of
numerical columns within the delimiters. For example, if the eqn
delimiters are $$, giving delim($$) a numerical column such as
``1245 $+- 16$'' will be divided after 1245, not after 16.
Tbl limits tables to twenty columns; however, use of more
than 16 numerical columns may fail because of limits in troff,
producing the `too many number registers' message. Troff number
registers used by tbl must be avoided by the user within tables;
these include two-digit names from 31 to 99, and names of the
forms #x, x+, x |, ^x, and x-, where x is any lower case letter.
The names ##, #-, and #^ are also used in certain circumstances.
To conserve number register names, the n and a formats share a
register; hence the restriction above that they may not be used
in the same column.
For aid in writing layout macros, tbl defines a number
register TW which is the table width; it is defined by the time
April 27, 2013
Tbl - A Program to Format Tables USD:28-11
that the ``.TE'' macro is invoked and may be used in the expan-
sion of that macro. More importantly, to assist in laying out
multi-page boxed tables the macro T# is defined to produce the
bottom lines and side lines of a boxed table, and then invoked at
its end. By use of this macro in the page footer a multi-page
table can be boxed. In particular, the ms macros can be used to
print a multi-page boxed table with a repeated heading by giving
the argument H to the ``.TS'' macro. If the table start macro is
written
.TS H
a line of the form
.TH
must be given in the table after any table heading (or at the
start if none). Material up to the ``.TH'' is placed at the top
of each page of table; the remaining lines in the table are
placed on several pages as required. Note that this is not a
feature of tbl, but of the ms layout macros.
Examples.
Here are some examples illustrating features of tbl. The
symbol O in the input represents a tab character.
Input: Output:
.TS ______________________________________________
box; | Language Authors Runs on |
c c c | |
l l l. | Fortran Many Almost anything|
LanguageOAuthorsORuns on | PL/1 IBM 360/370 |
| C BTL 11/45,H6000,370|
FortranOManyOAlmost anythi|gBLISS Carnegie-Mellon PDP-10,11 |
PL/1OIBMO360/370 | IDS Honeywell H6000 |
COBTLO11/45,H6000,370 | Pascal Stanford 370 |
BLISSOCarnegie-MellonOPDP-|_,__1__________________________________________|
IDSOHoneywellOH6000
PascalOStanfordO370
.TE
April 27, 2013
USD:28-12 Tbl - A Program to Format Tables
Input: Output:
.TS _________________________
allbox; | AT&T Common Stock |
c s s |_____|_______|__________|
c c c | Year| Price| Dividend|
n n n. |_____|_______|__________|
AT&T Common Stock | 1971| 41-54| $2.60 |
YearOPriceODividend |_____|_______|__________|
1971O41-54O$2.60 | 2| 41-54| 2.70 |
2O41-54O2.70 |_____|_______|__________|
3O46-55O2.87 | 3| 46-55| 2.87 |
4O40-53O3.24 |_____|_______|__________|
5O45-52O3.40 | 4| 40-53| 3.24 |
6O51-59O.95* |_____|_______|__________|
.TE | 5| 45-52| 3.40 |
* (first quarter only) |_____|_______|__________|
| 6| 51-59| .95* |
|_____|_______|__________|
* (first quarter only)
Input: Output:
.TS _____________________________________________
box; | Major New York Bridges |
c s s |___________________|_________________|_________|
c | c | c | Bridge | Designer | Length|
l | l | n. |__________________|________________|________|
Major New York Bridges | Brooklyn | J. A. Roebling| 1595 |
= | Manhattan | G. Lindenthal | 1470 |
BridgeODesignerOLength | Williamsburg | L. L. Buck | 1600 |
_ |__________________|________________|________|
BrooklynOJ. A. RoeblingO15|5Queensborough | Palmer & | 1182 |
ManhattanOG. LindenthalO14|0 | Hornbostel | |
WilliamsburgOL. L. BuckO16|__________________|________________|________|
_ | | | 1380 |
QueensboroughOPalmer &O118| Triborough | O. H. Ammann | _______|
O Hornbostel | | | 383 |
_ |__________________|________________|________|
OO1380 | Bronx Whitestone | O. H. Ammann | 2300 |
TriboroughOO. H. AmmannO_ | Throgs Neck | O. H. Ammann | 1800 |
OO383 |__________________|________________|________|
_ | George Washington| O. H. Ammann | 3500 |
Bronx WhitestoneOO. H. Amm|_n_O__3__0____________|________________|________|
Throgs NeckOO. H. AmmannO1800
_
George WashingtonOO. H. AmmannO3500
.TE
April 27, 2013
Tbl - A Program to Format Tables USD:28-13
Input: Output:
.TS Stack
c c | ______|
np-2 | n | . 1| 46 |
OStack | ______|
O_ 2| 23 |
1O46 | ______|
O_ 3| 15 |
2O23 | ______|
O_ 4| 6.5 |
3O15 | ______|
O_ 5| 2.1 |
4O6.5 | ______|
O_
5O2.1
O_
.TE
Input: Output:
.TS ________________________________
box; | january february march |
L L L | april may _________|
L L _ | june july | Months |
L L | LB | august september| _________|
L L _ | october november december|
L L L. |_______________________________|
januaryOfebruaryOmarch
aprilOmay
juneOjulyOMonths
augustOseptember
octoberOnovemberOdecember
.TE
April 27, 2013
USD:28-14 Tbl - A Program to Format Tables
Input: Output:
.TS ______________________________________
box; | Composition of Foods |
cfB s s s. |___________|_________________________|
Composition of Foods | | Percent by Weight |
_ | | ________________________|
.T& | Food | | | Carbo- |
c | c s s | | Protein| Fat| hydrate|
c | c s s |___________|_________|_____|_________|
c | c | c | c. | Apples | .4 | .5| 13.0 |
FoodOPercent by Weight | Halibut | 18.4 | 5.2| ... |
\^O_ | Lima beans| 7.5 | .8| 22.0 |
\^OProteinOFatOCarbo- | Milk | 3.3 | 4.0| 5.0 |
\^O\^O\^Ohydrate | Mushrooms | 3.5 | .4| 6.0 |
_ | Rye bread | 9.0 | .6| 52.7 |
.T& |___________|_________|_____|_________|
l | n | n | n.
ApplesO.4O.5O13.0
HalibutO18.4O5.2O. . .
Lima beansO7.5O.8O22.0
MilkO3.3O4.0O5.0
MushroomsO3.5O.4O6.0
Rye breadO9.0O.6O52.7
.TE
Input: Output:
.TS _____________________________________________
allbox; | New York Area Rocks |
cfI s s |____________|_________________|_____________|
c cw(1i) cw(1i) | Era | Formation | Age (years)|
lp9 lp9 lp9. |____________|_________________|_____________|
New York Area Rocks | Precambrian| Reading Prong | >1 billion |
EraOFormationOAge (years) |____________|_________________|_____________|
PrecambrianOReading ProngO|1Paleozoic | Manhattan Prong| 400 million|
PaleozoicOManhattan ProngO|_0___i__l__o____|_________________|_____________|
MesozoicOT{ | Mesozoic | Newark Basin, | 200 million|
.na | | incl. Stockton,| |
Newark Basin, incl. | | Lockatong, and | |
Stockton, Lockatong, and B|unswick | Brunswick for- | |
formations; also Watchungs| | mations; also | |
and Palisades. | | Watchungs and | |
T}O200 million | | Palisades. | |
CenozoicOCoastal PlainOT{ |____________|_________________|_____________|
On Long Island 30,000 year|;Cenozoic | Coastal Plain | On Long|
Cretaceous sediments redep|sited | | Island |
by recent glaciation. | | | 30,000 |
.ad | | | years; Cre-|
T} | | | taceous |
.TE | | | sediments |
| | | redeposited|
| | | by recent|
| | | glaciation.|
|____________|_________________|_____________|
April 27, 2013
Tbl - A Program to Format Tables USD:28-15
Input: Output:
.EQ ___________________________________________________________________________________
delim $$ | Name Definition |
.EN | |
| Gamma $GAMMA (z) = int sub 0 sup inf t sup {z-1} e sup -t dt$ |
. . . | Sine $sin (x) = 1 over 2i ( e sup ix - e sup -ix )$ |
| Error $ roman erf (z) = 2 over sqrt pi int sub 0 sup z e sup {-t sup 2} dt$ |
.TS | Bessel $ J sub 0 (z) = 1 over pi int sub 0 sup pi cos ( z sin theta ) d theta $|
doublebox; | Zeta $ zeta (s) = sum from k=1 to inf k sup -s ~~( Re~s > 1)$ |
c c |____________________________________________________________________________________|
l l.
NameODefinition
.sp
.vs +2p
GammaO$GAMMA (z) = int sub 0 sup inf t sup {z-1} e sup -t dt$
SineO$sin (x) = 1 over 2i ( e sup ix - e sup -ix )$
ErrorO$ roman erf (z) = 2 over sqrt pi int sub 0 sup z e sup {-t sup 2} dt$
BesselO$ J sub 0 (z) = 1 over pi int sub 0 sup pi cos ( z sin theta ) d theta $
ZetaO$ zeta (s) = sum from k=1 to inf k sup -s ~~( Re~s > 1)$
.vs -2p
.TE
Input: Output:
.TS ___________________________________________
box, tab(:); | Readability of Text |
cb s s s s | Line Width and Leading for 10-Point Type |
cp-2 s s s s |__________|_______|_________|_________|_________|
c || c | c | c | c | Line | Set | 1-Point| 2-Point| 4-Point|
c || c | c | c | c | Width | Solid| Leading| Leading| Leading|
r2 || n2 | n2 | n2 | n. |________|______|________|________|________|
Readability of Text | 9 Pica| -9.3 | -6.0 | -5.3 | -7.1 |
Line Width and Leading for|114PPica|T-4.5 | -0.6 | -0.3 | -1.7 |
= | 19 Pica| -5.0 | -5.1 | 0.0 | -2.0 |
Line:Set:1-Point:2-Point:4|P31nPica| -3.7 | -3.8 | -2.4 | -3.6 |
Width:Solid:Leading:Leadin|:43aPica| -9.1 | -9.0 | -5.9 | -8.8 |
_ |________|______|________|________|________|
9 Pica:\-9.3:\-6.0:\-5.3:\-7.1
14 Pica:\-4.5:\-0.6:\-0.3:\-1.7
19 Pica:\-5.0:\-5.1: 0.0:\-2.0
31 Pica:\-3.7:\-3.8:\-2.4:\-3.6
43 Pica:\-9.1:\-9.0:\-5.9:\-8.8
.TE
April 27, 2013
USD:28-16 Tbl - A Program to Format Tables
Input: Output:
.TS Some London Transport Statistics
c s (Year 1964)
cip-2 s Railway route miles 244
l n Tube 66
a n. Sub-surface 22
Some London Transport StatistiSurface 156
(Year 1964) Passenger traffic - railway
Railway route milesO244 Journeys 674 million
TubeO66 Average length 4.55 miles
Sub-surfaceO22 Passenger miles 3,066 million
SurfaceO156 Passenger traffic - road
.sp .5 Journeys 2,252 million
.T& Average length 2.26 miles
l r Passenger miles 5,094 million
a r. Vehicles 12,521
Passenger traffic \- railway Railway motor cars 2,905
JourneysO674 million Railway trailer cars 1,269
Average lengthO4.55 miles Total railway 4,174
Passenger milesO3,066 million Omnibuses 8,347
.T& Staff 73,739
l r Administrative, etc. 5,582
a r. Civil engineering 5,134
Passenger traffic \- road Electrical eng. 1,714
JourneysO2,252 million Mech. eng. - railway 4,310
Average lengthO2.26 miles Mech. eng. - road 9,152
Passenger milesO5,094 million Railway operations 8,930
.T& Road operations 35,946
l n Other 2,971
a n.
.sp .5
VehiclesO12,521
Railway motor carsO2,905
Railway trailer carsO1,269
Total railwayO4,174
OmnibusesO8,347
.T&
l n
a n.
.sp .5
StaffO73,739
Administrative, etc.O5,582
Civil engineeringO5,134
Electrical eng.O1,714
Mech. eng. \- railwayO4,310
Mech. eng. \- roadO9,152
Railway operationsO8,930
Road operationsO35,946
OtherO2,971
.TE
April 27, 2013
Tbl - A Program to Format Tables USD:28-17
Input:
.ps 8
.vs 10p
.TS
center box;
c s s
ci s s
c c c
lB l n.
New Jersey Representatives
(Democrats)
.sp .5
NameOOffice addressOPhone
.sp .5
James J. FlorioO23 S. White Horse Pike, Somerdale 08083O609-627-8222
William J. HughesO2920 Atlantic Ave., Atlantic City 08401O609-345-4844
James J. HowardO801 Bangs Ave., Asbury Park 07712O201-774-1600
Frank Thompson, Jr.O10 Rutgers Pl., Trenton 08618O609-599-1619
Andrew MaguireO115 W. Passaic St., Rochelle Park 07662O201-843-0240
Robert A. RoeOU.S.P.O., 194 Ward St., Paterson 07510O201-523-5152
Henry HelstoskiO666 Paterson Ave., East Rutherford 07073O201-939-9090
Peter W. Rodino, Jr.OSuite 1435A, 970 Broad St., Newark 07102O201-645-3213
Joseph G. MinishO308 Main St., Orange 07050O201-645-6363
Helen S. MeynerO32 Bridge St., Lambertville 08530O609-397-1830
Dominick V. DanielsO895 Bergen Ave., Jersey City 07306O201-659-7700
Edward J. PattenONatl. Bank Bldg., Perth Amboy 08861O201-826-4610
.sp .5
.T&
ci s s
lB l n.
(Republicans)
.sp .5v
Millicent FenwickO41 N. Bridge St., Somerville 08876O201-722-8200
Edwin B. ForsytheO301 Mill St., Moorestown 08057O609-235-6622
Matthew J. RinaldoO1961 Morris Ave., Union 07083O201-687-4235
.TE
.ps 10
.vs 12p
April 27, 2013
USD:28-18 Tbl - A Program to Format Tables
Output:
________________________________________________________________________________
| New Jersey Representatives |
| (Democrats) |
| Name Office address Phone |
|James J. Florio 23 S. White Horse Pike, Somerdale 08083 609-627-8222|
|William J. Hughes 2920 Atlantic Ave., Atlantic City 08401 609-345-4844|
|James J. Howard 801 Bangs Ave., Asbury Park 07712 201-774-1600|
|Frank Thompson, Jr. 10 Rutgers Pl., Trenton 08618 609-599-1619|
|Andrew Maguire 115 W. Passaic St., Rochelle Park 07662 201-843-0240|
|Robert A. Roe U.S.P.O., 194 Ward St., Paterson 07510 201-523-5152|
|Henry Helstoski 666 Paterson Ave., East Rutherford 07073 201-939-9090|
|Peter W. Rodino, Jr. Suite 1435A, 970 Broad St., Newark 07102 201-645-3213|
|Joseph G. Minish 308 Main St., Orange 07050 201-645-6363|
|Helen S. Meyner 32 Bridge St., Lambertville 08530 609-397-1830|
|Dominick V. Daniels 895 Bergen Ave., Jersey City 07306 201-659-7700|
|Edward J. Patten Natl. Bank Bldg., Perth Amboy 08861 201-826-4610|
| (Republicans) |
|Millicent Fenwick 41 N. Bridge St., Somerville 08876 201-722-8200|
|Edwin B. Forsythe 301 Mill St., Moorestown 08057 609-235-6622|
|Matthew J. Rinaldo 1961 Morris Ave., Union 07083 201-687-4235|
|______________________________________________________________________________|
This is a paragraph of normal text placed here only to indicate
where the left and right margins are. In this way the reader can
judge the appearance of centered tables or expanded tables, and
observe how such tables are formatted.
Input:
.TS
expand;
c s s s
c c c c
l l n n.
Bell Labs Locations
NameOAddressOArea CodeOPhone
HolmdelOHolmdel, N. J. 07733O201O949-3000
Murray HillOMurray Hill, N. J. 07974O201O582-6377
WhippanyOWhippany, N. J. 07981O201O386-3000
Indian HillONaperville, Illinois 60540O312O690-2000
.TE
Output:
Bell Labs Locations
Name Address Area Code Phone
Holmdel Holmdel, N. J. 07733 201 949-3000
Murray Hill Murray Hill, N. J. 07974 201 582-6377
Whippany Whippany, N. J. 07981 201 386-3000
Indian Hill Naperville, Illinois 60540 312 690-2000
April 27, 2013
Tbl - A Program to Format Tables USD:28-19
Input:
.TS
box;
cb s s s
c | c | c s
ltiw(1i) | ltw(2i) | lp8 | lw(1.5i)p8.
Some Interesting Places
_
NameODescriptionOPractical Information
_
T{
American Museum of Natural History
T}OT{
The collections fill 11.5 acres (Michelin) or 25 acres (MTA)
of exhibition halls on four floors. There is a full-sized replica
of a blue whale and the world's largest star sapphire (stolen in 1964).
T}OHoursO10-5, ex. Sun 11-5, Wed. to 9
\^O\^OLocationOT{
Central Park West & 79th St.
T}
\^O\^OAdmissionODonation: $1.00 asked
\^O\^OSubwayOAA to 81st St.
\^O\^OTelephoneO212-873-4225
_
Bronx ZooOT{
About a mile long and .6 mile wide, this is the largest zoo in America.
A lion eats 18 pounds
of meat a day while a sea lion eats 15 pounds of fish.
T}OHoursOT{
10-4:30 winter, to 5:00 summer
T}
\^O\^OLocationOT{
185th St. & Southern Blvd, the Bronx.
T}
\^O\^OAdmissionO$1.00, but Tu,We,Th free
\^O\^OSubwayO2, 5 to East Tremont Ave.
\^O\^OTelephoneO212-933-1759
_
Brooklyn MuseumOT{
Five floors of galleries contain American and ancient art.
There are American period rooms and architectural ornaments saved
from wreckers, such as a classical figure from Pennsylvania Station.
T}OHoursOWed-Sat, 10-5, Sun 12-5
\^O\^OLocationOT{
Eastern Parkway & Washington Ave., Brooklyn.
T}
\^O\^OAdmissionOFree
\^O\^OSubwayO2,3 to Eastern Parkway.
\^O\^OTelephoneO718-638-5000
_
T{
New-York Historical Society
T}OT{
All the original paintings for Audubon's
April 27, 2013
USD:28-20 Tbl - A Program to Format Tables
.I
Birds of America
.R
are here, as are exhibits of American decorative arts, New York history,
Hudson River school paintings, carriages, and glass paperweights.
T}OHoursOT{
Tues-Fri & Sun, 1-5; Sat 10-5
T}
\^O\^OLocationOT{
Central Park West & 77th St.
T}
\^O\^OAdmissionOFree
\^O\^OSubwayOAA to 81st St.
\^O\^OTelephoneO212-873-3400
.TE
Output:
____________________________________________________________________________________
Some Interesting Places
____________________________________________________________________________________
Name Description Practical Information
____________________________________________________________________________________
American Museum The collections fill Hours 10-5, ex. Sun 11-5, Wed. to 9
of Natural His- 11.5 acres (Miche- Location Central Park West & 79th St.
tory lin) or 25 acres Admission Donation: $1.00 asked
(MTA) of exhibition Subway AA to 81st St.
halls on four Telephone 212-873-4225
floors. There is a
full-sized replica
of a blue whale and
the world's largest
star sapphire
(stolen in 1964).
____________________________________________________________________________________
Bronx Zoo About a mile long Hours 10-4:30 winter, to 5:00 sum-
and .6 mile wide, mer
this is the largest Location 185th St. & Southern Blvd,
zoo in America. A the Bronx.
lion eats 18 pounds Admission $1.00, but Tu,We,Th free
of meat a day while Subway 2, 5 to East Tremont Ave.
a sea lion eats 15 Telephone 212-933-1759
pounds of fish.
____________________________________________________________________________________
April 27, 2013
Tbl - A Program to Format Tables USD:28-21
|Brooklyn Museum| Five floors of gal-| Hours | Wed-Sat, 10-5, Sun 12-5 |
| | leries contain Amer-| Location | Eastern Parkway & Washington|
| | ican and ancient| | Ave., Brooklyn. |
| | art. There are Amer-| Admission| Free |
| | ican period rooms| Subway | 2,3 to Eastern Parkway. |
| | and architectural| Telephone| 718-638-5000 |
| | ornaments saved from| | |
| | wreckers, such as a| | |
| | classical figure| | |
| | from Pennsylvania| | |
| | Station. | | |
|_______________|______________________|___________|_______________________________|
|New-York His-| All the original| Hours | Tues-Fri & Sun, 1-5; Sat 10-5|
|torical Society| paintings for| Location | Central Park West & 77th St. |
| | Audubon's Birds of| Admission| Free |
| | America are here, as| Subway | AA to 81st St. |
| | are exhibits of| Telephone| 212-873-3400 |
| | American decorative| | |
| | arts, New York his-| | |
| | tory, Hudson River| | |
| | school paintings,| | |
| | carriages, and glass| | |
| | paperweights. | | |
|_______________|______________________|___________|_______________________________|
Acknowledgments.
Many thanks are due to J. C. Blinn, who has done a large
amount of testing and assisted with the design of the program. He
has also written many of the more intelligible sentences in this
document and helped edit all of it. All phototypesetting programs
on UNIX are dependent on the work of J. F. Ossanna, whose assis-
tance with this program in particular has been most helpful. This
program is patterned on a table formatter originally written by
J. F. Gimpel. The assistance of T. A. Dolotta, B. W. Kernighan,
and J. N. Sturman is gratefully acknowledged.
References.
[1] J. F. Ossanna, NROFF/TROFF User's Manual, Computing Science
Technical Report No. 54, Bell Laboratories, 1976.
[2] K. Thompson and D. M. Ritchie, ``The UNIX Time-Sharing Sys-
tem,'' Comm. ACM. 17, pp. 365-75 (1974).
[3] B. W. Kernighan and L. L. Cherry, ``A System for Typesetting
Mathematics,'' Comm. ACM. 18, pp. 151-57 (1975).
[4] M. E. Lesk, Typing Documents on UNIX, Bell Laboratories
internal memorandum.
[5] M. E. Lesk and B. W. Kernighan, Computer Typesetting of
Technical Journals on UNIX, Computing Science Technical Re-
April 27, 2013
USD:28-22 Tbl - A Program to Format Tables
port No. 44, Bell Laboratories, July 1976.
[6] J. R. Mashey and D. W. Smith, PWB/MM - Programmer's Work-
bench Memorandum Macros, Bell Laboratories memorandum.
List of Tbl Command Characters and Words
Command Meaning Section
a A Alphabetic subcolumn 2
allbox Draw box around all items 1
b B Boldface item 2
box Draw box around table 1
c C Centered column 2
center Center table in page 1
doublebox Doubled box around table 1
e E Equal width columns 2
expand Make table full line width 1
f F Font change 2
i I Italic item 2
l L Left adjusted column 2
n N Numerical column 2
nnn Column separation 2
p P Point size change 2
r R Right adjusted column 2
s S Spanned item 2
t T Vertical spanning at top 2
tab (x) Change data separator character 1
$fat roman "T{" ~~ fat roman "T}"$ Text block 3
v V Vertical spacing change 2
w W Minimum width value 2
.xx Included troff command 3
| Vertical line 2
|| Double vertical line 2
^ Vertical span 2
\^ Vertical span 3
= Double horizontal line 2,3
$fat "_"$ Horizontal line 2,3
$fat "\_"$ Short horizontal line 3
April 27, 2013
Generated on 2013-04-27 00:20:00 by $MirOS: src/scripts/roff2htm,v 1.77 2013/01/01 20:49:09 tg Exp $
These manual pages and other documentation are copyrighted by their respective writers;
their source is available at our CVSweb,
AnonCVS, and other mirrors. The rest is Copyright © 2002‒2013 The MirOS Project, Germany.
This product includes material
provided by Thorsten Glaser.
This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report – diffs preferred.