2

I have a problem using apa style in BibLaTeX.

\documentclass[a4paper,14pt]{extarticle}

\usepackage{cmap}                   
\usepackage{mathtext}               
\usepackage[T2A]{fontenc}           
\usepackage[utf8]{inputenc}         
\usepackage[english,russian]{babel}

\usepackage{csquotes} 
\usepackage[style=apa,backend=biber,sorting=nyt]{biblatex}

\addbibresource{bibl1.bib}

\begin{document}

Text, text...
\nocite{*}
\printbibliography

\end{document}

Error message:

! Undefined control sequence.
<argument> \mkbibdateapalongextra 
                                  {year}{month}{day}\iffieldundef {endyear}{...

I found solutions for other languages but TeXstudio doesn't recognize \DeclareLanguageMapping and I didn't find russian-apa.lbx.

  • Welcome to TeX SX! You might try to write it yourself. It is not that long. – Bernard Feb 26 '16 at 0:17
2

biblatex-apa defines some essential macros in the .lbx files, so for every language you use in your document you need

\DeclareLanguageMapping{<lang>}{<lang>-apa}

Starting from biblatex v3.8/biblatex-apa v7.5 there should be no need for manual \DeclareLanguageMappings any more. biblatex-apa now automatically sets the mappings for all languages with \DeclareLanguageMappingSuffix{-apa}. Of course this can only work if the file <lang>-apa.lbx is present.

Unfortunately, there is no russian-apa.lbx and so the line \DeclareLanguageMapping{russian}{russian-apa} won't really help, we only get a message that rusian-apa.lbx was not found and the mapping is ignored.

The best solution is to write russian-apa.lbx. You can take any of the ...-apa.lbxs as starting point and translate the file. See What is the most appropriate way to configure biblatex for use with an unsupported language?. Here this would probably involve copying english-apa.lbx to russian-apa.lbx, changing the date and ID at the top, translating the contents and modifying the date format to Russian usage.


For a quick fix you can simply add

\DefineBibliographyExtras{russian}{%
  \protected\def\mkbibdateapalong#1#2#3{%
    \iffieldundef{#1}%
      {}%
      {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}%
    \iffieldundef{#2}%
      {}%
      {\iffieldundef{#1}%
        {}%
        {\addcomma\addspace}%
       \mkbibmonth{\thefield{#2}}}%
    \iffieldundef{#3}%
      {}%
      {\ifthenelse{\iffieldundef{#2}\OR\iffieldundef{#1}}%
        {}%
        {\addspace}%
       \stripzeros{\thefield{#3}}}}%
  \protected\def\mkbibdateapalongextra#1#2#3{%
    \iffieldundef{#1}%
      {}%
      {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}\printfield{extrayear}}%
    \iffieldundef{#2}%
      {}%
      {\iffieldundef{#1}%
        {}%
        {\addcomma\addspace}%
       \mkbibmonth{\thefield{#2}}}%
    \iffieldundef{#3}%
      {}%
      {\ifthenelse{\iffieldundef{#2}\OR\iffieldundef{#1}}%
        {}%
        {\addspace}%
       \stripzeros{\thefield{#3}}}}%
  \protected\def\mkbibdateapalongmdy#1#2#3{%
    \iffieldundef{#2}%
      {}%
      {\mkbibmonth{\thefield{#2}}}%
    \iffieldundef{#3}%
      {}%
      {\addspace}%
       \stripzeros{\thefield{#3}}%
    \iffieldundef{#1}%
      {}%
      {\ifthenelse{\iffieldundef{#3}}%
        {\ifthenelse{\iffieldundef{#2}}%
          {}%
          {\addspace}}%
        {\addcomma\addspace}%
       \iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}}}

to your preamble. (Modify it to Russian customs if need be.)

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.