[lltx] \scantokens differs between LaTeX and plain?

Ulrike Fischer news3 at nililand.de
Tue Nov 15 16:40:01 CET 2011


Am Tue, 15 Nov 2011 10:18:40 +0100 schrieb Arno Trautmann:

> 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 error is the one you get if you add a \par in $...$. You can
simplify the problem 

\documentclass{minimal}
\begin{document}

$^^J$

a\scantokens{$^^J$}
\end{document}

In this case the \par in \end{document} will trigger the error as
you can see if you enlarge \errorcontextlines:

! Missing $ inserted.
<inserted text> 
                $
<to be read again> 
                   \par 
\newpage ...k \@nobreakfalse \everypar {}\fi \par 
                                                  \vfil \penalty 

....
l.9 \end{document}


If you put braces around the \scantokens: {\scantokens{$^^J$}}
then one get a ! Extra }, or forgotten $. error.

So in my opinion for some reason the ending "$" is not seen.

The problem seems to be related to \newlinechar: It disappears if
one reset \newlinechar (and then appears for the new value):

\documentclass{minimal}
\begin{document}

\newlinechar`\A
a{\scantokens{$^^J$}}
%\scantokens{$A$}
\end{document}


-- 
Ulrike Fischer 



More information about the lualatex-dev mailing list