BibLatex:本地更改最大作者数量

BibLatex:本地更改最大作者数量

biblatex1.6“从 \printbibliography 和相关程序中删除了本地 max/minnames 和 max/minitems 选项以加强一致性。请使用全局选项。”(发行说明)。但是,当使用多个printbibliographyeg 列出与项目合作伙伴相对应的参考文献,然后列出来自文献的参考文献时,能够在本地更改设置并拥有更紧凑的参考书目会很有用。

如何绕过这个限制?理想情况下,我会根据字段的内容增加或修改计数器keywords

答案1

\printbibliography由于后端(Biber 或 BibTeX)需要知道的值(min/max)(bib/cite)names才能正确计算 s 之类的内容,因此删除了per-选项uniquelist。如果您在文档中间更改该值,则这些派生特征的结果可能会变得很奇怪。

计数器仍可在侧面访问biblatex,因此简单的方法是相应地设置它们。如前所述,当高级功能发挥作用时,这可能会在极端情况下产生不良结果。

\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也可以按条目进行设置,结合 Biber 的源映射,您可以按关键字进行设置。

这种方法的巨大优势在于,所有后端创建的功能uniquelist都会知道这些设置并正确运行,但这也意味着每个条目的值都是固定的。

\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}

答案2

由于问题很笼统,我展示了如何maxcitenames在文档中进行本地更改。(基于上面的@moewes 回答)

在我们文档的某些地方,我们可能想要明确提及某部作品的所有作者。

\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}

在此处输入图片描述

相关内容