[luatex] % character in \directlua

Wolfgang Schuster schuster.wolfgang at googlemail.com
Sat Feb 19 11:41:41 CET 2011

Am 19.02.2011 um 01:10 schrieb Yannis Haralambous:

> Hi everybody, and sorry for my mailer: it gives me only two choices, either "text" (my current choice, believe it or not) or "rtf".
> I'm writing to ask whether there is a more elegant way to use a % in a \directlua argument (I need the Lua modulo operator)
> besides changing the catcode of % to 12 around the \directlua command:
> \begingroup
> \catcode`\%=12
> \directlua{texio.write(5 % 2)}
> \endgroup
> I have tried \%, \string%, nothing works besides the code above.

As plain TeX user you can write your own command:





ConTeXt already provides a command with the name \ctxluacode which does the same.


More information about the luatex mailing list