[Tex/LaTex] Setting maxcitenames for biblatex-apa

apa-stylebiblatex

I want to write a document using biblatex with the APA-style. I want to know, how I can change the maximum number of authors that show up in a citation in the text that I use the first time in the document before the authors' list gets replaced by "et al."


Here is a minimal working example to explain what I mean:

\documentclass[12pt,a4paper]{scrartcl}

% Bibliography entries:
\begin{filecontents}{literatur.bib}
@booklet{one,
    author = {Author One and Author Three and Author Four and Author Five 
and Author Six and Author Seven and Author Eight and Author Nine},
title = {Testtitle 1.},
date = {2018},
}
@booklet{two,
author = {Author Two},
shortauthor = {AOne},
title = {Testtitle 2.},
date = {2018},

} 
\end{filecontents}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} 
\usepackage{lmodern}
\usepackage[ngerman]{babel}   
\usepackage[backend=biber,style=apa,sortlocale=de_DE, natbib = true, 
pagetracker, ibidtracker=constrict]{biblatex}
\DeclareLanguageMapping{ngerman}{ngerman-apa}
\addbibresource{literatur.bib}

\begin{document}

\noindent Here, I cite the publication a first time: \citep{one}.\\
Now, I will cite it a second time: \citep{one}. 
\printbibliography
\end{document}

This results in the following output:

Result from MWE


According to the biblatex-APA documentation, the maximum number of authors showing up down in the actual bibliography can be changed with the apamaxprtauth option. I don't find any equivalent option for the max number of authors in the first citation though. In the MWE above, the desired result is that I can set the number of authors displayed to be as high as I want (e.g. 10) so that for the first citation, the whole list appears.

From the second citation ongoing, the authors are supposed to be replaced by "et al." no matter what. I want to change it for the first appearance only.

Thank you for any suggestions. 🙂

Best Answer

biblatex-apa does not obey maxcitenames since the code to implement the APA more-names-on-first-citations-one-et-al-on-subsequent-citations rule is a bit complicated to implement.

The five author maximum is hard-coded and it can not be customised with an option.

It is possible to allow for a customisation. The code needed for that is not particularly short, but it is a straightforward modification of the original definition from apa.cbx. In the code below you just need to redefine apamaxcitenames.

\documentclass[12pt,a4paper]{scrartcl}

\begin{filecontents}{\jobname.bib}
@booklet{one,
  author = {Author One and Author Three and Author Four and Author Five 
            and Author Six and Author Seven and Author Eight and Author Nine},
  title  = {Testtitle 1.},
  date   = {2018},
}
\end{filecontents}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} 
\usepackage{lmodern}
\usepackage[ngerman]{babel}   
\usepackage[backend=biber,style=apa]{biblatex}
\addbibresource{\jobname.bib}

\makeatletter
\newcommand{\apamaxcitenames}{8}

\DeclareNameFormat{labelname}{%
  % First set the truncation point
  \ifthenelse{\value{uniquelist}>1}
    {\numdef\cbx@min{\value{uniquelist}}}
    {\numdef\cbx@min{\value{minnames}}}%
  % Always print the first name and the second if there are only two since
  % "et al" must always be plural
  \ifboolexpr{test {\ifnumcomp{\value{listcount}}{=}{1}}
              or test {\ifnumcomp{\value{listtotal}}{=}{2}}}
    {\usebibmacro{labelname:doname}%
      {\namepartfamily}%
      {\namepartfamilyi}%
      {\namepartgiven}%
      {\namepartgiveni}%
      {\namepartprefix}%
      {\namepartprefixi}%
      {\namepartsuffix}%
      {\namepartsuffixi}}
    % We are looking at name >=3
    % If the list is 6 or more names or we have seen citation before, potential truncation
    {\ifboolexpr{test {\ifnumcomp{\value{listtotal}}{>}{\apamaxcitenames}}
                 or test {\ifciteseen}}
     % Less than the truncation point, print normally
     {\ifnumcomp{\value{listcount}}{<}{\cbx@min + 1}
       {\usebibmacro{labelname:doname}%
         {\namepartfamily}%
         {\namepartfamilyi}%
         {\namepartgiven}%
         {\namepartgiveni}%
         {\namepartprefix}%
         {\namepartprefixi}%
         {\namepartsuffix}%
         {\namepartsuffixi}}
       {}%
      % At potential truncation point ...
      \ifnumcomp{\value{listcount}}{=}{\cbx@min + 1}
        % but enforce plurality of et al - only truncate here if there is at
        % least one more element after the current potential truncation point
        % so that "et al" covers at least two elements.
        {\ifnumcomp{\value{listcount}}{<}{\value{listtotal}}
          {\printdelim{andothersdelim}\bibstring{andothers}}
          {\usebibmacro{labelname:doname}%
            {\namepartfamily}%
            {\namepartfamilyi}%
            {\namepartgiven}%
            {\namepartgiveni}%
            {\namepartprefix}%
            {\namepartprefixi}%
            {\namepartsuffix}%
            {\namepartsuffixi}}}
        {}%
      % After truncation point, do not print name
      \ifnumcomp{\value{listcount}}{>}{\cbx@min + 1}
       {\relax}%
       {}}%
     % We are looking at name >=3
     % Name list is < 6 names or we haven't seen this citation before, print normally
     {\usebibmacro{labelname:doname}%
       {\namepartfamily}%
       {\namepartfamilyi}%
       {\namepartgiven}%
       {\namepartgiveni}%
       {\namepartprefix}%
       {\namepartprefixi}%
       {\namepartsuffix}%
       {\namepartsuffixi}}}}
\makeatother

\begin{document}
Here, I cite the publication a first time: \parencite{one}.

Now, I will cite it a second time: \parencite{one}. 
\printbibliography
\end{document}

Here, I cite the publication a first time: (One, Three, Four, Five, Six, Seven, Eight & Nine, 2018).//Now, I will cite it a second time: (One et al., 2018).

If you think this could be a useful feature you may want to lobby the author to include it at https://github.com/plk/biblatex-apa/issues. It is not exactly APA-compliant, but given that the required changes are not too great and that there is apamaxprtauth already, he might not dismiss the thought immediately.