3

biblatex 1.6 "removed the local max/minnames and max/minitems options from \printbibliography and friends to enforce consistency. Please use the global options instead." (Release notes). However, when using several printbibliography e.g. to list the references corresponding to partners of a project and then references from the literature, it feels useful to be able to change the setting locally and have a more compact bibliography.

How can one bypass this limitation? Ideally I'd increment or modify a counter depending on the content of the keywords field.

2 Answers 2

6

The per-\printbibliography option has been removed since the backend (Biber or BibTeX) needs to know the value for (min/max)(bib/cite)names in order to calculate things like uniquelists correctly. If you change the value mid-document then the results of these derived features may come out weird.

The counters are still accessible on the biblatex side, so the naive approach would be to set them accordingly. As already mentioned that could yield undesirable results in edge cases when advanced features come into play.

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[style=authoryear, backend=biber]{biblatex}

\makeatletter
\newrobustcmd*{\setmaxbibnames}{\numdef\blx@maxbibnames}
\newrobustcmd*{\setminbibnames}{\numdef\blx@minbibnames}
\makeatother

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{four,
  author  = {One and Two and Three and Four},
  title   = {Four},
  date    = {2004},
}
@book{fouragain,
  author  = {One and Two and Three and Four},
  title   = {Four},
  date    = {2004},
  keywords = {again},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\cite{four,fouragain}
\begingroup
\setmaxbibnames{999}
\printbibliography[keyword=again]
\endgroup
\printbibliography[notkeyword=again]
\end{document}

(min/max)(bib/cite)names can also be set on a per-entry basis, together with Biber's sourcemapping you can set them per keyword.

This approach has the huge advantage that all backend-created features like uniquelist will be aware of the settings and will act correctly, but it also means that the value is fixed for every entry.

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[style=authoryear, backend=biber]{biblatex}

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
     \step[fieldsource=keywords, match=\regexp{\bagain\b}, final]
     \step[fieldset=options, fieldvalue={,maxbibnames=999}, append]
    }
  }
}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{four,
  author  = {One and Two and Three and Four},
  title   = {Four},
  date    = {2004},
}
@book{fouragain,
  author  = {One and Two and Three and Four},
  title   = {Four},
  date    = {2004},
  keywords = {again},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\cite{four,fouragain}
\printbibliography[keyword=again]
\printbibliography[notkeyword=again]
\end{document}
1

As the question is general, I show how to change the maxcitenames locally in the document. (Based on @moewes answer above)

At some points of our document, we might want to explicitly mention all authors of a work.

\documentclass{article}
\usepackage[utf8]{inputenc}

%Here I set the maxcitenames as 2 for the document, unless the command \setmaxcitenames is used
\usepackage[style=authoryear, backend=biber, natbib=true, maxcitenames=2]{biblatex}

%This commands overrides the above package option
\makeatletter
\newrobustcmd*{\setmaxcitenames}{\numdef\blx@maxcitenames}
\makeatother

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{kottwitz2011latex,
author = {Kottwitz, Stefan},
publisher = {Packt Publishing},
title = {{LaTeX Beginner's Guide}},
url = {http://proquest.tech.safaribooksonline.de/9781847199867},
year = {2011}
}
@book{goossens1994latex,
author = {Goossens, Michel and Mittelbach, Frank and Samarin, Alexander and Souidi, El Mamoun},
pages = {1120},
publisher = {Addison-Wesley Reading, Massachusetts},
title = {{The LATEX companion}},
url = {http://proquest.tech.safaribooksonline.de/0201362996},
volume = {2},
year = {1994}
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}
%Here is the preamble value maxnamecites 2
\citeauthor{kottwitz2011latex} has written a good book: \citetitle{kottwitz2011latex}, but \citeauthor{goossens1994latex} have written a classic, namely, \citetitle{goossens1994latex}.\\

%Now we change the maxnamecites to 10
\setmaxcitenames{10}
\citeauthor{kottwitz2011latex} has written a good book: \citetitle{kottwitz2011latex}, but \citeauthor{goossens1994latex} have written a classic, namely, \citetitle{goossens1994latex}.\\

%Finally, we set back to the default maxnamecites 2
\setmaxcitenames{2}
\citeauthor{kottwitz2011latex} has written a good book: \citetitle{kottwitz2011latex}, but \citeauthor{goossens1994latex} have written a classic, namely, \citetitle{goossens1994latex}.


\printbibliography
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .