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}
  • \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
7

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

  • 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

  • Problem is that I need 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:33
  • \ldots work(s) also in the text mode. So \ldots \enquote{\ldots} \ldots will work. – Przemysław Scherwentke Dec 12 '18 at 17:34
  • Sorry, should have written $<some formulas> \enquote{<formula>} <more formulas>$ and under different circumstances like labels in tikzcd and other situations. – C-Star-W-Star Dec 12 '18 at 17:37
  • If you use amsmath, you have a simple construction \text\enquote{$...$}}. – Przemysław Scherwentke Dec 12 '18 at 17:40
  • Do you think i can/is it good idea for me to redefine simply then \enquote as something like \ensuretextmode\enquote? – C-Star-W-Star Dec 12 '18 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.