[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 5


tbl Command

Purpose

Formats tables for the nroff and troff commands.

Syntax

tbl [ -TX ] [ -- ] [ File... | - ]

Description

The tbl command is a preprocessor that formats tables for the nroff and troff commands. It reads one or more files. If no File parameter or - (minus sign) is specified as the last parameter, the command reads standard input by default. It copies the input unchanged to standard output, except for text between lines containing .TS and .TE. The tbl command reformats such text, which describes tables, without altering the .TS and .TE lines.

Depending on the target output device, the output formatted by the nroff command may need to be post-processed by the col command to produce correct output.

Note: To minimize the volume of data passed through pipelines, enter the tbl command first when using it with the eqn or neqn command.

Input Format

The tbl command processes text that is displayed within the following format:

[ {.DS .DF} ]
.TS
Options ;
Format .
Data
.TE
[.DE]

To include short tables in an mm macro document, enclose them within the .DS (or .DF) and .DE macro pair.

Options

Following are the available global options for the input format:

Option Purpose
center or CENTER Centers the line.
expand or EXPAND Expands to line length.
box or BOX Encloses in a box.
allbox or ALLBOX Boxes all entries.
doublebox or DOUBLEBOX Encloses in two boxes.
tab(Character) or TAB(Character) Changes the tab character to the Character value.
linesize(Number) or LINESIZE(Number) Makes all lines the thickness of the point size specified by the Number value.
delim(XY) or DELIM(XY) Recognizes the X and Y variables as eqn command delimiters.
; Denotes end of options.

Format

The Format variable in the Input Format describes the format of text. Each format line (the last of which must end with a period) describes all remaining lines of the table. A single-key letter describes each column of each line of the table. Follow this key letter with specifiers that determine the font and point size of the corresponding item, indicate where vertical bars are to appear between columns, and determine such things as column width and intercolumn spacing. The following are the available key letters:

l or L Left-adjusts column.
r or R Right-adjusts column.
c or C Centers column.
n or N Numerically aligns column.

Note: Numerically aligned data, n or N format specification, are based upon the locale that is specific for RADIXCHAR, which is assumed to be a single character. The alignment can also be determined using the \& (backslash, ampersand) character sequence independent of the presence of any RADIXCHAR characters. If more than one RADIXCHAR character is displayed in a numerically aligned field, the last one is used for alignment. If no RADIXCHAR characters are displayed in a particular column, the alignment is based on the last ASCII arabic numeral. If there is no ASCII numeral and no RADIXCHAR character in a column, the data is centered.
a or A Left-adjusts subcolumn.
s or S Spans item horizontally.
t or T Pushes vertical spans to top.
v or V Adjusts vertical line spacing.
^ Spans item vertically.
u or U Moves item half-line up.
z or Z Indicates zero-width item.
- Indicates horizontal line.
= Indicates double horizontal line.
| Indicates vertical line.
|| Indicates double vertical line.
b or B Indicates boldface item.
i or I Indicates italic item.
fCharacter or FCharacter
  Changes to the font specified by the Character variable.
pNumber or PNumber Changes to the size specified by the Number variable.
w(Number) or W(Number)
  Sets minimum column width equal to the Number variable value.
NumberNumber Spaces between columns.
e or E Makes equal-width columns.
. Ends format.

Data

Handling data within the input format, especially for tables, uses the following line commands:

T{...T} Indicates text block, as follows:

Data<TAB>T{

Text Block

T}<TAB>Data

\_ Writes short horizontal line.
\RX Repeats the X parameter value across a column.
\^ Indicates that above item spans downward into this row.
.T& Starts new format.
.TS H, .TH, and .TE Allows multi-page tables with column headings repeated on each page. (This is a feature of the mm macros.)

Parameters


File Specifies the files that the tbl command will be processing.

Flags


-TX Uses only full vertical line motions, making the output suitable for line printers and other devices that do not have partial vertical line motions.
-- (double dash) Indicates the end of flags.
- Forces input to be read from standard input.

Examples

The following example shows coded input, and associated table output of the tbl command. The @ (at sign) is used in input to represent an input tab character.

Input

.TS
center box ;
cB s s
cI | cI s
^ | c c
l | n n .
Household Population
_
Town@Households
@Number@Size
=
Bedminster@789@3.26
Bernards Twp.@3087@3.74
Bernardsville@2018@3.30
Bound Brook@3425@3.04
Bridgewater@7897@3.81
Far Hills@240@3.19
.TE

Output

Related Information

The col command, eqn command, mm command, mmt command, mvt command, neqn command, nroff command, soelim command, troff command.

The mm macro package, mv macro package.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]