The following works outside xmlsetups but not inside it.
It seems to bolt on the % with:
! LuaTeX error <main ctx instance>:1: ')' expected near '<eof>'.
<inserted text> ....pitex.print("pi = " .. (x - x}
This in spite of the wiki telling me:
To circumvent this problem, ConTeXt defines a environment called
\startluacode ... \stopluacode. This sets the catcodes to what one
would expect in lua. Basically only \ has its usual TeX meaning, the
catcode of everything else is set to other. So, for all practical
purposes, we can forget about catcodes inside \startluacode ...
\stopluacode.
The code is:
\startxmlsetups xml:mycommand
\startluacode
local x = math.pi
tex.print("pi = " .. (x - x\%0.01))
\stopluacode
\stopxmlsetups
When I try to escape the % with \% the result is no better:
! LuaTeX error <main ctx instance>:1: ')' expected near '\'.
<inserted text> ...rint("pi = " .. (x - x\%0.01))}
Is it not possible to directly use Lua inside these setups? If do, why
the nonconforming behaviour?
Hans van der Meer
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : [email protected] / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________