
Formatting with tbl
Some information is best presented in tabular format, that is, displayed in rows and columns. You can structure data in columns using tabs, but that can be difficult, especially if the table consists of long lines of text. The tbl preprocessor was designed to make it easier to prepare complicated tables, such as the following.
| Production of Audio Equipment (units: 1000 sets) | ||
| Product | 1984 | 1985 |
| General radio | 8,895 | 8,770 |
| Clock radio | 5,467 | 6,500 |
| Radio/cassette | 29,734 | 27,523 |
| Tape deck | 11,788 | 14,300 |
| Car radio | 9,450 | 10,398 |
| Car stereo | 15,670 | 17,456 |
With tbl, you can center, left justify, and right justify columns of data or align numeric data within a column. You can put headings that span one or more columns or rows, and draw horizontal and vertical lines to box individual entries or the whole table. An entry may contain equations or consist of several lines of text, as is usually the case with descriptive tables. A table can have as many as 35 columns and essentially an unlimited number of rows.
When you use tbl, you should have an idea or, better still, a written design of the table. Then, using a few tbl specifications, you can define how a formatted table should look, The data is entered row by row; each column is separated by ordinary tabs.
For example, the tbl description for the previous table looks like this:
.TS
center,box; c s s ...Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access