4

This question already has an answer here:

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}

marked as duplicate by Mico, Community Jul 18 '15 at 13:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    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 (\). – clemens Jul 18 '15 at 12:04
  • 1
    @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 '15 at 12:31
  • @GustavoMezzetti, thank you for pointing this out. It's indeed a difference... – Ruben Jul 18 '15 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)? – Ruben Jul 18 '15 at 12:38
  • 1
    see tex.stackexchange.com/questions/96620/… Martin Scharrer answer – touhami Jul 18 '15 at 12:39