[texhax] tabbing in macros

Oleg Katsitadze olegkat at gmail.com
Wed Sep 6 19:13:16 CEST 2006


On Tue, Sep 05, 2006 at 02:28:56PM -0500, markrichard at cox.net wrote:
> I am trying to find a way to write tabbing commands (like \+ or
> \settabs) within a macro.

If you want to write new tabbing macros, probably the best
would be to read The TeXbook.  Or else see plain.tex file on
your system, but you're on your own here -- there are no
comments to guide you.

If you want to use \+ and \settabs inside your macros, then
it's much easier.

\+ is defined as an outer macro, therefore it cannot be used
inside another macro.  But \tabalign (which is what \+
calls) can.  Unfortunately, \settabs will not work if you
use \tabalign in the sample line:

  \settabs\tabalign Text& More text&\cr % <- doesn't work

because \settabs looks ahead for a \+ and doesn't find it.

Probably the easiest way to deal with this is to redefine \+
to be non-outer:

  \def\+{\tabalign}

  \def\table{%
    \settabs\+ \quad& \quad&\cr
    \+ 1& 2& 3\cr
    \+  & 4& 5\cr
    \+  &  & 6\cr
  }

  \table

  \bye

> Can you help me with this or direct me to
> where this info can be located?

The TeXbook (not free)
TeX for the Impatient http://www.tug.org/ftp/tex/impatient/
TeX by Topic http://www.eijkhout.net/tbt/

Hope this helps,
Oleg


More information about the texhax mailing list