How to use quotation marks in math mode? I need to get \lim
with the quation marks above.
3 Answers
If you use "
, these are no different in text mode, or math mode in terms of how you use them, although the spacing is a slightly different. However, as Mico pointed out is you use the recommended approach of ``...''
to obtain the double quotes, then this needs special handing inside math mode.
If you desire single quotes you can use the solution from How to get the closing single quote in math mode:
If possible you should put the quotes outside of math mode.
Code:
\documentclass{article}
\usepackage{amsmath}
\DeclareMathSymbol{\mlq}{\mathord}{operators}{``}
\DeclareMathSymbol{\mrq}{\mathord}{operators}{`'}
\begin{document}
\textbf{Text mode:}\par
``abc'' \qquad\qquad\quad `abc'
\bigskip
\textbf{Inline Math:}\par
$``\lim_{x \to 0} f(x)"$ \quad $\mlq\lim_{x \to 0} f(x)\mrq$
``$\lim_{x \to 0} f(x)$'' ~\quad `$\lim_{x \to 0} f(x)$'
\bigskip
\textbf{Display Math:}
\[
``\lim_{x \to 0} f(x)" \qquad \mlq\lim_{x \to 0} f(x)\mrq
\]
%
\[
\text{``$\lim_{x \to 0} f(x)$''} \qquad \mlq\lim_{x \to 0} f(x)\mrq
\]
\end{document}
-
-
@IanThompson: Good point, have updated the solution for single quotes. Commented Jul 16, 2012 at 18:12
-
2It might be good to point out explicitly that whereas one can get away with using
"
for closing double quotes inside math mode, this is not the case for the usually-recommended way of inserting double closing quotes (''
). The latter method will give a double-prime symbol when encountered in math mode. To display items encased in single or double quotes while in math mode, it may be best to encase the item in question in\text{``$...$''}. Doing so will also circumvent problems with inconsistent spacing caused by whether the quotes occur before or after the math-mode switch
$`.– MicoCommented Jul 16, 2012 at 18:42 -
1
My solution of choice
\newcommand{\menquote}[1]{\ensuremath{\text{\textquotedbl} #1 \text{\textquotedbl}}}
using the amsmath
package.
-
-
2
\text
is already math mode aware. I'd avoid a command that is good in math mode and text mode, because it's ambiguous. I'd add\normalfont
inside\text
, anyway.– egregCommented May 4, 2014 at 21:55 -
I would suggest an alternative solution with dirtytalk package:
\documentclass{article}
\usepackage{amsmath}
\usepackage{dirtytalk}
\begin{document}
\textbf{Text mode:}\par
\say{abc}
\bigskip
\textbf{Display Math:}
\[
\text{\say{$\lim_{x \to 0} f(x)$}} \qquad p(\text{\say{cat}}|\text{\say{Very cute}})
\]
\end{document}
It may be a useful solution if you have to mix math equations and conditional probabilities of words ;)
\lim
is an operator that already takes a subscript (or superscript).“\text{$"$}
(just using“"
will produce weird spacing with the closing marks). If you came looking for a way of typing ind- and pro-objects à la Deligne, p. 7, § 2, you may type\underset{\longrightarrow}{“\mathrm{lim}\text{$"$}}
.