ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Catcode tables
@ 2008-12-29 17:41 Wolfgang Schuster
  2008-12-29 22:03 ` Aditya Mahajan
  0 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Schuster @ 2008-12-29 17:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

can you fix the catcode related macros in syst-cat.mkiv, the macros
did not work because a few macros are not define like \savecatcodetable
and a few other are only defined in the MkII part like \catcodetable.

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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Catcode tables
  2008-12-29 17:41 Catcode tables Wolfgang Schuster
@ 2008-12-29 22:03 ` Aditya Mahajan
  2008-12-29 23:19   ` Wolfgang Schuster
  0 siblings, 1 reply; 6+ messages in thread
From: Aditya Mahajan @ 2008-12-29 22:03 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Mon, 29 Dec 2008, Wolfgang Schuster wrote:

> Hi,
>
> can you fix the catcode related macros in syst-cat.mkiv, the macros
> did not work because a few macros are not define like \savecatcodetable
> and a few other are only defined in the MkII part like \catcodetable.

Aren't \savecatcodetable and \catcodetable luatex primitives?

Aditya
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Catcode tables
  2008-12-29 22:03 ` Aditya Mahajan
@ 2008-12-29 23:19   ` Wolfgang Schuster
  2009-01-11 19:59     ` Wolfgang Schuster
  0 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Schuster @ 2008-12-29 23:19 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 29.12.2008 um 23:03 schrieb Aditya Mahajan:

>> can you fix the catcode related macros in syst-cat.mkiv, the macros
>> did not work because a few macros are not define like  
>> \savecatcodetable
>> and a few other are only defined in the MkII part like \catcodetable.
>
> Aren't \savecatcodetable and \catcodetable luatex primitives?

You're right, this helped me to find the problematic parts in the MkII
and MkIV macros. I was able to make a working example where I commented
the problematic parts.

I hope this helps Hans to fix it and thank you for the hint.

\startmode[mkiv]

\long\def\startcatcodetable#1#2\stopcatcodetable
   {\bgroup
    %\catcodetable\scratchcatcodetable
    \the\setdefaultcatcodes
    #2%
    \savecatcodetable#1\relax
    \egroup}

\stopmode

\startmode[mkii]

\def\catcodetable#1%
   {\mathchardef\currentcatcodetable#1%
    %\the\setdefaultlowercatcodes
    %\ifrecatcodeuppercharacters\the\setdefaultuppercatcodes\fi
    \the\csname @@cct:\number#1\endcsname}

\stopmode

\newcatcodetable \mycatcodetable

\startcatcodetable \mycatcodetable
     \catcode`\$ = 12
     \catcode`\& = 12
     \catcode`\% = 12
\stopcatcodetable

\def\normaltext
   {\pushcatcodetable
    \setcatcodetable\mycatcodetable
    \donormaltext}

\def\donormaltext#1%
   {#1%
    \popcatcodetable}

\starttext
\normaltext{Procter & Gamble's stock climbed to $2, a 10% gain.}
\stoptext

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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Catcode tables
  2008-12-29 23:19   ` Wolfgang Schuster
@ 2009-01-11 19:59     ` Wolfgang Schuster
  2009-01-12  9:39       ` Taco Hoekwater
  0 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Schuster @ 2009-01-11 19:59 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Hans,

is there no a fix availabe for this problem.

Wolfgang

> Am 29.12.2008 um 23:03 schrieb Aditya Mahajan:
>
>>> can you fix the catcode related macros in syst-cat.mkiv, the macros
>>> did not work because a few macros are not define like  
>>> \savecatcodetable
>>> and a few other are only defined in the MkII part like  
>>> \catcodetable.
>>
>> Aren't \savecatcodetable and \catcodetable luatex primitives?
>
> You're right, this helped me to find the problematic parts in the MkII
> and MkIV macros. I was able to make a working example where I  
> commented
> the problematic parts.
>
> I hope this helps Hans to fix it and thank you for the hint.
>
> \startmode[mkiv]
>
> \long\def\startcatcodetable#1#2\stopcatcodetable
>  {\bgroup
>   %\catcodetable\scratchcatcodetable
>   \the\setdefaultcatcodes
>   #2%
>   \savecatcodetable#1\relax
>   \egroup}
>
> \stopmode
>
> \startmode[mkii]
>
> \def\catcodetable#1%
>  {\mathchardef\currentcatcodetable#1%
>   %\the\setdefaultlowercatcodes
>   %\ifrecatcodeuppercharacters\the\setdefaultuppercatcodes\fi
>   \the\csname @@cct:\number#1\endcsname}
>
> \stopmode
>
> \newcatcodetable \mycatcodetable
>
> \startcatcodetable \mycatcodetable
>    \catcode`\$ = 12
>    \catcode`\& = 12
>    \catcode`\% = 12
> \stopcatcodetable
>
> \def\normaltext
>  {\pushcatcodetable
>   \setcatcodetable\mycatcodetable
>   \donormaltext}
>
> \def\donormaltext#1%
>  {#1%
>   \popcatcodetable}
>
> \starttext
> \normaltext{Procter & Gamble's stock climbed to $2, a 10% gain.}
> \stoptext
>
> 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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Catcode tables
  2009-01-11 19:59     ` Wolfgang Schuster
@ 2009-01-12  9:39       ` Taco Hoekwater
  2009-01-13 16:18         ` Wolfgang Schuster
  0 siblings, 1 reply; 6+ messages in thread
From: Taco Hoekwater @ 2009-01-12  9:39 UTC (permalink / raw)
  To: mailing list for ConTeXt users



Wolfgang Schuster wrote:
> Hi Hans,
> 
> is there no a fix availabe for this problem.

The example text is flawed in itself: \newcatcodetable gives you an
empty table, and \startcatcodetable upgrades that to 'initex' level
itself. But initex *does not* set the catcodes of { and }. Nor
does it set the catcode of $, & and %, so the catcode assignments
that are needed are not there, and the ones that are there are
superfluous.

  \startcatcodetable \mycatcodetable
    \catcode`\{ = 1
    \catcode`\} = 2
  \stopcatcodetable

is enough.

Best wishes,
Taco
PS sorry, I missed this message the first time around.


___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Catcode tables
  2009-01-12  9:39       ` Taco Hoekwater
@ 2009-01-13 16:18         ` Wolfgang Schuster
  0 siblings, 0 replies; 6+ messages in thread
From: Wolfgang Schuster @ 2009-01-13 16:18 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 12.01.2009 um 10:39 schrieb Taco Hoekwater:

> The example text is flawed in itself: \newcatcodetable gives you an
> empty table, and \startcatcodetable upgrades that to 'initex' level
> itself. But initex *does not* set the catcodes of { and }. Nor
> does it set the catcode of $, & and %, so the catcode assignments
> that are needed are not there, and the ones that are there are
> superfluous.
>
>  \startcatcodetable \mycatcodetable
>    \catcode`\{ = 1
>    \catcode`\} = 2
>  \stopcatcodetable
>
> is enough.


No in a real macro, here is a problem I posted a long time ago where
I was now able to replace my low level catcodes changes with catcode
tables, I hope this will help other users if they have the same problem.

\unprotect

\newcatcodetable \diacatcodes

\startcatcodetable \diacatcodes
     \catcode`\^^M =  5
     \catcode`\    = 10
     \catcode`\\   =  0
     \catcode`\{   =  1
     \catcode`\}   =  2
     \catcode`\%   = 11
     \catcode`\!   = 11
     \catcode`\?   = 11
\stopcatcodetable

\def\????ax{@@@@ax}

\def\setupaxis
  {\pushcatcodetable
   \setcatcodetable\diacatcodes
   \dodoubleargument\dosetupaxis}

\def\dosetupaxis[#1][#2]%
  {\def\docommand##1{\getparameters[\????ax##1][#2]}%
   \popcatcodetable
   \processcommalist[#1]\docommand}

\setupaxis
  [\c!x,\c!y]
  [\c!format=%d]

\protect

\starttext
\getvalue{@@@@axxformat}
\stoptext

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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2009-01-13 16:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-29 17:41 Catcode tables Wolfgang Schuster
2008-12-29 22:03 ` Aditya Mahajan
2008-12-29 23:19   ` Wolfgang Schuster
2009-01-11 19:59     ` Wolfgang Schuster
2009-01-12  9:39       ` Taco Hoekwater
2009-01-13 16:18         ` Wolfgang Schuster

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