biblatex – et al. beginning from second citation?

Basically all I need to know is how I can use "et. al" beginning from the second citation of a source. I am using the following

\usepackage[
natbib=true,
style=authoryear
]{biblatex}


I need citations to look like this:

First citation of a source

Drobetz, Schillhofer, and Zimmermann (2004)

Second and further citations

Drobetz et al. (2004)

Right now, every citation looks like the first one. With the biblatex option maxcitenames I can only adjust all citations and not all but the first one. Any help?

-

The number of names in labelname is determined (in part) by the counter maxnames. In citations, this is just equal to whatever you specify for the maxcitenames option. To avoid name list truncation at the first citation, you can change maxnames locally using etoolbox's \defcounter command inside the \AtEveryCitekey hook.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[style=authoryear,citetracker=true,maxcitenames=1]{biblatex}

\AtEveryCitekey{\ifciteseen{}{\defcounter{maxnames}{99}}}

\begin{document}
\textcite{companion} showed that...
\textcite{companion,bertram} showed that...
Filler text \parencite{bertram,companion,aksin}.
Filler text \parencite{bertram,companion,aksin}.
\end{document}


Note that the test \ifciteseen{<true>}{<false>} needs citation trackers enabled. By default authoryear doesn't use citation tracking. Here I've enabled global tracking using citetracker=true. So \ifciteseen expands <true> after the first citation, no matter where it occurs in the document (e.g. citation lists or footnotes). Other tracker settings are described in the manual.

With the authoryear-comp style the solution needs to be modified slightly. Here we use the same hook, but we also clear the namehash field so that an entry won't be part of a compact citation list the first time it is cited.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[style=authoryear-comp,citetracker=true,maxcitenames=1]{biblatex}

\AtEveryCitekey{%
\ifciteseen{}{\defcounter{maxnames}{99}\clearfield{namehash}}}

\begin{filecontents}{\jobname.bib}
@article{bertram2,
title = {Gromov Invariants for Holomorphic Maps from Riemann Surfaces to Grassmannians},
author = {Bertram, Aaron and Daskalopoulos, Georgios and Wentworth, Richard},
journal = {Journal of the American Mathematical Society},
volume = {9},
number = {2},
pages = {529--571},
year = {1996}}
\end{filecontents}

\begin{document}
\textcite{companion,aksin} showed that...
\textcite{companion,bertram} showed that...
Filler text \parencite{bertram,bertram2,companion}.
Filler text \parencite{bertram,bertram2,companion,aksin}.
\end{document}


With biber as the backend, you might want to avoid messing around with the maxnames counter. We can instead pass optional arguments to \printnames via a patch command from the xpatch package. The patches in the following preamble should work for all of the author-year style variants.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[backend=biber,style=authoryear-comp,citetracker=true,%
maxcitenames=1,uniquename=false,uniquelist=false]{biblatex}
\usepackage{xpatch}

\AtEveryCitekey{\ifciteseen{}{\clearfield{namehash}}}

\xpatchbibmacro{cite}
{\printnames{labelname}}
{\ifciteseen
{\printnames{labelname}}
{\printnames[][1-99]{labelname}}}
{}
{}

\xpatchbibmacro{textcite}
{\printnames{labelname}}
{\ifciteseen
{\printnames{labelname}}
{\printnames[][1-99]{labelname}}}
{}
{}


These option settings will give the same output with the authoryear-comp document above, though you might want to consider other values for uniquename and uniquelist. Details can be found in the manual.

-
great, thanks! Didn't think this would be such a hassle, as this citation style should be rather common. – Thomas Mar 21 '12 at 18:21
@Thomas Citation labels in author-year styles are fixed. This decision might be related to disambiguation. Two entries can be unique in terms of full labelname, but not in truncated labelname. We've been warned about messing with the maxnames counter before. But from my read of biblatex.sty, maxnames doesn't affect internal counters used for disambiguation. Use of \defcounter instead of \setcounter is an additional precaution. – Audrey Mar 21 '12 at 19:45
The problem is that maxnames is really used to set disambiguation informtion by biber, not biblatex so much. Looking at biblatex.sty won't help you much (unless you are using bibtex but then lots of the disambiguation stuff doesn't work anyway). It's really up to the style to allow options like this. It's implemented in the APA style, for example but that uses uniquelist too so you don't need to look at maxnames, just the uniquelist and listcount counters. See apa.cbx starting around line 114. I implemented it in the labelname format, which is a nice place to do it. – PLK Mar 22 '12 at 9:37
@PLK So biber accesses the values passed to the maxname-type option settings - \blx@mincitenames, \blx@maxcitenames, \blx@minbibnames, etc. - only via the "slave" counters minnames and maxnames? Thanks for the APA reference. When I find some time, I'll add an alternative that makes use of the <start>/<stop> arguments to printnames. – Audrey Mar 22 '12 at 14:38
Biber actually uses the specific max/min* settings and does different things with different counters. The higher level maxnames/minnames only exist as a convenience to set all of the max/min* names at once really. – PLK Mar 23 '12 at 19:58