Message from discussion plainTeX newb: troubles with \catcode ... why doesn't this work?
Received: by 10.216.241.9 with SMTP id f9mr915145wer.5.1344414952192;
Wed, 08 Aug 2012 01:35:52 -0700 (PDT)
From: Ulrich D i e z <eu_angel...@web.de>
Subject: Re: plainTeX newb: troubles with \catcode ... why doesn't this work?
Date: Wed, 8 Aug 2012 09:33:58 +0200
X-Trace: news.albasani.net k93r1naMkK5Ho7n6Dhe6f1iwz+6W5TUKSvtNrmV8vvLu+7gD6vsaQyzlyOAjfNCyj9pyeBQzLijffwSaKM2vaQ==
NNTP-Posting-Date: Wed, 8 Aug 2012 08:35:51 +0000 (UTC)
Injection-Info: news.albasani.net; logging-data="5xiDxW5tp/GthhGvXwTaW+I9n8fthOhQ1yx+ralXL2UTYq5ahGcmbZp3Dq8f+/zZ7BYFwB0Li3oNKGfbNu6aZE+fL0jjWzoLFh2TPLo8ui/Pf5vM+hO7Lk6X3UaMXnJV"; mail-complaints-to="ab...@albasani.net"
> eds <edstuck...@gmail.com> a Ã©crit:
>> In attempting this macro, I found that I'm also not clear on the
>> differences between `\^^M and ^^M. If possible, can someone educate
>> me on the difference?
>^^M is a character like any other; `\^^M is an example of the `\<char>
>construction used to denote a character code.
^^M is a character-token.
\^^M is a control-sequence-token whose name consists of only
one character, the ^^M-character (ASCII13=Return).
[ Whether that one-letter-control-sequence-token is to be
considered a control-word or a control-symbol depends on
the current catcode of the ^^M-character. If it is 11, then
\^^M is a control-word, otherwise it is a control-symbol.
When reading/tokenizing, then usually spaces behind
control-words are ignored, spaces behind control-symbols
are not ignored.
When unexpanded-writing to console or external file, then
usually a trailing space is attached to a control-word but
is not attached to a control-symbol.]
You can use both single character-tokens and
one-letter-control-sequence-tokens for denoting the
alphabetic-constant of a number while with numbers
the alphabetic-constant-notation is always introduced
by a leading ` .
\number65 (decimal digit notation)
\number`A (alphabetic constant by means of character)
\number`\A (alphabetic constant by means of one letter control-sequence)
In expansion-contexts (e.g., \edef) you need to take care of
expandable control-sequences and expandable
active-characters not getting expanded in a way which
later affects the resuling numeral-value.
In your special case I suggest:
By the way:
does not work because at reading/tokenizing-time
the first ^^M will be recognized as a character (not a token yet)
of catcode 5 (end of line), not as a control-sequence.
A crucial point in this case is that in any case TeX throws away
any other information that remain on the current line when
it encounters such an end of line character. In this case
anything behind the first ^^M will be dropped yielding that
the definition of \restoreCRCC is not complete.
Another crucial point in this case is that characters of
catcode 5 either yield space-tokens or character-tokens
or are simply dropped depending on the status of TeX'
In the following case you get a space-token for the first ^^M
as TeX is in state M (mid-line) at the time of tokenizing that ^^M: