4

Suppose I want to typset P\' olya correctly in TeX but suppose my computer does not have the key invoking the character/symbol ' (This is of purely theoretical interest). Now, TeX lets you use \rq to represent that symbol. Then how do I typeset the word Polya correctly using these tools?

The first command that comes to mind is \expandafter, however, both \expandafter\\lq or \expandafter\{\lq} give me errors and do not work

0

1 Answer 1

4

Since we have, in plain.tex

508 \def\lq{`} \def\rq{'}

(line number added for reference), you can just type

\csname\rq\endcsname

that will expand \rq to ' and build a control sequence token out of this.


You can't use \expandafter that way:

\expandafter\\lq

is four tokens

\expandafter•\\•l•q

(the bullet just separates tokens), so you are trying to expand l, which does nothing at all, then put the expansion after the \\ token (that in plain TeX happens to be defined); the result is

lptq

which is not very helpful. ;-)

Similarly, \expandafter\{\lq\} is four tokens

\expandafter•\{•\lq•\}

Here \lq is expanded to ' and you get

\{'\}
2
  • so csname is a primitive control sequence?
    – Kun
    Commented Apr 28, 2016 at 22:29
  • @Kun Yes, a very helpful one.
    – egreg
    Commented Apr 28, 2016 at 22:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .