Consider the code below, which after giving me some trouble (especially with catcode 9 and 15), prints all the category codes up to catcode 15.
\documentclass{minimal}
\parindent0pt
\begin{document}
\the\catcode`\\ \ control character \\
\the\catcode`{ \ open curly\\
\the\catcode`} \ closing curly \\
\the\catcode`$ \ dollar\\
\the\catcode`& \ alignment\\
\the\catcode`\
\ space \\\the\catcode`# \ sharp\\
\the\catcode`^ \ hat \\
\the\catcode`_ \ underscore \\
\number\catcode`\ \ space \\
\catcode `\y=9
\the\catcode`\y \ ignored character \\
\the\catcode`a \ letters\\
\number\catcode`@ \ restricted \\
\number\catcode`~ \ tilde \\
\the\catcode`\% \ comment\\
\catcode`\z = 15
\the\catcode`\z \ invalid character \\
\def\test{}
%\catcode `\t=16
\ifcat\test 16 16 control sequence\fi
\end{document}
Now, getting TeX to print the catcode 16, has me puzzled. For starters if you uncomment the line, %\catcode \t=16
you get,
! Invalid code (16), should be in the range 0..15. l.23 \catcode\t=16
but, if you test with \ifcat
a control sequence is definitely equal to category code 16. So my question is, how can I coerce TeX to say sixteen for a control sequence and how come the error message says 16 is an invalid code, but the TeXbook says it is?
Mildy related question How do I get the category code of a character that is the value of a control sequence?