# biblatex: Setting maxnames on individual entries

I'm using biblatex (with biber as backend). I use the global maxnames option to shorten author lists (with "et al."). However, I would like to create some exceptions to this rule for some specific entries.

I was hoping I could use the options entry field (for per-entry options).

For example, I would use the following global setting:

\usepackage[bibstyle=numeric-comp,citestyle=numeric-comp,backend=biber,maxnames=3]{biblatex}


I would then override the maxnames setting for some individual items, for example to allow a longer authors list, like so:

@INPROCEEDINGS{Vallejos2009b,
author = {John Doe and Pete Peters and Jane Jones and John Johnson and Alison Anderson},
title = {Some Title},
booktitle = {...},
year = {2009},
options = {maxnames=5}
}


Unfortunately this does not work because maxnames is not supported as an entry-level option. At least in the current biblatex version.

Does anyone have an idea how I could do something like that?

PS: I use numeric citation style so my question only concerns the abbreviation of author lists in the bibliography itself.

-

You can't reliably do this yourself by either bib file keywords or style edits because maxnames (and maxbibnames, maxalphanames) is used internally by biber to do all sorts of things when generating the .bbl. So if it's not supported in biber as a per-entry option, entry information will potentially be wrong/inconsistent like labels, hashes and uniquename/uniquelist settings.

We have had a look at this and the functionality will be implemented in the next biber and biblatex versions, probably 0.9.6/1.7. You will be able to set:

maxnames/minnames maxcitenames/mincitenames maxbibnames/minbibnames maxalphanames/minalphanames maxitems/minitems

on a per-type and per-entry basis.

Just to confirm that this is now implemented in biber 0.9.6/biblatex 1.7 which were released a couple of days ago.

-
Of course, I didn't mean to cast aspersions. biber is a bit of a black box to most people because it's assumed mostly that it just does what bibtex does for biblatex but with Unicode. In fact, it does an enormous amount more than that and is quite complex internally - I have added some diagrams and comments to the biber PDF documentation recently on this topic. biber does all of the processing of uniqueness information, hashes, label generation etc. - this is all tied up with settings like max/minnames so the solution may work but you may see odd things happening without direct support – PLK Sep 3 '11 at 20:02
– PLK Sep 3 '11 at 20:11
I commented on it - that old request was pre-biber and so it was at the time impossible I think. Should be possible now (certainly possible in biber) but it's up to the biblatex maintainer in the end. – PLK Sep 3 '11 at 20:22
Making max/min* options per-entry would also automatically make them per-type too which is a nice bonus – PLK Sep 3 '11 at 20:24
I edited my reply to confirm that this is planned for the next biber/biblatex release. – PLK Sep 4 '11 at 14:22

The solution is a HACK. See the legitimate answer of PLK.

You must modify each bibitem. I would to this by setting a special keyword to the relevant bib entry. At the beginning of the bibitem you can test whether the key is set or not. If the key is set you can change the counter maxnames.

\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@INPROCEEDINGS{Vallejos2009b,
author = {John Doe and Pete Peters and Jane Jones and John Johnson and Alison Anderson},
title = {Some Title},
booktitle = {...},
year = {2009},
keywords={increasemaxnames},
}

@book{test,
author="John Smith and John Doe and Pete Peters and Jane Jones and John Johnson",
title="TITLE",
year=2009,
publisher="PUP",
}
\end{filecontents}
\documentclass{article}
\usepackage[bibstyle=numeric-comp,citestyle=numeric-comp,backend=biber,maxnames=3]{biblatex}
\bibliography{\jobname.bib}
\AtEveryBibitem{%
\ifkeyword{increasemaxnames}%
{\setcounter{maxnames}{5}}
{\setcounter{maxnames}{3}}
}

\begin{document}
\cite{Vallejos2009b} \cite{test}
\printbibliography
\end{document}


EDIT:

Audrey wishes I method without editing the bib file. This is possible with a comparison of the entrykey. I build a command named \individualentry. The command needs a comma separate list of entrykeys. If the entrykey doesn't exist it will works too ;-)

Here the definition of the command:

\newrobustcmd*\individualentry[1]{%
\def\tempa{}%
\def\tempb{ ( test {\ifstrequal{2}{1}} ) }%
\def\do##1{%
\gappto\tempb{ or (test  {\iffieldequalstr{entrykey}{##1}}) }
}%
\dolistloop{\tempa}%
\AtEveryBibitem{
\expandafter\ifboolexpr\expandafter{\tempb}%
{\setcounter{maxnames}{5}}%
{\setcounter{maxnames}{3}}
}
}


It is important that the command is used in the preamble!

Here the whole example:

\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@INPROCEEDINGS{Vallejos2009b,
author = {John Doe and Pete Peters and Jane Jones and John Johnson and Alison Anderson},
title = {Some Title},
booktitle = {...},
year = {2009},
keywords={increasemaxnames},
}

@book{test,
author="John Smith and John Doe and Pete Peters and Jane Jones and John Johnson",
title="TITLE",
year=2009,
publisher="PUP",
}
\end{filecontents}
\documentclass{article}
\usepackage[bibstyle=numeric-comp,citestyle=numeric-comp,backend=biber,maxnames=3]{biblatex}
\bibliography{\jobname.bib}
\newrobustcmd*\individualentry[1]{%
\def\tempa{}%
\def\tempb{ ( test {\ifstrequal{2}{1}} ) }%
\def\do##1{%
\gappto\tempb{ or (test  {\iffieldequalstr{entrykey}{##1}}) }%
}%
\dolistloop{\tempa}%
\AtEveryBibitem{%
\expandafter\ifboolexpr\expandafter{\tempb}%
{\setcounter{maxnames}{5}}%
{\setcounter{maxnames}{3}}%
}%%
\AtEveryCitekey{%
\expandafter\ifboolexpr\expandafter{\tempb}%
{\setcounter{maxnames}{5}}%
{\setcounter{maxnames}{3}}%
}%
}
%\individualentry{foo,Vallejos2009b,test}
\individualentry{foo,Vallejos2009b}
\begin{document}
\cite{Vallejos2009b} \cite{test}

\fullcite{Vallejos2009b}

\fullcite{test}

\printbibliography
\end{document}

-
+1 You can avoid bib file edits by using the test \iffieldequalstr{entrykey}{Vallejos2009b}{\setcounter{maxnames}{5}}{} in \AtEveryBibitem. – Audrey Sep 3 '11 at 18:24
@Audrey: This was my first idea. But than I must do it for every entrykey. You know what I mean? – Marco Daniel Sep 3 '11 at 18:32
Yeah. It's just a matter of preference. I'd be too lazy to edit the bib file. Expanding the test to multiple keys using something like \ifboolexpr would seem like less work to me, especially if my bib file contains many entries. – Audrey Sep 3 '11 at 18:38
Thanks Marco, this is great. However, I did notice it only affects the actual bibliography and not the results of \fullcite{Vallejos2009b}. Is there a way to let it affect fullcite as well? Or an alternative to fullcite which would be affected? – Matthias Sep 3 '11 at 19:31
@Matthias: You can use the HACK in the same way with AtEveryCitekey. I will expand my second example. I think you can adapt it to the first one. – Marco Daniel Sep 3 '11 at 19:47