[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Groff] Table Macros

From: Joachim Walsdorff
Subject: [Groff] Table Macros
Date: Thu, 01 Dec 2005 20:35:14 +0100
User-agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)

Table Macros

I wrote some groff-macros for tables. You can download them, together
with some examples, from

To give a first impression here is the beginning of the man page:

  hdtbl -- seven groff-macros for simple but mighty table processing

  This manual page describes hdtbl, an independent extension to the hdgroff
  macrosystem, which was developed and frequently used in the 19eighties and
  -nineties at the University of Heidelberg. hdtbl is a set of four base and
  three optional macros, controlled by about twenty arguments. The syntax is
  simple and similar to the HTML table model and nearly as free: you can
  write sequences of tokens (macro calls with their arguments and content
  data), seperated with blancs and beginning with a macro call, into the same
  line to get compact and clearly arrranged input. Since the hdtbl-macros are
  pure groff, hdtbl works without a preprocessor, and the user doesn't need
  to learn the peculiar tbl-syntax. On the other hand table processing with
  hdtbl is slower as with the classical roff tableprocessor tbl. Because of
  its relationship hdtbl could be easily translated into the HTML table for-
  mat. So for some users who would like the new features of hdtbl and espe-
  cially for new ones, hdtbl could be an alternative to the tableprocessing
  with tbl.

  The  impliest wellformed table consists of just one call to the four base
  table macros in the right order -- the table with only one cell:

     content of the table cell

  Equivalent is the notaion:

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

  By default and if the remaining place on the page is sufficient, the for-
  matted  table is inserted in the surrounding text at the place of its defi-
  nition, else at the top of the next page. Tables can also be held and
  inserted delayed at a place of the users choice.

  A  table with two columns and two rows (cellcontents in this example are
  rownumber*columnnumber) is written as:

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

  Here we see a difference with HTML tables: at the time the number of col-
  umns must be specified explicitly via cols=m (or indirectly via the width-
  argument, see later).

  The content of a tablecell is arbitrary, and can be again a table and so
  on, without restriction in the nesting depth. To get a special table layout
  you have, like with HTML tables, the choice between suitable nested tables
  or by using the arguments for column- and/or rowspanning (see these argu-
  ments for .TD/.TH). The following tables

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


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

  are similar. But tables with column- and/or rowspanning can never look
  identically like nested tables.

  If a macro with argument(s) is not the first one in a line, it must be
  enclosed in double quotes.

  The order of macro calls and other tokens must agree with the HTML content
  model. In the following is listed, which tokens may precede or succeed each
  other legally.

  Macro arguments are seperated with blancs. The order of arguments is arbi-
  trary. They are of the form key=value or key='value1 value2 ...', with the
  only exception of the .ETB-argument hold, which is the value itself.
  Optionally you can write "key=value1 value2 ...", but only if the macro is
  the first one in the line and not already enclosed in double quotes. Argu-
  ment values specified as c are predefined groff-colors or colors defined by
  the user with the groff request .defcolor. Argument values d are decimal
  numbers with or without decimal point. Argument values m are natural num-
  bers. Argument values n are numerical with the usual groff scaling indica-
  tors. Some of the arguments are specific to one or two macros, but most of
  them can be specified with the .TBL-, .TR- and .TD/.TH-macro. These common
  arguments are explained after the following macro descriptions. Most of the
  argument default values can be changed by the user by setting corresponding
  default registers or strings, see below.


Attachment: JWalsdorff.vcf
Description: Vcard

reply via email to

[Prev in Thread] Current Thread [Next in Thread]