\textbackslash
is just for typesetting. As the name says, it's a text command, so it just prints the character \
from the current font, and isn't of any use for anything other than that.
You are looking for:
\catcode`\\=12
The syntax for the \catcode
primitive is \catcode<number>=<catcode>
, and it sets the catcode of the character whose ASCII code is <number>
to <catcode>
. This means that you could also use:
\catcode 92=12
However it's a mouthful to remember all the ASCII codes, and your code becomes quite a lot less readable. To improve on that TeX allows you to specify a number using an “alphabetic constant”. To do that, the <number>
should start with a `
, followed by the character token you want to make a number of. Valid alphabetic constants are `a
, `*
, etc.
The only problem is that a catcode-0 character (here the backslash) doesn't produce a token, so neither:
\catcode`\=12
\catcode`\ =12
do what you want (the first one changes the catcode of =
, and the second the catcode of
). To specify these characters, TeX allows you to escape the character with a backslash, so to specify the alphabeitc constant `\
you prefix it with another backslash: `\\
, so:
\catcode`\\=12