[Dev-luatex] Very simple sample?
Taco Hoekwater
taco at elvenkind.com
Wed Dec 6 13:07:13 CET 2006
Javier Bezos wrote:
> Hello,
>
> I'm trying to use \directlua, but until now all
> may attempts failed. I begun with:
>
> \documentclass{book}
> \begin{document}
> \directlua0{tex.print("\uppercase{hello}");}
> \end{document}
>
> and then wrapped \directlua with every combination
> possible of \texscantokens, \luaescapestring,
> \scantokens and so on, but nothing seems to work
> (no errors, but I get "uppercase" printed, perhaps
> with dashes and quotes, and of course "hello" still
> in lower case).
>
> Please, could you provide an example showing what
> I should do. Are \directlua and tex.print the right
> commands to use?
Yes, but tex interprets commands inside the \directlua
argument and on top of that lua interprets \ in strings,
so you need a way to get two backslashes in the tex.print
argument
This is the simplest solution:
\let\\\relax
\directlua0{tex.print("\\uppercase{hello}");}
But you may need something else in LaTeX, where \\
has built-in semantics.
Best, Taco
More information about the dev-luatex
mailing list