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

* Re: catcode problems (mkiv)
  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
  1 sibling, 1 reply; 4+ messages in thread
From: Taco Hoekwater @ 2011-01-16  7:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 01/14/2011 05:52 PM, Peter Rolf wrote:
>
> What is the best way to
>
> 1.   deal with the "%" character in ctxlua?

Use \startluacode .... \stopluacode  instead of 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

Significant spaces are always nasty. You could convert them to "~"
(of course then it does not break across lines) or "\ ".

Best wishes,
Taco
___________________________________________________________________________________
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

* Re: catcode problems (mkiv)
  2011-01-14 16:52 catcode problems (mkiv) Peter Rolf
  2011-01-16  7:41 ` Taco Hoekwater
@ 2011-01-16 15:32 ` Hans Hagen
  1 sibling, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2011-01-16 15:32 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 14-1-2011 5:52, Peter Rolf wrote:

> problem is (aside from my limited knowledge) a XML based line of text

then process the line at the lua end where % is stil % and a space a space

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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

* Re: catcode problems (mkiv)
  2011-01-16  7:41 ` Taco Hoekwater
@ 2011-01-16 21:17   ` Peter Rolf
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Rolf @ 2011-01-16 21:17 UTC (permalink / raw)
  To: Taco Hoekwater; +Cc: mailing list for ConTeXt users

Thank you Taco and Hans! \startluacode works fine :-)

Am 16.01.2011 08:41, schrieb Taco Hoekwater:
> On 01/14/2011 05:52 PM, Peter Rolf wrote:
>>
>> What is the best way to
>>
>> 1.   deal with the "%" character in ctxlua?
> 
> Use \startluacode .... \stopluacode  instead of 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
> 
> Significant spaces are always nasty. You could convert them to "~"
> (of course then it does not break across lines) or "\ ".
> 
> Best wishes,
> Taco
> 

___________________________________________________________________________________
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).