I read some macros of manmac.tex
, when I read this code snippet
% (now Appendix E resumes again)
% macros for verbatim scanning
\chardef\other=12
\def\ttverbatim{\begingroup
\catcode`\\=\other
\catcode`\{=\other
\catcode`\}=\other
\catcode`\$=\other
\catcode`\&=\other
\catcode`\#=\other
\catcode`\%=\other
\catcode`\~=\other
\catcode`\_=\other
\catcode`\^=\other
\obeyspaces \obeylines \tt}
\outer\def\begintt{$$\let\par=\endgraf \ttverbatim \parskip=\z@
\catcode`\|=0 \rightskip-5pc \ttfinish}
{\catcode`\|=0 |catcode`|\=\other % | is temporary escape character
|obeylines % end of line is active
|gdef|ttfinish#1^^M#2\endtt{#1|vbox{#2}|endgroup$$}}
In definition of \begintt
, the catcode of \
is changed to 12 by \ttverbatim
, then comes a sequence of macros \parskip=\z@ \catcode`\|=0 \rightskip-5pc \ttfinish
. In order to describe my question clearly, I extracted the author's idea in the following code snippet:
\def\x{x}
\def\myverbatim{\begingroup\catcode`\\=12 \tt \x }
{\catcode`\^^@=0 ^^@myverbatim ^^@endgroup}
this output is x
. What makes me feel confused is that, since the catcode of \
is changed from 0 to 12, why the following input text \tt \x
can still be analyzed into control sequence tokens? The output that I expect is \tt \x
.
\def\listing
part\listing
in Appendix D: Dirty Tricks. Let me read it now. But is that part really relevant to this question?