groff
[Top][All Lists]
Advanced

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

Re: [Groff] tables in a macro


From: Tadziu Hoffmann
Subject: Re: [Groff] tables in a macro
Date: Tue, 13 Jun 2006 20:11:27 +0200
User-agent: Mutt/1.5.11

> this is interesting. At the moment I am in the need of exactly
> the same thing. So this comes in handy. However I want to have
> a variable parameter list. At maximum I can have up to 10
> parameters.  Each parameter opens a new row. If the Parameter
> is empty the do not open a new row.
> The following didn't work. Seems I am missing something

[snip]

I can't think of a simple way to make this work.  The problem
lies in the nature of tbl as a *pre*processor, which expects
to have all the data it has to operate on available at
*tbl*-runtime, not *troff*-runtime.  Of course, since tbl
knows nothing about font sizes and font metrics and whatnot,
it can't position the individual table items itself, so instead
it generates troff-*code* which troff can execute to decide
how to format the table.

The solution I posted simply exploited this feature of tbl,
namely substituting stuff which tbl deferred to troff anyway.
But this only works if the layout is the same, just the contents
different.  You can't change the *shape* (i.e., number of rows
or columns) of the table by this method, because the troff code
to handle additional items simply isn't there in macro that we
use to save the tbl code.  (tbl didn't generate any, since these
items weren't there when tbl looked at the table and decided
what code to generate for troff.)

Of course, if you write the necessary code to handle a variable
number of items yourself (instead of having tbl write the
code for you) then what you want is possible (see hdtbl,
which operates at troff-runtime).  I just don't see how it
can be done with the way that tbl works.






reply via email to

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