[Tex/LaTex] “Undefined Control Sequence”-Error when using Biblatex with apa style

apa-stylebiberbiblatex

Today I started to try biblatex for the first time in my apa6.cls document:

\documentclass[ngerman,man,12pt,a4paper,noextraspace,donotrepeattitle]{apa6}
\usepackage[latin1]{inputenc} 
\usepackage[english,ngerman]{babel}
\usepackage[T1]{fontenc}    
\usepackage{lmodern}        
\usepackage{etoolbox}

\usepackage{csquotes}
\usepackage[style=apa,sortcites=true,sorting=nyt,backend=biber]{biblatex}
\DeclareLanguageMapping{ngerman}{ngerman-apa}
\addbibresource{Literatur.bib}

\begin{document}

\cite{vonDavier2011}

\printbibliography

\end{document}

I just copied the content of the .bib file from the bibliography.bib of the apa6.cls example file for some testing so the .bib content is alright.

This works as long as I load biblatex only with \usepackage[backend=biber]{biblatex}. But when I additionally specify apa citation style like in the example above, I get the Error

Undefined Control Sequence

right after the \printbibliography line.

I have to mention that I am not an advanced latex or even biblatex user. F. e. I just changed the output profile from bibtex to biber and don't know what is meant with "biber %" I read about in other topics. Should I include that anywhere?

Thanks for answers!

Best Answer

The error lies in declaring the ngerman option in the \documentclass line.

Here's what happens. When babel is loaded, it is passed all the global options, so ngerman; then it examines the local options, english and ngerman; since the latter has already been loaded, it has no effect and the main language becomes English.

You can check this by adding \languagename after \begin{document}, which will print “english”.

Solution: don't use ngerman in \documentclass or use both. If you have babel version 3.9, you can solve also by issuing

\usepackage[english, main=ngerman]{babel}

and, in this case, the ngerman option in \documentclass will do no damage.