2

Here's the deal: I have a biblatex bibliography with a prenote. The prenote contains a citation with a lot of authors. I want it to behave as if it were obeying maxnames=3. But I want my bibliography to behave as if maxnames=99. Is there a way to set the value of maxnames locally for that one citation?

More generally, is there a procedure for locally setting biblatex options?

lockstep
  • 250,273
Seamus
  • 73,242

1 Answers1

2

This is the first time I encountered a citation command within the bibliography. Note: \defcounter (an etoolbox macro) instead of \setcounter allows for local redefinition of counters. (EDIT: I used the same hack in my answer to Adding an [AuthorYear] block at the beginning of bibliography entries .)

\documentclass{article}

\usepackage[style=authoryear,maxnames=99,maxcitenames=3]{biblatex}

\newcounter{mymaxcitenames}
\AtBeginDocument{%
  \setcounter{mymaxcitenames}{\value{maxnames}}% i.e., 3 (!)
}

\defbibnote{recommended}{If you don't have time to read anything else, read
  \begingroup
  \defcounter{maxnames}{\value{mymaxcitenames}}%
  \textcite{A01}.%
  \endgroup
}

\usepackage{filecontents}

\begin{filecontents}{biblatextest.bib}
@misc{A01,
  author = {Author, A. and Buthor, B., and Cuthor, C. and Duthor, D.},
  year = {2001},
  title = {Alpha},
}
\end{filecontents}

\addbibresource{biblatextest.bib}

\begin{document}

If you don't have time to read anything else, read \textcite{A01}.

\printbibliography[prenote=recommended]

\end{document}
lockstep
  • 250,273
  • @lockstep the reason for the citation in the prenote is to reference where the figures in the paper are originally found. I'd have thought that wasn't that uncommon... – Seamus Mar 07 '11 at 14:31
  • @Seamus: If my answer wasn't useful for you, I'd like to hear how to sharpen it up. – lockstep Mar 08 '11 at 17:56
  • @lockstep I actually think maxcitenames will solve my problem on its own, won't it? I don't think my version of biblatex has it though, so I will have to update... I'll check back later. – Seamus Mar 08 '11 at 19:04
  • @Seamus: For versions <1.1, delete the maxnames and maxcitenames preamble options, add [maxnames=99] to \printbibliography and try again. – lockstep Mar 08 '11 at 19:12
  • @lockstep I've updated to 1.2a. Citations in the prenote inherit their cite style from the printbibliography command, so annoyingly, a \cite inside the prenote prints all the authors. I'll try your solution in a while... – Seamus Mar 09 '11 at 11:19
  • @lockstep This works thanks. Why doesn't the prenote respond to maxcitenames rather than maxbibnames? That seems strange. Especially given the fact that prenote doesn't respect \bibfont. That seems inconsistent... – Seamus Mar 11 '11 at 11:36