[luatex] Newbie question: how to stop TeX trying to interpret Lua?

luigi scarso luigi.scarso at gmail.com
Mon Apr 4 11:40:34 CEST 2011


On Mon, Apr 4, 2011 at 10:25 AM, Paul Isambert <zappathustra at free.fr> wrote:

>
> Yes, because \TeX expands to harmless primitives (\kern, etc.), so tex.print
> actually sees is something like "T\kern-.1.667em....". Try replacing
> tex.print with texio.write_nl and you'll see. In other cases, though,
> expansion should be carefully controlled.

True, in fact I though that one can replace
<<text>>
with
\directlua{tex.print( [=[<<text>>]=])}
assuming ASCII and the same catcode regime
but it's not true, even if I don't understand clearly why.


\bgroup
\initcatcodetable1
\catcode`\_=0
_TeX\TeX
\savecatcodetable1
\egroup

%% ok
\directlua{tex.print(1, [=[_TeX\relax\TeX]=])}

%% ok
\directlua{tex.print(1, [=[_TeX{}\TeX]=])}

%% ok
\directlua{tex.print(1, [=[_TeX \TeX]=])}


%% wrong
%% \directlua{tex.print(1, [=[_TeX\TeX]=])}
%% ! Undefined control sequence.
%% l.1 _TeXT
%%         \kern


%ok (32 is space)
\directlua{ tex.print(1,string.char(95,84,101,88,
                                    32,
                                    92,84,101,88)) }


%% ok ... why ??
\directlua{ tex.print(1,string.char(95,84,101,88,
                                    92,84,101,88)) }

\bye


-- 
luigi


More information about the luatex mailing list