Hi,

I have some problems with catcode handling in lua and tex. Source of the
problem is (aside from my limited knowledge) a XML based line of text
that can contain any printable character. From this source line I create
one modified text line for the tex side (named 'textext') and one
unmodified text line for the lua side (named 'luatext').
The tex side actually prints the text and the lua side is used to
create some bitmap based background graphics.

The XSLT output is something like this (saved in a *.tex file) ...

\ctxlua{myluacode.foo{

    luatext = [[Test |%_^~$#{}±©®¶°<>&     123]],
    textext = [[Test \textbar \%\_\textcircumflex \texttilde
\$\#\textbraceleft \textbraceright \textpm \copyright \registered
¶\textdegree <>\&     123]],

...
}}

Two problems still occur. The "%"-sign in (ctx)lua (text is ignored
afterwords) and the significant spaces in the tex part (which are eaten
up when printed). I tried it with a modified catcodetable, but no
success (ugly sideeffects). So my question is:

What is the best way to

1.   deal with the "%" character in ctxlua?
2.   print significant spaces?

My current 'solution' for 2. is writing to a tex buffer instead and then
using

\bgroup\obeyspaces\getbuffer[textext]\egroup

If I try to use \obeyspaces in combination with the lua variable
'textext' I can no longer access the variable, as the variable is
indexed by a tex macro (lets call it \FOO), which then is interpreted as

  whatever.["\FOO "].textext ).

No solution for 1. yet.


As always... any help welcome :-)


Peter

___________________________________________________________________________________
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