# Problem with \mkbibdateapalongextra of biblatex-apa

biblatex-apa gives me this:

! Undefined control sequence.
<argument> \mkbibdateapalongextra
{labelyear}{labelmonth}{labelday}\iffieldu...


I'm using the default (english) language, and have done the:

\DeclareLanguageMapping{norsk}{norsk-apa}
\DeclareLanguageMapping{english}{american-apa}


thing.

Here's a short example:

\documentclass[english]{memoir}
\usepackage{babel}
\usepackage{roffe}
\usepackage[backend=biber,date=short,maxcitenames=2,style=apa]{biblatex}

\DeclareLanguageMapping{norsk}{norsk-apa}
\DeclareLanguageMapping{english}{american-apa}

\begin{document}
\cite{R-base}

\printbibliography
\end{document}


This one replicates the problem.

• Without a MWE we can only guess. Did you put \DeclareLanguageMapping{english}{american-apa} after babel and biblatex? Do you load the language english or american in babel? – moewe Sep 17 '13 at 7:49
• Welcome to TeX.SX! Your question would require for a definite/specific answer a Minimal Working Example, or MWE – alandella Sep 17 '13 at 7:51
• I've tried to build an MWE, but, and here's the rub, none that replicates this error. Which is why I'm stymied. Is there anything I should look for in the .log file? – roffe Sep 17 '13 at 15:10
• @roffe Well, if you have no way of reproducing the error, it is quite hard to track down the problem. You could start off with the affected document and delete the unnecessary parts, thereby arriving at a MWE. Did you try deleting all the temporary files and recompile? Maybe an update can help. – moewe Sep 17 '13 at 16:36
• (pastebin.com/gNDrMnMk) replicates the problem. – roffe Sep 18 '13 at 12:42

Starting from biblatex v3.8, biblatex-apa v7.5 an explicit \DeclareLanguageMapping should not be needed any more. The mapping is automatically done for you with \DeclareLanguageMappingSuffix{-apa}.

Of course this can only work properly if biblatex-apa comes with an .lbx file for your language.

Update biblatex, Biber and biblatex-apa to their newest versions if you experience problems with an undefined \mkbibdateapalongextra. The old version of this answer is left below in case you are stuck with an old version of biblatex or biblatex-apa.

If you use biblatex-apa you will need a language mapping for each used language (at least the main language) to its -apa counterpart

\DeclareLanguageMapping{american}{american-apa}


if your document is american. See also problems using apa6e with biblatex-apa.

This is pointed out in the biblatex-apa documentation, § 3

Specify the style in the usual way when loading biblatex. If you are using babel:

\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=apa]{biblatex}
\DeclareLanguageMapping{american}{american-apa}


Refer to section 3.2 Localisation for a few more hints.

That means for each language you load with babel or polyglossia (but there things are a bit more complicated), you will need a mapping.

You will also have to provide a language mapping if you don't load babel at all. In that case the default language is English and you need \DeclareLanguageMapping{english}{english-apa}.

Whenever you declare a language mapping, biblatex uses the new file (in our case british-apa.lbx) if need be, that is if the mapped language is requested (in our case english).

british-apa.lbx contains some additional "BibliographyExtras" declared by \DefineBibliographyExtras{british}. These extras are only available for the exact language they are specified for (here british). So even though we have forced biblatex to load british-apa.lbx instead of english.lbx we cannot use the "BibliographyExtras" since our document requests them for english only, but they are only available for british.

The relevant part of the documentation, § 4.11.8 Custom Localization Modules, p. 232 states:

Note that \DeclareLanguageMapping is not intended to handle language variants (e.g., AmericanEnglish vs. BritishEnglish) or babel language aliases (e.g., USenglish vs. american). For example, babel offers the USenglish option which is similar to american. Therefore, biblatex ships with an USenglish.lbx file which simply inherits all data from american.lbx (which in turn gets the ‘strings’ from english.lbx). In other words, the mapping of language variants and babel language aliases happens on the file level, the point being that biblatex's language support can be extended simply by adding additional lbx files.

The simplest solution would be to use british or american instead of the "generic" english.

The following MWE works on my machine.

\documentclass[british]{article}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[backend=biber,date=short,maxcitenames=2,style=apa]{biblatex}

\DeclareLanguageMapping{british}{british-apa}

\begin{filecontents}{\jobname.bib}
@Manual{R-base,
title = {R: A Language and Environment for Statistical Computing},
author = {{R Development Core Team}},
organization = {R Foundation for Statistical Computing},
year = {2008},
isbn  = {3-900051-07-0},
url = {http://www.R-project.org},
}
\end{filecontents}

\begin{document}
\cite{R-base}
\nocite{*}
\printbibliography
\end{document}


If you do not want to switch to a language other than english, you can go with the fix suggested in Polyglossia and biblatex-apa.

Copy british-apa.lbx to a place LaTeX can find it, rename it to english-apa.lbx and replace all occurrences of british with english (the most important of which is \DefineBibliographyExtras{british} which becomes \DefineBibliographyExtras{english})