[texhax] \directlua in LuaLaTeX

Arno Trautmann Arno.Trautmann at gmx.de
Thu Feb 4 23:33:25 CET 2010

Hi all!

I was playing around a bit with LuaLaTeX (from TeXlive2009) and tried to
execute TeX code in a \directlua{tex.print()}.

The LuaTeX manual shows the following example (of course without the
LaTeX-stuff, only line 3):

before\directlua{tex.sprint("\\relax")tex.sprint(" inbetween")}after

But if I compile this with lualatex, I get a big heap of errors starting

! Undefined control sequence.
\\  ->\let \reserved at e
                       \relax \let \reserved at f \relax \@ifstar {\let
l.4 before\directlua{tex.sprint("\\
                                   relax")tex.sprint(" inbetween")}after

So … I don’t understand where the problem comes from and how to
interpret these errors. I assume there is a problem that \directlua
expands all the TeX code directly and that this might clash anyhow with
a \protect. But no idea why this is evil …

Can anybody help me understanding this behaviour?


More information about the texhax mailing list