[texhax] Some puzzling TeX
uwe.lueck at web.de
Tue Feb 22 14:09:06 CET 2011
"Donald Arseneau" <asnd at triumf.ca> wrote 22.02.2011 13:24:54:
>"Uwe Lueck" writes:
>> >On Sun, Feb 20, 2011 at 8:13 AM, Uwe Lueck wrote:
>> >> I am unable to get a catcode of \relax or \bgroup by \showthe\catcode.
> This betrays a subtle misunderstanding. There is no catcode of
> \relax; only character tokens have category codes.
> However \catcode does not tell the category of a character token!
> It only reports contents of the look-up table TeX uses to interpret
> raw characters as they are input (or as they are re-scanned, in eTeX).
> This has to be so since the argument for \catcode is a number, not
> a token!
Indeed just missed TeXbook p. 271: \catcode expects "8-bit number".
I wonder at this point how this is with XeTeX and LuaTeX ...
and cannot afford right now browsing their documentations ...
> Therefore the concept of "get a catcode of" some token, any token,
> by \showthe\catcode is without hope.
> TeX provides no way to report the category code for a token except
> by a deeply nested series of \ifcat comparisons.
>> > Whew... so, it looks like this myth of "control sequences have
>> > catcode 16" can finally be put to rest. The catcode of a control
>> > sequence is, in fact, 0. But since there's no way to ever get a naked
>> > escape token (catcode 0) into the input stream, the fact that it has
>> > the same catcode is irrelevant.
It should be clear that this was Steve Hicks' conclusion of his analysis.
> Interesting. I wonder why DEK says 16 then. Laziness? Simplicity
> (avoid explaining why 0 is safe)? Forgetfulness?
More information about the texhax