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

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 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
___________________________________________________________________________________

Reply via email to