I can escape some special characters with a backslash.

\# \$ \% \& \_ \{ \}

But why can't I escape ^ and ~ with a backslash alone? For example, the code below does not work.


It causes the following error with texlive.

$ pdflatex foo.tex 
This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2015/dev/Debian) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
LaTeX2e <2014/05/01>
Babel <3.9l> and hyphenation patterns for 2 languages loaded.
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo)) (./foo.aux)
! Missing \endcsname inserted.
<to be read again> 
l.4 \end
! Emergency stop.
<to be read again> 
l.4 \end
!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on foo.log.

In fact, I have to first escape with them a backslash and then add {} as a suffix to them to make it work.


I understand that {}, i.e. the empty parameter list, forces TeX to consider it as the end of a command and beginning of text again, but I want to understand why {} is necessary.

Two questions:

  1. Why can't these characters be escaped with \ alone?
  2. Is there any difference between \^{} and \^\? They seem to give the same output but I want to know if there is any difference between them that might product different results under any circumstances?
  • 7
    Well because \^ is used to get the circumflex accent, e.g. \^e or \^{e} for ê and, again, \~ is for the tilde diacritic, as in \~{n} for ñ. In any case \^{} will give you the pure accent, it's like using a dead key on an old typewriter and then hitting the space. It may be better to use other ways to produce the ^ and the ~ – Au101 Jun 6 '16 at 1:46
  • Notice also that there is \sim and there is \wedge. – Michael Hardy Jun 6 '16 at 4:04
  • You can do \string^ and \string~. – Manuel Jun 6 '16 at 7:02
up vote 32 down vote accepted

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:

> \#=\char"23.

> \$=\char"24.

> \%=\char"25.

> \&=\char"26.

> \{=macro:
->\delimiter "4266308 .

> \}=macro:
->\delimiter "5267309 .

> \^=macro:
#1->{\accent 94 #1}.

> \'=macro:
#1->{\accent 19 #1}.

> \~=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:

output of fragment

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.

  • ascii with two i's? – Torbjørn T. Jun 6 '16 at 6:55
  • 1
    @TorbjørnT. you have edit rights:-) thanks, I'll fix – David Carlisle Jun 6 '16 at 7:03

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.