0

On page 44 of The TeXbook, it says,

the “dangerous bend” sign used in this manual appears as character number 127 of font manfnt, and that font is selected by the control sequence \manual

On page 45 of TeXbook, it says,

Hence code 127 can be typed ^^?, and the dangerous bend sign can be obtained by saying {\manual^^?}. However, you must change the category code of character 127 before using it, since this character ordinarily has category 15 (invalid); say, e.g., \catcode‘\^^?=12

\font\manfnt=manfnt
\manfnt\char127
\bye

produces

enter image description here

  1. Why can it be produced? It is the character number 127, which belongs to category 15(invalid)?
\catcode`\^^?=12
{\manual^^?}
\bye

produces

! Undefined control sequence.
l.2 {\manual
            ^^?}
? 
  1. Why doesn't {\manual^^?} work?
Y. zeng
  • 1,885
  • 1
    Related: https://tex.stackexchange.com/questions/22632/how-to-load-manual-font-from-manfnt – gernot Nov 27 '23 at 08:19
  • You are misinterpreting the first quote. \manual is not defined in plain.tex, but in the code of “this manual” (in this case in ”Macros for The TeXbook” aka manmac.tex). – cabohah Nov 27 '23 at 09:01
  • BTW: \char always outputs the corresponding character of the current font. So the output of the character 127 of font manfnt is expected in your first example. – cabohah Nov 27 '23 at 09:20

1 Answers1

6

Why can it be produced? It is the character number 127, which belongs to category 15(invalid)?

catcodes control how input characters are interpreted, but there is no input character 127 here, \char127 just accesses the glyph in position 127 of the current font, so \catcode is not consulted at all.

Why doesn't {\manual^^?} work?

You are missing the definition of \manual (from manmac.tex)

enter image description here

\font\manual=manfnt % font used for the METAFONT logo, etc.

\catcode`^^?=12 {\manual^^?} \bye

David Carlisle
  • 757,742
  • Why does ^^? is related to \catcode? Does ^^ always output the symbol of ASCII? – Y. zeng Nov 27 '23 at 09:27
  • 1
    ^^? is translated very early in tex's scanner so it is just as if you had typed the character 127 so then it looks up the catcode of 127 to see what kind of token to make. – David Carlisle Nov 27 '23 at 09:38
  • Okay. When TeX looks up what category of the character 127 is, it will find it is 15, witch indicates that the character 127 belongs to category 15. But, why \char127 won't be affected by category 15? – Y. zeng Nov 27 '23 at 10:00
  • @Y.zeng as I wrote in the answer, \char is completely unrelated to any characters in the source or their catcodes. It typesets character 127 from the current font. – David Carlisle Nov 27 '23 at 10:03
  • Does ^^? typeset character 127 from the currrent font? – Y. zeng Nov 27 '23 at 10:12
  • @Y.zeng not necessarily, it acts as if you had a character 127 in the input file, normally the catcode is 15 so it does not typeset. Also you may not be typesetting, eg \message{\char97} will output \char97 on the terminal. but \message{^^61} outputs a as it is just the same as \message{a} – David Carlisle Nov 27 '23 at 10:20
  • Weird. In ^^61, 61 is smaller than 64, so add 61 with 64 and we get 125. In ASCII table, the symbol of slot 125 is }. Why does we get a? – Y. zeng Nov 27 '23 at 10:24
  • 1
    @Y.zeng no ^^ with two lowercase is the hex code, ^6 with a single uppercase is ctrl (ie shift by 64) – David Carlisle Nov 27 '23 at 10:30
  • I completely don't know what you said. May you say it more details and with more steps? – Y. zeng Nov 27 '23 at 10:39
  • 1
    @Y.zeng I was just saying same as the texbook part you quoted The |^^| notation is different from |\char|, because |^^| combinations are like single characters; for example, it would not be permissible to say |\catcode`\char127|, but |^^| symbols can even be used as letters within control words. – David Carlisle Nov 27 '23 at 10:58
  • Please see this post which is the new question I posted now. https://tex.stackexchange.com/questions/702433/what-follows-the-in-tex-hex-or-dec-or-symbol – Y. zeng Nov 27 '23 at 11:01