4

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

0

Browse other questions tagged or ask your own question.