Путеводитель по Руководству Linux

  User  |  Syst  |  Libr  |  Device  |  Files  |  Other  |  Admin  |  Head  |



   groff_hdtbl    ( 7 )

макросы таблиц Гейдельберга для GNU roff (Heidelberger table macros for GNU roff)

  Name  |  Description  |    Usage    |  Macros and arguments  |

Использование (Usage)

In this and the next section, we present examples to help users understand the basic workflow of hdtbl. First of all, you must load the hdtbl.tmac file. As with nearly all other groff macro packages, there are two possibilities to do so: Either add the line

.mso hdtbl.tmac

to your roff file before using any macros of the hdtbl package, or add the option

-m hdtbl

to the command line of groff (before the document file which contains hdtbl macros). Then you can include on or more tables in your document, where each one must be started and ended with the .TBL and .ETB macros, respectively.

In this man page, we approximate the result of each example as terminal ouput to be as generic as possible since hdtbl currently only supports the ps and pdf output drivers.

The simplest well-formed table consists of just single calls to the four base table macros in the right order. Here we construct a table with only one cell.

.TBL .TR .TD contents of the table cell .ETB

A terminal representation is

+------------------------------------------------------+ | contents-of-the-table-cell | +------------------------------------------------------+

Equivalent to the above is the following notation.

.TBL .TR .TD "contents of the table cell" .ETB

By default, the formatted table is inserted into the surrounding text at the place of its definition. If the vertical space isn't sufficient, it is placed at the top of the next page. Tables can also be stored for later insertion.

Using 'row-number*column-number' as the data for the table cells, a table with two rows and two columns can be written as

.TBL cols=2 . TR .TD 1*1 .TD 1*2 . TR .TD 2*1 .TD 2*2 .ETB

A terminal representation is

+--------------------------+---------------------------+ | 1*1 | 1*2 | +--------------------------+---------------------------+ | 2*1 | 2*2 | +--------------------------+---------------------------+

Here we see a difference from HTML tables: The number of columns must be explicitly specified using the 'cols=m' argument (or indirectly via the 'width' argument, see below).

The contents of a table cell is arbitrary; for example, it can be another table, without restriction to the nesting depth. A given table layout can be either constructed with suitably nested tables or with proper arguments to .TD and .TH, controlling column and row spanning. Note, however, that this table

.TBL . TR . TD . nop 1*1 1*2 . TR . TD . TBL cols=2 border= . TR . TD . nop 2*1 . TD . nop 2*2 . ETB .ETB

and this table

.TBL cols=2 . TR . TD colspan=2 . nop 1*1 1*2 . TR . TD . nop 2*1 . TD . nop 2*2 .ETB

are similar but not identical (the use of .nop is purely cosmetic to get proper indentation).

The first table looks like

+------------------------------------------------------+ | 1*1 1*2 | +------------------------------------------------------+ | | | 2*1 2*2 | | | +------------------------------------------------------+

and the second one like

+------------------------------------------------------+ | 1*1 1*2 | +---------------------------+--------------------------+ | 2*1 | 2*2 | +---------------------------+--------------------------+

Here is the latter table in a more compact form.

.TBL cols=2 .TR ".TD colspan=2" 1*1 1*2 . TR .TD 2*1 .TD 2*2 .ETB

If a macro has one or more arguments (see below), and it is not starting a line, everything belonging to this macro including the macro itself must be enclosed in double quotes.