# What does \escapechar do? [duplicate]

In latex.ltx you can find several situations where \escapechar is set to -1 -- from what it's clear that it has to be a count register. But, what does it actually "count" or control? A small discussion of an example like the following could be useful too.

\def\renew@command#1{%
\begingroup \escapechar\m@ne\xdef\@gtempa{{\string#1}}\endgroup
\expandafter\@ifundefined\@gtempa
{\@latex@error{\noexpand#1undefined}\@ehc}%
\relax
\let\@ifdefinable\@rc@ifdefinable
\new@command#1}

• From TeX by Topic: \escapechar: Number of the character that is to be used for the escape character when control sequences are being converted into character tokens. IniTeX default: 92 (\). Jul 18, 2015 at 12:04
• @clemens has already given you the answer. Note, however, that \escapechare is not a \count register (or, better, a \countdef token), but an <integer parameter> (thus, a TeX primitive), listed among the others on page 273 of The TeXbook.
– GuM
Jul 18, 2015 at 12:31
• @GustavoMezzetti, thank you for pointing this out. It's indeed a difference... Jul 18, 2015 at 12:34
• @clemens, in the meantime I ran a few examples too and I think I understand now. Wanna add a short answer (involving a brief discussion how \escapechar "strips" the backslash away in the definition of \renew@command)? Jul 18, 2015 at 12:38
• see tex.stackexchange.com/questions/96620/… Martin Scharrer answer Jul 18, 2015 at 12:39