groff
[Top][All Lists]
Advanced

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

Re: [Groff] Creating a table macro


From: Tadziu Hoffmann
Subject: Re: [Groff] Creating a table macro
Date: Thu, 19 May 2011 23:09:11 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

> I see now, that for most purposes, macros involving
> preprocessors should be avoided.

For the most part, yes.  There probably *are* some cool tricks
you can do, but they would require a good idea of what happens
internally.


> I suppose one alternative would be to use special tags
> within comments to be targeted with sed/perl/tt/m4 later.

With regard to tables, you might also try the HDtbl package,
a set of macros for typesetting tables which runs completely
within groff, without using a preprocessor.


Another idea you might pursue is to extend Ted's suggestion to a
two-pass scheme (if you have forward cross-references in your
text, you'll usually have a multi-pass scheme already): in the
first pass, your table macros write out files, which are sourced
in the second pass (but the source request should not be inside
a macro, so soelim can pick it up, otherwise tbl won't see the
table either), maybe like so:

  .so mytable1.tbl
  .mytable mytable1.tbl
  data data data
  ...
  .endmytable

where "mytable" is a macro which writes a file which can be
parsed by tbl (i.e., everything from .TS to .TE), and whose name
is specified as an argument (in this example "mytable1.tbl").
As an exercise for the experts, it might even be possible to
(ugh!) redefine ".so" as the mytable macro, so you wouldn't
have to give the filename twice...






reply via email to

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