ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* catcode problems (mkiv)
@ 2011-01-14 16:52 Peter Rolf
  2011-01-16  7:41 ` Taco Hoekwater
  2011-01-16 15:32 ` Hans Hagen
  0 siblings, 2 replies; 4+ messages in thread
From: Peter Rolf @ 2011-01-14 16:52 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-01-16 21:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-14 16:52 catcode problems (mkiv) Peter Rolf
2011-01-16  7:41 ` Taco Hoekwater
2011-01-16 21:17   ` Peter Rolf
2011-01-16 15:32 ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).