4

In my references I'd like my dates to be written as "day month year". I've been able to achieve this following the top answer here Formatting dates “day month year” with biblatex. However, as soon as I try to use that MWE with style=apa, I get the error "Undefined control sequence. \end" at the \printbibliography command.

\documentclass{article}

\usepackage[australian,american]{babel}

\usepackage[style=apa, backend=biber, dateabbrev=false]{biblatex}

\begin{filecontents}{references.bib}
@book{Book,
  title = {This is a Title},
  author = {Author, Some},
  location = {The City},
  publisher = {Publisher},
  date = 2005,
  month = feb,
  day = 14,
}
\end{filecontents}
\addbibresource{references.bib}

\begin{document}
\today

Citing \cite{Book}.

\begin{otherlanguage}{australian}
\printbibliography
\end{otherlanguage}

\end{document}
  • For biblatex-apa to function one always needs the line \DeclareLanguageMapping{<language>}{<language>-apa}, but this is not available for australian (australian-apa.lbx does not exist). I think it might be easier to solve your problem in a different way. What exactly do you want to achieve? – moewe Apr 10 '15 at 5:23
  • I'd just like the dates in my bibliography to be formatted as "10th of April, 2015", rather than "April 10, 2015". – benjennen Apr 10 '15 at 8:58
  • You see, I'm asking because when I run your example with american only (and the necessary \DeclareLanguageMapping{american}{american-apa}) I get "(2005, February 14)" in the output. – moewe Apr 10 '15 at 9:01
  • Ah sorry, I meant for the urldate parameter, i.e. the retrieval date. – benjennen Apr 10 '15 at 14:52
3

The following redefinition in your preamble ought to be enough

\DefineBibliographyExtras{american}{%
  \protected\def\mkbibdateapalongmdy#1#2#3{%
    \iffieldundef{#3}
      {}
      {\mkbibordinal{\thefield{#3}}%
       \iffieldundef{#2}{}{\nobreakspace}}%
    \iffieldundef{#2}
      {}
      {\mkbibmonth{\thefield{#2}}%
       \iffieldundef{#1}{}{\space}}%
    \iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\stripzeros{\thefield{#1}}}}}

but since the current version of biblatex-apa used \DefineBibliographyExtras instead of \DeclareBibliographyExtras in its .lbx files that does not quite work. This bug has already been resolved in the github repository, it has not made it to CTAN yet, though.


As a temporary work-around I suggest you create a new file called american-bpb.lbx and fill it with

\ProvidesFile{american-bpb.lbx}[2015/10/10\space v6.7\space APA biblatex localisation - modified]
\InheritBibliographyExtras{american-apa}

\DeclareBibliographyStrings{inherit = {american-apa}}

\DefineBibliographyExtras{american}{%
  \protected\def\mkbibdateapalongmdy#1#2#3{%
    \iffieldundef{#3}
      {}
      {\mkbibordinal{\thefield{#3}}%
       \iffieldundef{#2}{}{\nobreakspace}}%
    \iffieldundef{#2}
      {}
      {\mkbibmonth{\thefield{#2}}%
       \iffieldundef{#1}{}{\space}}%
    \iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\stripzeros{\thefield{#1}}}}}

\endinput

In your document then use \DeclareLanguageMapping{american}{american-bpb} (instead of the normally required \DeclareLanguageMapping{american}{american-apa})

In the MWE we create the american-bpb.lbx via filecontents

\documentclass{article}
\usepackage{filecontents}
\usepackage[american]{babel}

\begin{filecontents}{american-bpb.lbx}
\ProvidesFile{american-bpb.lbx}[2015/10/10\space v6.7\space APA biblatex localisation - modified]
\InheritBibliographyExtras{american-apa}

\DeclareBibliographyStrings{inherit = {american-apa}}

\DefineBibliographyExtras{american}{%
  \protected\def\mkbibdateapalongmdy#1#2#3{%
    \iffieldundef{#3}
      {}
      {\mkbibordinal{\thefield{#3}}%
       \iffieldundef{#2}{}{\nobreakspace}}%
    \iffieldundef{#2}
      {}
      {\mkbibmonth{\thefield{#2}}%
       \iffieldundef{#1}{}{\space}}%
    \iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\stripzeros{\thefield{#1}}}}}

\endinput
\end{filecontents}


\usepackage[style=apa, backend=biber, dateabbrev=false]{biblatex}
\DeclareLanguageMapping{american}{american-bpb}

\begin{filecontents}{\jobname.bib}
@online{online,
  title = {Something on the Internet},
  author = {Anne Uthor},
  date = {2015-04-08},  
  url = {http://www.example.com},
  urldate = {2015-08-04},  
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\nocite{*}
\printbibliography
\end{document}

example output

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.