[lltx] luacode, %

Paul Isambert zappathustra at free.fr
Tue Oct 18 15:09:39 CEST 2011


Le 18/10/2011 14:24, Patrick Gundlach a écrit :
> Hi,
>
> the documentation of luacode tells me (table on page two) that percent signs are not easy to put in the code. I don't understand that. Look at this example:
>
> \documentclass{article}
> \usepackage{luacode}
> \begin{document}
> \luadirect{
> tex.print(string.format("\%3f",43.2))
> }
> \end{document}
>
> This looks fine to me. What am I missing here?

My two cents is that here you're using "\%" (not %), which is 
\chardef'ined, so not expanded, and is passed as is to the Lua 
interpreter. Try "\luadirect{foo = 25 % 5}" and I think you'll probably 
get trouble.

Best,
Paul


More information about the lualatex-dev mailing list