4

I'm not so sure whether I am asking a question about biblatex or about \providecommand but I hope someone can help me.

It occurs to me that both csquotes and biblatex define an \enquote command (I could not find it in the documentation of biblatex however).

At least, both

\documentclass{article}

\usepackage{csquotes}

\begin{document}
    \enquote{asdf}
\end{document}

and

\documentclass{article}

\usepackage{biblatex}

\begin{document}
    \enquote{asdf}
\end{document}

compile perfectly fine.

If I include the line \providecommand{\enquote}{\emph}, the version with csquotes still works:

\documentclass{article}

\usepackage{csquotes}

\providecommand{\enquote}{\emph}

\begin{document}
    \enquote{asdf}
\end{document}

But the version with biblatex gives an error Command \enquote already defined. \begin{document}:

\documentclass{article}

\usepackage{biblatex}

\providecommand{\enquote}{\emph}

\begin{document}
    \enquote{asdf}
\end{document}

Also \enquote{asdf} is printed as italics, which, to my understanding of \providecommand should not be the case if biblatex already defined the \enquote command.

  • I don't think biblatex provides that command. It assumes that you should load csquotes which does. It does that to enable you to modify quote styles easily, but precisely so that it doesn't clash with enquote which is useful independently. – Paul Stanley Apr 14 '18 at 9:19
5

biblatex tests if csquotes has been loaded. If not it assumes that \enquote is undefined and defines it itself with \newrobustcmd*. The test is done in \AtEndPreamble, directly before \begin{document}.

So your failing example is equivalent to this here.

\documentclass{article}
\providecommand{\enquote}{\emph}
\newcommand\enquote{blub}
\begin{document}
    \enquote{asdf}
\end{document}

The \enquote command of biblatex is not so powerful as the one from csquotes. E.g. it doesn't take languages into account:

\documentclass{article}
\usepackage[ngerman]{babel}
%\usepackage[autostyle]{csquotes}
\usepackage{biblatex}

\begin{document}
    \enquote{asdf}
\end{document}
  • Very good explanation. I myself am writing a small package where I need an \enquote command. I want it to make use of csquotes if that package is loaded, but be a more primitive version if not. Usually I have loaded both csquotes and biblatex. What would be your suggestion how to accomplish this? Should I copy the approach of biblatex and test for both csquotes and biblatex at the end of the preamble? – John Dorian Apr 14 '18 at 9:55
  • 1
    Mhh, maybe biblatex should not define \enquote itself if csquotes is not loaded, but should rather use a private name ... The fact that biblatex defines \enquote is not documented, either ... – moewe Apr 14 '18 at 12:08
  • 1
    Started a discussion in github.com/plk/biblatex/issues/737 – moewe Apr 14 '18 at 16:08

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.