0

I'm trying to define "#1" as \text{#1} in math mode.

This worked:

\catcode`` = 13
\def``#1``{\text{#1}}

But if replace `` with ", it fails. I don't understand why. Is it possible to define " in this way ? And it possible to let this only work this way in math mode ?

Kasper
  • 911
  • 1
    Already answered here: http://tex.stackexchange.com/questions/38008/using-simple-quotes-instead-of-text

    thanks @egreg

    – Kasper Nov 07 '13 at 04:00

1 Answers1

1

Oh! You have a definition with a structure. Let us modify a bit your example:

\documentclass{article}

\begin{document}

\catcode`" = 13 \def"#1"{A{#1}}

"B"

\def"#1{C{#1}}

"B"D

\end{document}

The result is enter image description here

In fact " is defined as an active character. In the first definition additional " must appear after the parameter. In the similar way you made single quote active and then defined it in such a way that a parameter must be betwen a single quote and twice a single quote. Be aware: you are in troubles.