7

Suppose I use ' as active character to insert another symbol:

{\tt A'C B}

\def\adef#1{\catcode`#1=13 \begingroup \lccode`\~=`#1\lowercase{\endgroup\def~}}
\let\oldtt\tt\def\tt{\adef'{\char"0D}\oldtt}

{\tt A'C B}

{\tt A'c B}
\bye

Log file contains this:

Missing character: There is no ^^dc in font cmtt10!

Why in the second case the result is not A'C B, although the third case works as expected?

Igor Liferenko
  • 7,063
  • 2
  • 14
  • 47

1 Answers1

4

This is due to not having a space in the definition of the active ':

\adef'{\char"0D}

should be

\adef'{\char"0D }

so TeX will know where the constant terminates (and the space will be gobbled by TeX rule).

In the first case, TeX is presented with

'C

that becomes

\char"0DC

and TeX duly looks for character number "DC (which of course doesn't exist in a seven bit font).

In the second case the input stream is

\char"0Dc

and, since c is not legal in an hexadecimal number, according to the syntax rules, the found number is "0D that's what is wanted.

Always leave a space after a required constant.

egreg
  • 1,121,712