# [luatex] Expansion of TeX macros

Wed May 30 16:39:06 CEST 2012

2012/5/30 Dirk Laurie <dirk.laurie at gmail.com>:
> I've written a Lua function which combines with a LaTeX
> command so I can write
>   \mat{1,2,3,4;5,6,7,8}
> 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.
>

Hello,

Could you provide the lua and the tex code you wrote please?

Thanks

--
Christophe