13

When redefining a category code of accessing a character in Plain-TeX style a backtick is present

\catcode`\"=\active
\char`\\

What is used for? Is it used in another situations?

12

backtick followed by a character or single-character command name is one of the tex syntaxes for a number. It is the character code of the character

\catcode`\"=\active
\catcode"22=\active
\catcode34=\active
\catcode'42=\active

are all the same thing with the number 34 being entered as the character code of ", in hex, in decimal and in octal.

This syntax can be used anywhere tex is looking for a number, not specifically for catcodes.

  • Is backtick an active character? – Michael Fraiman Dec 5 '17 at 8:19
  • @MichaelFraiman Usually it isn't. – egreg Dec 5 '17 at 8:23
  • @egreg which category code does it have then? – Michael Fraiman Dec 5 '17 at 8:28
  • @MichaelFraiman It has catcode 12; with another category code, it would be invalid for syntax such as \catcode`\_=12 – egreg Dec 5 '17 at 8:32
  • 3
    @MichaelFraiman The specialness of ` does not come just from its category code (as with many other “special” characters), but instead the TeX routines that look for a number are hard-coded to do special stuff after a ` token of category code 12. This is similar to the " before hexadecimal constants, the ' before octal constants, and even the decimal point (.) inside constants. So you cannot just give another character the special role that ` has. – ShreevatsaR Dec 5 '17 at 8:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.