Am 25.01.2011 um 09:00 schrieb Procházka Lukáš Ing. - Pontex s. r. o.:
Thank you, Wolfgang, this works better.
Actually I need to use '%' in the condition and that fails:
--- ... \startrawsetups layer % The value of 'n' is used here to set the appropriate background, % = n-th page of a PDF, and also to draw a filled rectangle on % the left or right side (depending on whether n is even or odd)
% The code bellow fails
\startluacode print("N=", n)
if n % 2 == 1 then
else
end \stopluacode \stoprawsetups ... ---
with:
--- ! LuaTeX error <main ctx instance>:1: 'then' expected near 'else'. ---
So like '%' was still treated as TeX comment char.
How to enable '%'?
You can’t use % in the luacode environment when you write it inside of another environment because TeX can change the meaning of % but this should works (untested): \startbuffer[lualayer] % … \startluacode … \stopluacode \stopbuffer \doifmode{foo}{\ctxluabuffer[lualayer]} Wolfgang