[lltx] \scantokens differs between LaTeX and plain?

Arno Trautmann Arno.Trautmann at gmx.de
Tue Nov 15 10:18:40 CET 2011


Hi all!

[moving this thread from texhax]

After I had trouble with the tabu package, Philipp Stephani posted the 
following minimal example on texhax that causes the problem. The code 
works with XeLaTeX and pdfLaTeX, and with every plain flavour (without 
\documentclass etc. of course):

\documentclass{minimal}
\begin{document}
\begingroup
\obeylines%
\endlinechar=10 %
\global\toks0{
}%
\endgroup%
$\scantokens\expandafter{\expandafter$\the\toks0$}$
\end{document}

But with LuaLaTeX, this throws the following error:

./test.tex:11: Missing $ inserted.
<inserted text>
                 $
l.11 \end{document}

?

Does anyone have an idea what's going on? In what point does LuaLaTeX 
differ from the other formats? And is it a bug or a feature? I guessed 
it could be related to fonts as that is the only thing that seems to be 
different in the formats; however, Will Robertson stated on texhax:

“There's font change in \everymath in LaTeX (actually it's 
\frozen at everymath); but even if you empty it (\frozen at everymath={}), the 
error still occurs. I think the discussion should be moved to the LuaTeX 
and LuaLaTeX lists.”

So, any other ideas?

cheers
Arno


More information about the lualatex-dev mailing list