[Dev-luatex] Very simple sample?
David Kastrup
dak at gnu.org
Sat May 12 12:06:32 CEST 2007
olli at sopos.org writes:
> I'm new to both luatex and this list and I hope my question is in the
> scope of this list:
>
> Javier Bezos wrote in
> http://www.ntg.nl/mailman/private/dev-luatex/2006-December/000265.html
>
>> Taco:
>>
>>> This is the simplest solution:
>>>
>>> \let\\\relax
>>> \directlua0{tex.print("\\uppercase{hello}");}
>>
>>:-/ Too ad hoc, but it helped, as I understood what's
>>going on. So I tried:
>>
>>\directlua0\expandafter{%
>> \detokenize{tex.print("\\section{Hola $\\sin a_0^2$}");}}
>>
>>Seems to work.
>
> I tried to wrap this in a \startlua -- \endlua pair, but this fails:
>
> \def\startlua{\directlua0\expandafter\bgroup\detokenize\bgroup}
> \def\endlua{\egroup\egroup}
>
> \startlua
> tex.print("\\uppercase{Hallo Welt}")
> \endlua
>
> If I replace the "\endlua" with "}}", it works. I even messed around with
> \catdoc`\}=12 and things like that, but didn't succeed.
You are thinking too complicated. \detokenize requires a
brace-matched input anyway which is scanned using current catcodes, so
you gain nothing at all by circumventing premature argument scanning.
So you can just do
\long\def\startlua#1\endlua{\directlua0\expandafter{\detokenize{#1}}}
and that's it.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
More information about the dev-luatex
mailing list