I am required to output a specific number of authors which is dependent on whether the citation has appeared before. If a citation has not appeared, a citation
- with up to five authors should list all authors
- with more than five authors should only list the first author, followed by "et al.".
If a citation has already appeared, a citation
- with up to two authors should list all authors
- with more than two authors should only list the first author, followed by "et al.".
Using Audrey's answer, I was able to achieve most of it. However, I do not know how to query the number of authors in the patch commands. I assume that I could set maxnames based on whether the citation has been seen before, but Audrey mentions that this is probably not the best idea - is there another way?
Thank you very much!
Example:
\documentclass[]{scrbook}
\usepackage{filecontents}
\begin{filecontents}{lit.bib}
@article{Amabile.1993,
author = {Amabile, Teresa M.},
year = {1993},
title = {Motivational Synergy: Toward new conceptualizations of intrinsic and extrinsic motivation in the workplace},
pages = {185},
volume = {3},
number = {3},
journal = {Human Resource Management Review}
}
@article{Stevenson.1990,
author = {Stevenson, Howard H. and Jarillo, J. Carlos},
year = {1990},
title = {A Paradigm of Entrepreneurship: Entrepreneurial Management},
pages = {17--27},
volume = {11},
journal = {Strategic Management Journal}
}
@article{Kivimaki.1997,
author = {Kivim{\"a}ki, Mika and Kuk, George and Elovainio, Marko and Thomson, Louise and Kalliom{\"a}ki-Levanto, Tiina and Heikkil{\"a}, Armo},
year = {1997},
title = {The Team Climate Inventory (TCI)-four or five factors? Testing the structure of TCI in samples of low and high complexity jobs},
pages = {375--389},
volume = {70},
number = {4},
journal = {Journal of Occupational and Organizational Psychology}
}
\end{filecontents}
\usepackage[
natbib=true,
style=authoryear-comp,
backend=biber,
maxcitenames=2,
citetracker=true,]{biblatex}
\usepackage{xpatch}
\AtEveryCitekey{\ifciteseen{}{\clearfield{namehash}}}
\xpatchbibmacro{cite}
{\printnames{labelname}}
{\ifciteseen
{\printnames{labelname}}
{\printnames[][1-5]{labelname}}}
{}
{}
\xpatchbibmacro{textcite}
{\printnames{labelname}}
{\ifciteseen
{\printnames{labelname}}
{\printnames[][1-5]{labelname}}}
{}
{}
% some natbib backwards compatibility
\let\citealp\cite
\let\cite\textcite
\addbibresource{lit.bib}
\begin{document}
\citet{Amabile.1993} \\ % Amabile (1993) - correct
\citet{Stevenson.1990} \\ % Stevenson and Jarillo (1990) - correct
\citet{Kivimaki.1997} \\ % incorrect, should be Kivimäki et al. (1997)
\citet{Amabile.1993} \\ % Amabile (1993) - correct
\citet{Stevenson.1990} \\ % Stevenson and Jarillo (1990) - correct
\citet{Kivimaki.1997} \\ % Kivimäki et al. (1997) - correct
\printbibliography
\end{document}
The solution using \AtEveryCitekey would be the following; however, I'm a bit confused because of the "With biber as the backend, you might want to avoid messing around with the maxnames counter."
\AtEveryCitekey{\ifciteseen{\defcounter{maxnames}{2}}%
{\defcounter{maxnames}{5}}}

uniquelistis set to anything other thanfalse, Biber can - within reason - change the number of authors displayed. Biber also assigns the disambiguation letters ('Smith 2006a') and does that based on the name label it figured out. If we now changemaxnamesmid-document Biber won't know about it and labels might be a bit off. If this is only for the first cite, that is probably a risk you have to take anyway. – moewe Feb 20 '17 at 06:59