7

I'm using the \enquote command from the csquotes package for setting quotes.

When I invoke quotations inside math mode,
either by hand

``<some math>''

or by enquote

\enquote{<some math>}

it renders differently than in text mode.

Here's an example:

Quotes Math Mode

Can someone explain why this behavior occurs?

For adjusting the quotation marks by hand, I found this workaround by egreg.

How can I adjust the quotation marks invoked by enquote in math mode?

Here's a MWE, the one from above:

\documentclass[preview]{standalone}
\usepackage{csquotes}
\begin{document}
In text mode:\\
Quote by hand: ``Blub''\\
Quote by enquote: \enquote{Blub}

In math mode:\\
Quote by hand: $``a^2+b^2=c^2''$\\
Quote by enquote: $\enquote{a^2+b^2=c^2}$
\end{document}
  • \enquote{$formula$} rather than $\enquote{formula}$, unless your quotes are part of the math. Are they? – egreg Dec 12 '18 at 17:29
  • Problem is I have it as something like $\ldots \enquote{\ldots} \ldots$. Do you have an idea what to do? – C-star-W-star Dec 12 '18 at 17:30

2 Answers2

8

LaTeX issues one error and two warnings:

! Double superscript.
<recently read> ^

l.13 Quote by hand: $``a^2+b^2=c^2'
                                   '$
? 

LaTeX Warning: Command \textquotedblleft invalid in math mode on input line 15.

LaTeX Warning: Command \textquotedblright invalid in math mode on input line 15

Such errors and warnings should not be disregarded; it's a perhaps sad truth that \textquotedblleft in math mode produces a backslash, whereas \textquotedblright actually produces a closing double quote.

The error is because ' in math mode is interpreted as ^{\prime}, so c^2' indeed has a double superscript (the converse c'^2 is instead legal, as is c''^2).

If you want to quote something in math mode, you should use math symbols.

\documentclass{article}

\DeclareMathSymbol{\mlq}{\mathord}{operators}{'134}
\DeclareMathSymbol{\mrq}{\mathord}{operators}{'42}

\begin{document}

$\dots\mlq\dots\mrq\dots$

\end{document}

enter image description here

egreg
  • 1,121,712
  • Wow, true that, it issues those warnings, completely didn't notice them, thanks! (Have it running in command prompt as -interaction=batchmode with -file-line-error only and checking for warnings only on an ad-hoc basis.) – C-star-W-star Dec 12 '18 at 17:48
  • Thanks, the integration worked perfectly with your solution and defining \newcommand{\mathenquote}[1]{\mlq #1\mrq}. Thanks a lot!! – C-star-W-star Dec 12 '18 at 17:57
1

You have answered yourself: the quotes should be in the text mode:

\documentclass[preview]{standalone}
\usepackage{csquotes}
\begin{document}
In text mode:\\
Quote by hand: ``Blub''\\
Quote by enquote: \enquote{Blub}

In math mode:\\
%Quote by hand: $``a^2+b^2=c^2''$\\
Quote by hand: ``$a^2+b^2=c^2$''\\

%Quote by enquote: $\enquote{a^2+b^2=c^2}$
Quote by enquote: \enquote{$a^2+b^2=c^2$}
\end{document}

enter image description here