I want to create formulae where the \rightarrow
is enclosed in double quotation marks and appears like any other word in a formula. What I'm getting instead, are formulae where these quotation marks are drawn to adjacent words, leaving a gap between the quotation marks and the \rightarrow
.
Example: I'm getting Some'' -> ''Word
. I want Some ''->'' Word
.
The sequence ''->''
should be treated the same as Some
or Word
.
The ->
(\rightarrow
) should be rendered as if it were used in an arbitrary math-environment.
I have looked at this answer, but I could not turn that into something useful, as my MWE will show.
Also, I do not wish to break up my math environment, since the quotation marks are part of the formulae.
\documentclass{standalone}
\usepackage{varwidth}
\usepackage{amsmath}
\DeclareMathSymbol{\mlq}{\mathord}{operators}{``}
\DeclareMathSymbol{\mrq}{\mathord}{operators}{`'}
\begin{document}
\begin{varwidth}{\linewidth}
$Op \mapsto Op ``\rightarrow'' Op$%large gap on left; ' treated as prime
$Op \mapsto Op {``\rightarrow''} Op$%large gap on left; ' treated as prime
$Op \mapsto Op \mlq\rightarrow\mrq Op$%large gaps on left & right
$Op \mapsto Op {\mlq\rightarrow\mrq} Op$%large gaps on left & right
Quotation marks close\\
to arrow: ``$\rightarrow$''
\end{varwidth}
\end{document}
Best Answer
Declare
\mlq
and so on as\mathrel
, because TeX doesn't add space between consecutive relation symbols:If you need quotes around other symbols, you can follow a different path; declare the quotes as ordinary symbols (with
\mathord
) and defineso you can have something like
without worrying about spacings.