4

I am having my biblatex defaults to switch to 'et al.' rather late (past three authors). Now I have occasions where the repeated mention of an author asks for a short form 'Author et al.', irrespective of the number of co-authors. I already use a custom name format like this:

\DeclareNameFormat{idem}{%
  \usebibmacro{name:last}{#1}{#3}{#5}{#7}%
  \usebibmacro{name:andothers}}

How would I create another name format, say with \DeclareNameFormat{short} that always resorts to 'et al.' if there is more than one author; without changing my global biblatex style settings (maxnames -- don't want to touch it!). Is there any other macro than name:andothers that I can use?


The answer of @lockstep gets close. But I want to have \citeauthor{A01} behave normally, except for cases where I repeat the authors multiple times. I can of course add a duplicate entry with this technique; still I wonder if I can get the following 'naive' idea taken from that answer to work:

\newcommand{\personshort}[1]{\defcounter{maxnames}{1}\citeauthor{#1}}

This 'works' but seems to overwrite maxnames for the rest of the document. how would I encapsulate the defcounter to be effective only inside this \newcommand?

lockstep
  • 250,273
Emit Taste
  • 4,404

2 Answers2

5

Instead of defining a special name format, I suggest the following:

  • Define a new bibliography category and add the "special occasion" keys to it,

  • Use \AtEveryCitekey to test for this category and, if true, set maxnames to 1 locally (using \defounter from the etoolbox package, which is loaded by biblatex).


\documentclass{article}

\usepackage[style=authoryear]{biblatex}

\DeclareBibliographyCategory{alwaysetal}
\addtocategory{alwaysetal}{A01}

\AtEveryCitekey{%
  \ifcategory{alwaysetal}{%
    \defcounter{maxnames}{1}%
  }{%
  }%
}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@misc{A01,
  author = {A and B and C},
  year = {2001},
  title = {Alpha},
}
@misc{D02,
  author = {D and E and F},
  year = {2002},
  title = {Bravo},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

\cite{A01}

\cite{D02}

\printbibliography

\end{document}

enter image description here

lockstep
  • 250,273
  • Thank you, lockstop. The defcounter seems to do the trick, but can I use it within a dedicated command instead of adding particular bibliography entries to a category (see my edited question)? – Emit Taste Jun 26 '12 at 10:10
3

Using the above answer along with another related answer from @lockstep, I arrived at the following, which seems to be what I want:

\newcommand{\personshort}[1]{\begingroup%
\defcounter{maxnames}{1}\citeauthor{#1}%
\endgroup}

This temporarily sets the maxnames count to one, and I have a dedicated command \personshort for the occasions where I want the fallback to 'at al.' immediately.


In my wider context I use a \person command with two arguments, the latter being the name format (called \formatname in this answer). I was able then to change that do conditionally use the above command instead of a name format:

\newcommand*{\person}[2]{%
  \ifstrequal{#2}{short}{\personshort{#1}}{\citename{#1}[#2]{author}}%
}

So I have for example \person{miller1960plans}{sci} for the longest format, using initials and up to three names, then \person{miller1960plans}{idem} for normal repetitions, leaving out the initials, and \person{miller1960plans}{short} for the coercion to 'et al' despite a number of co-authors smaller than or equal to maxnames.

  • sci: G. A. Miller, E. Galanter and K. H. Pribram
  • idem: Miller, Galanter and Pribram
  • short: Miller et al.
Emit Taste
  • 4,404