------------------------------- Page    i -------------------------------

                        Formatting Tables on UTS




                                                 M. E. Lesk



                                                 Edited for UTS

------------------------------- Page   ii -------------------------------

                            TABLE OF CONTENTS


Abstract  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   1

1.    Introduction  . . . . . . . . . . . . . . . . . . . . . . . . .   1

2.    Input Commands  . . . . . . . . . . . . . . . . . . . . . . . .   3

2.1      Options  . . . . . . . . . . . . . . . . . . . . . . . . . .   3
2.2      Format . . . . . . . . . . . . . . . . . . . . . . . . . . .   3
2.3      Data . . . . . . . . . . . . . . . . . . . . . . . . . . . .   7
2.4      Additional Command Lines . . . . . . . . . . . . . . . . . .   8

3.    Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   9

4.    Compatibility with Original Bell Labs Version . . . . . . . . .  10

Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . .  10

References  . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  11

Appendix A.    Examples . . . . . . . . . . . . . . . . . . . . . . .  12

Appendix B.    List of Tbl Command Characters and Words . . . . . . .  24


                                                            Last Page  24




                            TABLE OF EXAMPLES


Example 1.    . . . . . . . . . . . . . . . . . . . . . . . . . . . .  12

Example 2.    . . . . . . . . . . . . . . . . . . . . . . . . . . . .  13

Example 3.    . . . . . . . . . . . . . . . . . . . . . . . . . . . .  14

Example 4.    . . . . . . . . . . . . . . . . . . . . . . . . . . . .  14

Example 5.    . . . . . . . . . . . . . . . . . . . . . . . . . . . .  15

Example 6.    . . . . . . . . . . . . . . . . . . . . . . . . . . . .  16

Example 7.    . . . . . . . . . . . . . . . . . . . . . . . . . . . .  17

-------------------------------- Page  1 --------------------------------

Example 8.    . . . . . . . . . . . . . . . . . . . . . . . . . . . .  18

Example 9.    . . . . . . . . . . . . . . . . . . . . . . . . . . . .  20

Example 10.   . . . . . . . . . . . . . . . . . . . . . . . . . . . .  21

Example 11.   . . . . . . . . . . . . . . . . . . . . . . . . . . . .  22

Example 12.   . . . . . . . . . . . . . . . . . . . . . . . . . . . .  23

-------------------------------- Page  2 --------------------------------

ABSTRACT

Tbl is  a document  formatting preprocessor  for nroff  which makes  even
fairly complex tables easy to  specify and enter.  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 sin-
gle 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)        |
               |________________________________________|
               |    State   |    Taxes  |  Money|   Net |
               |____________|__collected|__spent|_______|
               | 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|


This document is intended primarily for those who are maintaining the tbl
program, or its associated text formatting programs, or nroff macro pack-
ages.  The ms and mm users are probably  not interested in much of  this,
and are encouraged to read  the ms user's guide for information on  using
tables within those systems.   However, the examples  in Appendix A  will
probably be of benefit to anyone desiring to produce such tables.

UNIX- users interested in using tbl with documents designed to run on the
standard Bell Labs version of tbl should see {#4}.




1.    INTRODUCTION

Tbl turns a simple description of a  table into an nroff (Reference  [1])
program (list of commands) that prints the table.  It isolates  a portion
_______________
  -UNIX is a trademark of Bell Laboratories.

-------------------------------- Page  3 --------------------------------

of a job  that it  can successfully handle  and leave  the remainder  for
other programs.  Thus tbl may be used with other formatting processors or
various layout macro packages (References [3], [2]), but does not  dupli-
cate 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 sec-
tion explaining how to invoke tbl precedes the examples.

The input to tbl is text for a document, with tables preceded by a  '.ts'
(table start) command and followed  by a '.te' (table end) command.   Tbl
processes the tables,  generating nroff formatting  commands, and  leaves
the remainder  of the  text  unchanged.  The  '.ts' and  '.te' lines  are
copied, too, so that nroff page layout macros (such as for ms and mm) can
use these lines to delimit and place tables as they see fit.  In particu-
lar, 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 information  fol-
lowed by the data  to be entered  in the table.  The formatting  informa-
tion, 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.

-------------------------------- Page  4 --------------------------------

2.    INPUT COMMANDS

As indicated above, a table contains, first, global options, then a  for-
mat 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  described in the
following sections.


2.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
     sep(x)      use x instead of / to separate data items

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 nroff
procedures, such as display macros, in that case.  The user who must have
a multipage boxed table should  use macros designed for this purpose,  as
explained below under 'Usage.'


2.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 {#2.4}), 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    to indicate a left-adjusted column entry (L can be used instead
          of l  for  readability; they  have  the same  meaning  as  key-
          letters)

     r    to indicate a right-adjusted column entry

     c    to indicate a centered column entry

     n    to indicate a numerical column entry, to be aligned with  other

-------------------------------- Page  5 --------------------------------

          numerical entries so that the units digits of numbers line up

     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 8).

     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)

     +    to indicate a vertically spanned heading, i.e. to indicate that
          the entry from the previous row continues 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 cen-
tered in the column.  However,  the special nonprinting 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 centered relative to the wider l
or r items.  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.

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:

-------------------------------- Page  6 --------------------------------

     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 corresponding  column
     entry, or by '=' to indicate a double horizontal line.  If an  adja-
     cent column contains  a horizontal  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  indi-
     cates the  amount of  separation between  this column  and the  next
     column.  The number normally specifies the separation 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
     table is as wide  as the  current line length.   The default  column
     separation number is 3.  If the separation 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 vertical  range.  If
     a key-letter is followed by t, any corresponding vertically  spanned
     item will begin at the top line of its range.

_______________
  -More precisely, an  en is  a number of  points (1  point = 1/72  inch)
  equal to half the current type size.

-------------------------------- Page  7 --------------------------------

Font changes   A key-letter may  be followed  by a  font letter  b or  i.
     This indicates that the  corresponding column should  be in bold  or
     italic font.  Font change  commands given within  the table  entries
     override these specifications.

Vertical spacing changes   A key-letter may be followed  by the letter  v
     and a number to indicate the vertical line spacing to be used within
     a multiline 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  correspond-
     ing table entry is a text block (see #2.3).

Column width indication   A key-letter may  be followed by  the letter  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 nroff  units
     can be used to scale the width 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  to
     indicate equal  width columns.   All columns  whose key-letters  are
     followed by e are made the same width.  This permits the user to get
     a group of equally 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  with  a  minimum width  of  2.5  inches  and
     separated by 6 ens from the next column could be specified as:

          nw(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 format section,  however,
     defines the number of  columns in  the table; extra  columns in  the
     data are ignored silently.

-------------------------------- Page  8 --------------------------------

2.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 character  is \ is combined  with the following  line
(and the \ vanishes).  The data for different columns (the table entries)
are separated by /'s, unless  the separator character has been  redefined
with the sep option.  There are a few special cases:

Nroff commands within tables   An input line  beginning with  a '.'  fol-
     lowed by anything but a  number is assumed to be a command to  nroff
     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   An input line containing only the character
     - or = is taken to be a single or double line, respectively, extend-
     ing the full width of the table.

Single column horizontal lines   An input table entry containing only the
     character - or =  is taken to be  a single or double line  extending
     the full width of the column.  Such lines are extended to meet  hor-
     izontal or vertical  lines adjoining this  column.  To obtain  these
     characters explicitly in a column, either precede them by \& or fol-
     low them by a space before the usual / or new-line.

Short horizontal lines   An input table entry containing only the  string
     \_ is  taken to  be a single  line as  wide as the  contents of  the
     column.  It is not extended to meet adjoining lines.

Repeated characters   An input table  entry containing only  a string  of
     the form \Rx where x is any character is replaced  by repetitions of
     the character x as wide as the data in the column.  The sequence  of
     x's is not extended to meet adjoining columns.

Vertically spanned items   An input table entry containing only the char-
     acter 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,  pre-
     cede it by t{ and follow it by t}.  Thus the sequence

     .../t{
     block of
     text
     t}/...

     is the way to enter, as a single entry in the table, something  that
     cannot conveniently be typed as a simple string between /'s.

-------------------------------- Page  9 --------------------------------

Note that the t} end delimiter must  begin a line; additional columns  of
data may follow after a / on the same line.   See Example 5 for an illus-
tration of  included text  blocks in  a table.   If more  than twenty  or
thirty text blocks are used in a table, various limits  in the nroff pro-
gram are likely to be exceeded,  producing diagnostics such as 'too  many
string/macro names' or 'too many number registers'.

Text blocks are pulled out from the table, processed separately by nroff,
and replaced in the table as a solid block.  If  no line length is speci-
fied in the block of text itself, or in the table format, the default  is
to use LxC/(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  (font, etc.) used  in setting  the
block of text are those in effect at the beginning of the table  (includ-
ing 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, nroff 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 multipage table, of course, may be arranged as several single
page tables if this proves to be a problem.


2.4      ADDITIONAL COMMAND LINES

If the format of  a table must  be changed after  many similar lines,  as
with subheadings 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 Examples 3  and 8.  Using  this procedure, each  table line can  be
close to its corresponding format line.

-------------------------------- Page 10 --------------------------------

Warning:  Table continuations can not  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.




3.    USAGE

On UTS, tbl can be run on a simple table with one of the commands:

     tbl -TX file | nroff       | tprf     for terminals
     tbl -TX file | nroff -Ttn  | oprf     for the TN printer
     tbl     file | nroff -Tq12 | qprf     for the Qume

Of course, the usual options  may be used on the  nroff and print  filter
commands.

For the convenience  of users  employing line  printers without  adequate
driving tables or postfilters,  the -TX command  line option to tbl  pro-
duces 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 nroff part of the com-
mand line, but they are accepted by tbl as well.

Tbl limits tables to twenty columns; however, use of more than 16 numeri-
cal columns may fail because of limits in nroff, producing  the 'too many
number registers' message.  Nroff  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  that the '.te' macro  is
invoked and may  be used  in the expansion  of that  macro.  More  impor-
tantly, to assist in laying  out multipage 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 mul-
tipage table can be boxed.   In particular, the ms and  mm macros can  be
used to print a multipage  boxed table with a repeated heading by  giving
an argument to the '.ts' macro.  If the table start macro is written
      .ts h
a line of the form
      .th

-------------------------------- Page 11 --------------------------------

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 and  mm
macros.




4.    COMPATIBILITY WITH ORIGINAL BELL LABS VERSION

In converting tbl to run  under UTS, several  special symbols were  given
new names,  which were  more  convenient in  this environment.   This  is
entirely upward compatible, and all  of the original symbols still  work,
even if not mentioned in  the rest of this document.  In particular,  the
following pairs of symbols are synonymous:

                              ____________
                             |      |    |
                             |_Unix_|_UTS|
                             |  .ts | .TS|
                             |  .th | .TH|
                             |  .t& | .T&|
                             |  .te | .TE|
                             |  t{  |  T{|
                             |  t}  |  T}|
                             |  tab | sep|
                             |   +  |  ^ |
                             |   -  |  _ |
                             |  \+  |  \^|
                             |__\-__|__\_|


The only potential area of incompatibility between these two versions  is
in the choice of  field separators.  Since  the tab was not a  convenient
choice in UTS,  the '/'  was used.   However, if  a table  is begun  with
'.TS', instead  of '.ts',  the tab  is still used  as default  separator.
Thus any existing document designed to use the original tbl still can.




ACKNOWLEDGMENTS

Many thanks are due to J. C. Blinn, who has done a large amount of  test-
ing and assisted  with the design  of the program.   He has also  written

-------------------------------- Page 12 --------------------------------

all of  it.   All phototypesetting  programs  on UNIX-based  systems  are
dependent on the work of  the late J. F.  Ossanna, whose assistance  with
this program in particular had  been most helpful.  This program is  pat-
terned on a  table formatter  originally written  by J.  F. Gimpel.   The
assistance of T. A. Dolotta, B. W. Kernighan, and J. N. Sturman is grate-
fully acknowledged.




REFERENCES

 [1]  Nroff User's Guide (to be released).

 [2]  Formatting Memoranda on UTS.

 [3]  Formatting Documents on UTS.

 [4]  Kernighan, B. W., M. E. Lesk, and J. F. Ossanna, Document  Prepara-
      tion, The Bell System Technical Journal, July-August 1978, Vol. 57,
      No. 6, Part 2, pp. 2115-2135.

 [5]  M. E. Lesk,  Typing Documents  on UNIX,  UNIX Programmer's  Manual,
      Volume 2.

 [6]  J. R. Mashey and D. W. Smith, 'Documentation Tools and Techniques',
      Proc. 2nd Int. Conf. on Software Engineering, pp. 177-181 (October,
      1976).

-------------------------------- Page 13 --------------------------------

APPENDIX A.    EXAMPLES

Here are some examples illustrating features of tbl.



                             Example 1.

Input:

.ts
expand;
ci s s s
c  c c c
l  l n n.
Bell Labs Locations
.sp
Name/Address/Area Code/Phone
.sp .5
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
.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

-------------------------------- Page 14 --------------------------------

                             Example 2.

Input:

.ts
sep(~), box;
c c c
l l l.
.sp .5
Language~Authors~Runs on
.sp .5
Fortran~Many~Almost anything
PL/1~IBM~360/370
C~BTL~11/45,H6000,370
BLISS~Carnegie-Mellon~PDP-10,11
IDS~Honeywell~H6000
Pascal~Stanford~370
.te



Output:

______________________________________________
                                             |
 Language       Authors           Runs on    |
 Fortran    Many              Almost anything|
 PL/1       IBM               360/370        |
 C          BTL               11/45,H6000,370|
 BLISS      Carnegie-Mellon   PDP-10,11      |
 IDS        Honeywell         H6000          |
 Pascal     Stanford          370            |
_____________________________________________|

-------------------------------- Page 15 --------------------------------

                             Example 3.

Input:                        Output:

.ts                           ______________________________________
box;                         |                                     |
cb s s s.                    |         Composition of Foods        |
.sp .5                       |_____________________________________|
Composition of Foods         |           |_____Percent_by_Weight___|
.sp .5                       |    Food   |  Protein|  Fat|  Carbo- |
-                            |___________|_________|_____|__hydrate|
.t&                          | Apples    |     .4  |   .5|   13.0  |
c | c s s                    | Halibut   |   18.4  |  5.2|    ...  |
c | c s s                    | Lima beans|    7.5  |   .8|   22.0  |
c | c | c | c.               | Milk      |    3.3  |  4.0|    5.0  |
Food/Percent by Weight       | Mushrooms |    3.5  |   .4|    6.0  |
\+/-                         |_Rye_bread_|____9.0__|___.6|___52.7__|
\+/Protein/Fat/Carbo-
\+/\+/\+/hydrate
-
.t&
l | n | n | n.
Apples/.4/.5/13.0
Halibut/18.4/5.2/...
Lima beans/7.5/.8/22.0
Milk/3.3/4.0/5.0
Mushrooms/3.5/.4/6.0
Rye bread/9.0/.6/52.7
.te



                             Example 4.

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.                       |_______________________________|
January/February/March
April/May
June/July/months
August/September
October/November/December
.te

-------------------------------- Page 16 --------------------------------

                             Example 5.

Input:

.ts
allbox;
cb s s
c cw(2.5i) cw(2i)
l l l.
.sp .5
New York Area Rocks
.sp .75
Era/Formation/Age (years)
.sp .25
Precambrian/Reading Prong/>1 billion
Paleozoic/Manhattan Prong/400 million
Mesozoic/t{
Newark Basin, incl. Stockton, Lockatong, and Brunswick formations;
also Watchungs and Palisades.
t}/200 million
Cenozoic/Coastal Plain/t{
.na
On Long Island 30,000 years.
Cretaceous sediments redeposited by recent glaciation.
.ad
t}
.te



Output:

_________________________________________________________________________
                                                                        |
                           New York Area Rocks                          |
________________________________________________________________________|
_____Era____|____________Formation___________|________Age_(years)_______|
_Precambrian|__Reading_Prong_________________|__>1_billion______________|
_Paleozoic__|__Manhattan_Prong_______________|__400_million_____________|
 Mesozoic   |  Newark Basin, incl.  Stockton,|  200 million             |
            |  Lockatong, and Brunswick  for-|                          |
            |  mations;  also  Watchungs  and|                          |
            |  Palisades.                    |                          |
____________|________________________________|__________________________|
 Cenozoic   |  Coastal Plain                 |  On Long Island 30,000   |
            |                                |  years.  Cretaceous sedi-|
            |                                |  ments redeposited by    |
____________|________________________________|__recent_glaciation.______|

-------------------------------- Page 17 --------------------------------

                             Example 6.

Input:

.ts
box;
cb s s
c  | c | c
l  | l | n.
.sp .5
Major New York Bridges
.sp .5
=
.sp .25
Bridge/Designer/Length
.sp .25
-
Brooklyn/J. A. Roebling/1595
Manhattan/G. Lindenthal/1470
Williamsburg/L. L. Buck/1600
-
Queensborough/Palmer &/1182
/  Hornbostel
-
//1380
Triborough/O. H. Ammann/-
//383
-
Bronx Whitestone/O. H. Ammann/2300
Throgs Neck/O. H. Ammann/1800
-
George Washington/O. H. Ammann/3500
.te

-------------------------------- Page 18 --------------------------------

Output:

_____________________________________________
                                            |
___________Major_New_York_Bridges___________|
____________________________________________|
______Bridge______|_____Designer___|__Length|
 Brooklyn         |  J. A. Roebling|   1595 |
 Manhattan        |  G. Lindenthal |   1470 |
_Williamsburg_____|__L._L._Buck____|___1600_|
 Queensborough    |  Palmer &      |   1182 |
__________________|____Hornbostel__|________|
                  |                |   1380 |
 Triborough       |  O. H. Ammann  |________|
__________________|________________|____383_|
 Bronx Whitestone |  O. H. Ammann  |   2300 |
 Throgs Neck      |  O. H. Ammann  |   1800 |
__________________|________________|________|
_George_Washington|__O._H._Ammann__|___3500_|



                             Example 7.

Input:                        Output:

.ts                           _________________________
allbox;                      |    AT&T Common Stock   |
cb s s                       |________________________|
c  c c                       |_Year|__Price|__Dividend|
n  n n.                      |_1971|__41-54|___$2.60__|
.sp .5                       |____2|__41-54|____2.70__|
AT&T Common Stock            |____3|__46-55|____2.87__|
.sp .5                       |    4|  40-53|    3.24  |
Year/Price/Dividend          |_____|_______|__________|
1971/41-54/$2.60             |____5|__45-52|____3.40__|
2/41-54/2.70                 |____6|__51-59|_____.95*_|
3/46-55/2.87                  * (first quarter only)
4/40-53/3.24
5/45-52/3.40
6/51-59/.95*
.te
* (first quarter only)

-------------------------------- Page 19 --------------------------------

                             Example 8.

Input:

.ts
ci s
c  s
l  n
a  n.
Some London Transport Statistics
.sp .5
(Year 1964)
.sp .5
Railway route miles/244
Tube/66
Subsurface/22
Surface/156
.sp .5
.t&
l r
a r.
Passenger traffic \(-- railway
Journeys/674 million
Average length/4.55 miles
Passenger miles/3,066 million
.t&
l r
a r.
.sp .5
Passenger traffic \(-- road
Journeys/2,252 million
Average length/2.26 miles
Passenger miles/5,094 million
.t&
l n
a n.
.sp .5
Staff/73,739
Administrative, etc./5,582
Civil engineering/5,134
Electrical eng./1,714
Mech. eng. \(-- railway/4,310
Mech. eng. \(-- road/9,152
Railway operations/8,930
Road operations/35,946
Other/2,971
.te

-------------------------------- Page 20 --------------------------------

Output:


      Some London Transport Statistics

                (Year 1964)
Railway route miles                  244
   Tube                               66
   Subsurface                         22
   Surface                           156

Passenger traffic -- railway
   Journeys                      674 million
   Average length                 4.55 miles
   Passenger miles             3,066 million
Passenger traffic -- road
   Journeys                    2,252 million
   Average length                 2.26 miles
   Passenger miles             5,094 million

Staff                             73,739
   Administrative, etc.            5,582
   Civil engineering               5,134
   Electrical eng.                 1,714
   Mech. eng. -- railway           4,310
   Mech. eng. -- road              9,152
   Railway operations              8,930
   Road operations                35,946
   Other                           2,971

-------------------------------- Page 21 --------------------------------

                             Example 9.

Input:

.ts
center, box;
cb s  s
ci ci ci
c  s  s
lb l  n.
.sp
New Jersey Representatives
.sp
Name/Office address/Phone
.sp
(Democrats)
.sp .5
James Florio/23 White Horse Pike, Somerdale 08083/609-627-8222
William Hughes/2920 Atlantic, Atlantic City 08401/609-345-4844
James Howard/801 Bangs Ave., Asbury Park 07712/201-774-1600
Frank Thompson/10 Rutgers Pl., Trenton 08618/609-599-1619
Andrew Maguire/115 Passaic St., Rochelle Park 07662/201-843-0240
Robert Roe/194 Ward St., Paterson 07510/201-523-5152
Henry Helstoski/666 Paterson, East Rutherford 07073/201-939-9090
Peter Rodino/Suite 1435A, 970 Broad, Newark 07102/201-645-3213
Joseph Minish/308 Main St., Orange 07050/201-645-6363
Helen Meyner/32 Bridge St., Lambertville 08530/609-397-1830
Dominick Daniels/895 Bergen Ave., Jersey City 07306/201-659-7700
Edward Patten/Nat'l. Bank Bldg., Perth Amboy 08861/201-826-4610

.t&
c  s s
lb l n.
(Republicans)
.sp .5
Millicent Fenwick/41 N. Bridge St., Somerville 08876/201-722-8200
Edwin Forsythe/301 Mill St., Moorestown 08057/609-235-6622
Matthew Rinaldo/1961 Morris Ave., Union 07083/201-687-4235
.te

-------------------------------- Page 22 --------------------------------

Output:

_________________________________________________________________________
                                                                        |
                       New Jersey Representatives                       |
                                                                        |
       Name                     Office address                 Phone    |
                                                                        |
                               (Democrats)                              |
                                                                        |
 James Florio        23 White Horse Pike, Somerdale 08083   609-627-8222|
 William Hughes      2920 Atlantic, Atlantic City 08401     609-345-4844|
 James Howard        801 Bangs Ave., Asbury Park 07712      201-774-1600|
 Frank Thompson      10 Rutgers Pl., Trenton 08618          609-599-1619|
 Andrew Maguire      115 Passaic St., Rochelle Park 07662   201-843-0240|
 Robert Roe          194 Ward St., Paterson 07510           201-523-5152|
 Henry Helstoski     666 Paterson, East Rutherford 07073    201-939-9090|
 Peter Rodino        Suite 1435A, 970 Broad, Newark 07102   201-645-3213|
 Joseph Minish       308 Main St., Orange 07050             201-645-6363|
 Helen Meyner        32 Bridge St., Lambertville 08530      609-397-1830|
 Dominick Daniels    895 Bergen Ave., Jersey City 07306     201-659-7700|
 Edward Patten       Nat'l. Bank Bldg., Perth Amboy 08861   201-826-4610|
                                                                        |
                              (Republicans)                             |
 Millicent Fenwick   41 N. Bridge St., Somerville 08876     201-722-8200|
 Edwin Forsythe      301 Mill St., Moorestown 08057         609-235-6622|
_Matthew_Rinaldo_____1961_Morris_Ave.,_Union_07083__________201-687-4235|



                             Example 10.

Input:                        Output:

.ts
c c                               Stack
n|n|.                           ________
/Stack                        1|__46___|
/-                            2|__23___|
1/46                          3|__15___|
/-                            4|___6.5_|
2/23                          5|___2.1_|
/-
3/15
/-
4/6.5
/-
5/2.1
/-
.te

-------------------------------- Page 23 --------------------------------

                             Example 11.

Input:

.ts
box, sep(:), center, expand;
cb   s  s  s  s
c    s  s  s  s
c  | c  c  c  c
c  | c  c  c  c
r2 | n2 n2 n2 n.
.sp .75
Readability of Text
.sp .5
Line Width and Leading for 10-Point Type
.sp .75
=
Line:Set:1-Point:2-Point:4-Point
Width:Solid:Leading:Leading:Leading
-
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



Output:

_________________________________________________________________________
                                                                        |
                           Readability of Text                          |
                                                                        |
________________Line_Width_and_Leading_for_10-Point_Type________________|
    Line          Set          1-Point        2-Point        4-Point    |
____Width____|___Solid_________Leading________Leading________Leading____|
    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     |
_____________|__________________________________________________________|

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 appear-
ance of centered tables or expanded  tables, and observe how such  tables
are formatted.

-------------------------------- Page 24 --------------------------------

                             Example 12.

Input:

.ts
center, box;
cb s s s
c  s c c
r1 l c l.
.sp .5
Software Tools Development
.sp .5
Name/ext/office
.sp .25
-
Evan/Adams/6281/e1-135j
Barry/Bakalor/8842/e1-135g
Susan/Ellis/7052/e1-135a
Mark/Linton/7054/e1-135b
Jeff/Liotta/7214/e1-135h
Tom/Lyon/7054/e1-135b
Adrienne/Payne/6281/e1-135j
Casey/Schaufler/8842/e1-135g
Dan/Walsh/7057/e1-134
Diane/Warner/7052/e1-135a
Larry/Whitlock/7073/e1-135d
.te



Output:

                  _____________________________________
                 |                                    |
                 |     Software Tools Development     |
                 |        Name          ext    office |
                 |____________________________________|
                 |     Evan Adams       6281   e1-135j|
                 |    Barry Bakalor     8842   e1-135g|
                 |    Susan Ellis       7052   e1-135a|
                 |     Mark Linton      7054   e1-135b|
                 |     Jeff Liotta      7214   e1-135h|
                 |      Tom Lyon        7054   e1-135b|
                 | Adrienne Payne       6281   e1-135j|
                 |    Casey Schaufler   8842   e1-135g|
                 |      Dan Walsh       7057   e1-134 |
                 |    Diane Warner      7052   e1-135a|
                 |____Larry_Whitlock____7073___e1-135d|

-------------------------------- Page 25 --------------------------------

APPENDIX B.    LIST OF TBL COMMAND CHARACTERS AND WORDS

        Command                   Meaning                Section

         a A          Alphabetic subcolumn                 2.2
         allbox       Draw box around all items            2.1
         b B          Boldface item                        2.2
         box          Draw box around table                2.1
         c C          Centered column                      2.2
         center       Center table in page                 2.1
         doublebox    Doubled box around table             2.1
         e E          Equal width columns                  2.2
         expand       Make table full line width           2.1
         f F          Font change                          2.2
         i I          Italic item                          2.2
         l L          Left adjusted column                 2.2
         n N          Numerical column                     2.2
         nnn          Column separation                    2.2
         p P          Point size change                    2.2
         r R          Right adjusted column                2.2
         s S          Spanned item                         2.2
         t T          Vertical spanning at top             2.2
         sep(x)       Change data separator character      2.1
         t{  t}       Text block                           2.3
         v V          Vertical spacing change              2.2
         w W          Minimum width value                  2.2
         .xx          Included nroff command               2.3
         |            Vertical line                        2.2
         ||           Double vertical line                 2.2
         +            Vertical span                        2.2
         \+           Vertical span                        2.3
         =            Double horizontal line            2.2, 2.3
         -            Horizontal line                   2.2, 2.3
         \-           Short horizontal line                2.3
         \Rx          Repeat character                     2.3

In addition to  these special  symbols, there are  several other  special
characters and words recognized when compatibility with the original Bell
Labs version is required.
