[luatex] Catcode table 0.

Paul Isambert zappathustra at free.fr
Sun Sep 25 10:41:57 CEST 2011


Le 25/09/2011 10:06, Joseph Wright a écrit :
> On 25/09/2011 08:13, Paul Isambert wrote:
>> Hello all,
>>
>> The manual says catcode table 0 is initialized by INITEX. So you'd think
>> it holds INITEX catcodes. But actually it does absolutely nothing when
>> called:
>>
>> \catcode`\$=14
>> \catcodetable0
>> \immediate\write17{\the\catcode`\$}% Prints 14.
>> \bye
>>
>> Is that normal? I.e. is table 0 a noop on purpose?
>>
>> Best,
>> Paul
>>
> Catcode table 0 holds the _current_ catcodes when the document starts:
> it's never been saved using \savecatcodetable. You can't save the table
> to itself, so the usual set up is to ave the IniTeX values to some other
> table, then use a stack to switch out table 0 to the IniTeX one to 'do
> stuff', then back again when the job is done. See for example Heiko
> Oberdiek's 'luatex' package.

Thank you Joseph.
Indeed table 0 holds the document in force at the beginning of the 
document. What confused me was actually something else, which I now see 
as a real bug: when switching to a new table and then back to the 
previous one, the latter seems to save the catcode changed while it was 
active:

%%%
\savecatcodetable1 \savecatcodetable2

% Prints 3, fine:
\catcodetable1
\immediate\write17{\the\catcode`\$}

% Prints 14, fine:
\catcode`\$=14
\immediate\write17{\the\catcode`\$}

% Prints 3, fine:
\catcodetable2
\immediate\write17{\the\catcode`\$}

%Prints 14, not so fine:
\catcodetable1
\immediate\write17{\the\catcode`\$}

\bye
%%%

Ah, but this really gives me a headache, so I'd better get some input 
here again before filing a bug report. I might have overlooked something.

Best,
Paul


More information about the luatex mailing list