6

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}
2
  • \enquote{$formula$} rather than $\enquote{formula}$, unless your quotes are part of the math. Are they?
    – egreg
    Dec 12, 2018 at 17:29
  • Problem is I have it as something like $\ldots \enquote{\ldots} \ldots$. Do you have an idea what to do? Dec 12, 2018 at 17:30

2 Answers 2

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

2
  • 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.) Dec 12, 2018 at 17:48
  • Thanks, the integration worked perfectly with your solution and defining \newcommand{\mathenquote}[1]{\mlq #1\mrq}. Thanks a lot!! Dec 12, 2018 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

5
  • Problem is that I need it as something like $\ldots \enquote{\ldots} \ldots$. Do you have an idea what to do? Dec 12, 2018 at 17:33
  • \ldots work(s) also in the text mode. So \ldots \enquote{\ldots} \ldots will work. Dec 12, 2018 at 17:34
  • Sorry, should have written $<some formulas> \enquote{<formula>} <more formulas>$ and under different circumstances like labels in tikzcd and other situations. Dec 12, 2018 at 17:37
  • If you use amsmath, you have a simple construction \text\enquote{$...$}}. Dec 12, 2018 at 17:40
  • Do you think i can/is it good idea for me to redefine simply then \enquote as something like \ensuretextmode\enquote? Dec 12, 2018 at 17:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.