Why can't caret and tilde be escaped with backslash alone?
Although we commonly say that \
is the escape character, it's really the character that TeX uses to introduce a control sequence. There are two types of control sequences. Control words consist of \
plus a string of letters. Control symbols consist of \
plus a single non-letter.
But in neither case is \
acting as an escape per se. Each of the characters you think of as being "escaped" are really control symbols which all have actual definitions. Some simply expand to their corresponding character, but others do not. Here are their actual definitions:
*\show\#
> \#=\char"23.
*\show\$
> \$=\char"24.
*\show\%
> \%=\char"25.
*\show\&
> \&=\char"26.
*\show\{
> \{=macro:
->\delimiter "4266308 .
*\show\}
> \}=macro:
->\delimiter "5267309 .
*\show\^
> \^=macro:
#1->{\accent 94 #1}.
*\show\'
> \'=macro:
#1->{\accent 19 #1}.
*\show\~
> \~=macro:
#1->{\accent "7E #1}.
Notice that in the case of \^
, \~
, and \'
the macro definitions take an argument. So they will take their next character as that argument. If you don't want that to happen, you need to explicitly stop it with the {}
.
To answer your second question, \^{}
is not identical to \^\
since the latter will insert a space but the former will not. So for example:
\^\ foo \^{}foo
will yield the following output:
Alan has explained why \^
takes an argument but note also that
latex has \textbackslash
, \textasciicircum
and \textasciitilde
to generate \ ^ ~
In the case of the original OT1 encoding \textasciicircum
and \textasciitilde
are in fact the same as \^{}
and \~{}
that is put an accent over an empty base, and \backslash
takes a \
from the math symbol font as the OT1 encoding does not contain these characters.
However if you use T1 (or any normal encoding that does have \
, ^
and ~
characters) then \textasciicircum
and \textasciitilde
will use the characters from the font in those positions, which are normally larger and lower than the accents, and \backslash
will use a \
from the current font.