[Tex/LaTex] \enquote command of biblatex and \providecommand

biblatexmacros

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.

Best Answer

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}
Related Question