Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

One thing about the biblatex-apa style I could not get used to, is the 3-5 authors citation: if the authors number is between 3-5, all of them will be printed in citation.

e.g. Biblatex-apa style:

  • [Citation] Goossens, Mittelbach, Samarin and Peter (2020)
  • [Bibliography] Goossens, M., Mittelbach, F., Samarin, A. & Peter, T. (2020). How to DIY a nuclear bomb at home (1st ed.). Reading, Mass.: Addison-Wesley.

Sometimes the authors list is really long in text, and I thought it is indeed not necessary. So how to make the maxcitenames number to 2, just like the built in biblatex styles do.

MWE is provided:

\documentclass{article}

\usepackage[colorlinks]{hyperref}
\usepackage{libertine}
\usepackage[UKenglish]{babel}
\usepackage{csquotes}
\usepackage[
    style=apa,
    backend=biber,
    maxcitenames=2,  % no effect!      
    natbib=true] {biblatex} 
\DeclareLanguageMapping{british}{british-apa}
\LetLtxMacro{\cite}{\citet} %

\addbibresource{biblatex-examples.bib}
\begin{document}

\section*{Apa citation}

Article - 2 authors: \cite{sarfraz}\\
Article - 3 authors: \cite{companion}\\
In proceeding: \cite{salam}\\
Ph.D thesis:  \cite[see e.g.][]{geer} \\
Master thesis: \cite{loh}\\
Report: \cite{padhye}\\
Repeat citation:  \cite{companion}, \citet{companion}, \citep{companion} \\
Multi-citation:  \cite{bertram,knuth:ct:a,knuth:ct:b,knuth:ct:c} \\
\printbibliography

\end{document}
share|improve this question

1 Answer 1

Yes the maxcitenames apparently has no effect in biblatex-apa. I faced this issue where the biblatex-apa was very close to the style I required but I did not want all the author names for 3-5 authors and I also didn't want the implementation of first cite as described in the APA style.

The solution is to alter the code that causes this, you can find it in the file apa.cbx and it is usually in ...../tex/latex/biblatex-apa.

The corresponding piece of code is the following:

\DeclareNameFormat{labelname}{%
  \ifthenelse{\value{uniquelist}>1}
    {\numdef\cbx@min{\value{uniquelist}}}
    {\numdef\cbx@min{\value{minnames}}}%
  \ifboolexpr{test {\ifnumcomp{\value{listcount}}{=}{1}}
              or test {\ifnumcomp{\value{listtotal}}{=}{2}}}
    {\usebibmacro{labelname:doname}{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}
    {\ifboolexpr{test {\ifnumcomp{\value{listtotal}}{>}{5}}
                 or test {\ifciteseen}}
     {\ifnumcomp{\value{listcount}}{<}{\cbx@min + 1}% normal name
       {\usebibmacro{labelname:doname}{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}%
       {}%
      \ifnumcomp{\value{listcount}}{=}{\cbx@min + 1}% first past ul is et al
      % 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}}
         {\andothersdelim\bibstring{andothers}}
         {\usebibmacro{labelname:doname}{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}}%
       {}%
      \ifnumcomp{\value{listcount}}{>}{\cbx@min + 1}% nothing thereafter
       {\relax}%
       {}}%
     {\usebibmacro{labelname:doname}{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}}}

One of the things this code does is check if the number of authors is > 5 or if the entry has already been cited, if so; then it assigns et al after the first author. By altering the code, changing the 5 to 2 and getting rid of or test {\ifciteseen} (watch out for the closing bracket), then any citation with more than 2 authors will have et al regardless if it has been used or not. Here's the edited part in addition to \makeatletter and \makeatother which are required when putting this into the document preamble

\makeatletter

\DeclareNameFormat{labelname}{%
  \ifthenelse{\value{uniquelist}>1}
    {\numdef\cbx@min{\value{uniquelist}}}
    {\numdef\cbx@min{\value{minnames}}}%
  \ifboolexpr{test {\ifnumcomp{\value{listcount}}{=}{1}}
              or test {\ifnumcomp{\value{listtotal}}{=}{2}}}
    {\usebibmacro{labelname:doname}{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}
    {\ifboolexpr{test {\ifnumcomp{\value{listtotal}}{>}{\value{maxnames}}}}% <- EDIT
     {\ifnumcomp{\value{listcount}}{<}{\cbx@min + 1}% normal name
       {\usebibmacro{labelname:doname}{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}%
       {}%
      \ifnumcomp{\value{listcount}}{=}{\cbx@min + 1}% first past ul is et al
      % 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}}
         {\andothersdelim\bibstring{andothers}}
         {\usebibmacro{labelname:doname}{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}}%
       {}%
      \ifnumcomp{\value{listcount}}{>}{\cbx@min + 1}% nothing thereafter
       {\relax}%
       {}}%
     {\usebibmacro{labelname:doname}{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}}}

\makeatother

The xpatch package provides an easy way to apply the same change to the labelname formatting directive.

\usepackage[style=apa,backend=biber,natbib=true,
            maxcitenames=2,uniquelist=false]{biblatex} 
\DeclareLanguageMapping{british}{british-apa}
\usepackage{xpatch}

\xpatchnameformat{labelname}
  {\ifciteseen}{\ifnumcomp{\value{listtotal}}{>}{\value{maxnames}}}{}{}
share|improve this answer
    
@Audrey, using the setting before or after biblatex? because using it before the biblatex setting gets no error nor effect. After ... gets a lot errors –  KOF Feb 7 '13 at 17:26
    
@Audrey, thanks a lot, I'm still a beginner when it comes to such stuff :D. Anyway, I get an undefined control sequence, I read the xpatch documentation and your syntax seems to be correct, don't know why. –  pythonista Feb 7 '13 at 17:31
    
@Audrey I added your answer although it's still giving me an undefined control sequence! –  pythonista Feb 7 '13 at 18:01
    
@AbdulhaqElhouderi I made an edit. Using that code, I don't get any errors on my end. If your errors persist, which control sequence is undefined? –  Audrey Feb 7 '13 at 18:13
2  
@AbdulhaqElhouderi Which xpatch version do you have? xpatchnameformat was introduced to 0.3, release 2012/10/02. –  Audrey Feb 7 '13 at 18:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.