[luatex] Expansion of TeX macros

Dirk Laurie dirk.laurie at gmail.com
Wed May 30 14:33:14 CEST 2012

I've written a Lua function which combines with a LaTeX
command so I can write
and get the same effect as
  \begin{bmatrix} 1 & 2 & 3 & 4 \\ 5 & 6 & 7 & 8 \end{bmatrix}

The Lua is perfecrtly straightforwad: couple of gsub's translating
the commas and semicolons.

Fine, but when the matrix has some hard TeX in it, e.g.

  \mat{\mat{X,\mathbf 0;\mathbf c',1}

the \mathbf gets expanded to an unbelievable string of macros,
containing, alas, stuff that confuses the Lua code.  I've tried
\noexpand and \expandafter, neither of which I understand
fully, to no avail.

More information about the luatex mailing list