![如何使用 Biblatex 根据作者数量对参考文献列表进行排序?](https://linux22.com/image/343594/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%20Biblatex%20%E6%A0%B9%E6%8D%AE%E4%BD%9C%E8%80%85%E6%95%B0%E9%87%8F%E5%AF%B9%E5%8F%82%E8%80%83%E6%96%87%E7%8C%AE%E5%88%97%E8%A1%A8%E8%BF%9B%E8%A1%8C%E6%8E%92%E5%BA%8F%EF%BC%9F.png)
我的论文指南对参考文献列表的排序有具体要求,这取决于作者的字母顺序、出版年份以及作者的数量。我很难按作者数量排序。
规则如下:
- 作者必须按字母顺序排列(升序)
- 如果一位作者有多部出版物,则必须按出版年份排序(升序)。
- 如果一位作者撰写的论文有不同数量的合著者,则参考文献必须按合著者数量的升序排列:所有有两位合著者的论文、所有有三位合著者的论文,...
例如,这将是适当的顺序:
作者,A(2010)......
作者,A,Cuthor,C (2005)......
作者,A,Duthor,D (1990)......
作者,A,Duthor,D (2000)......
作者,A,Buthor,B,Cuther,C (2000)......
等等。我很难根据作者数量进行排序。我正在使用最新版本的 Biblatex,采用作者/年份引用样式 - 有没有办法获得合适的参考列表?
答案1
满足这种(愚蠢的)排序方案需要使用一些高级功能。您应该使用自定义字段进行排序,并使用源映射用由作者数量决定的构造来填充该字段。我们在这里所做的是有效地计算and
作者姓名列表中的 s 数量,由于 BibTeX 姓名格式,它是姓名的数量。因此,s 的连接and
是一个字符串,可用于对条目进行排序。然后,自定义排序方案在按字母顺序排序之前对此字段进行排序:
\documentclass{article}
\usepackage{csquotes}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{AuthorA2010,
title={Titlea},
author={Author, Alan},
journal={Journala},
volume={10},
pages={1--3},
year={2010},
publisher={Publishera}
}
@article{AuthorAC2005,
title={Titleac},
author={Author, Alan and Cuthor, Carla},
journal={Journalac},
volume={10},
pages={1--3},
year={2005},
publisher={Publisherac}
}
@article{AuthorAD1990,
title={Titlead},
author={Author, Alan and Duthor, David},
journal={Journalad},
volume={10},
pages={1--3},
year={1990},
publisher={Publisherad}
}
@article{AuthorAD2000,
title={Titlead two},
author={Author, Alan and Duthor, David},
journal={Journalad two},
volume={10},
pages={1--3},
year={2000},
publisher={Publisherad two}
}
@article{AuthorABD2000,
title={Titleabd},
author={Author, Alan and Bill Buthor and Cuthor, Carla},
journal={Journalabd},
volume={10},
pages={1--3},
year={2000},
publisher={Publisherabd}
}
\end{filecontents}
\usepackage[style=authoryear,firstinits=true, dashed=false,sorting=custsort]{biblatex}
\addbibresource{\jobname.bib}
\DeclareSortingScheme{custsort}{
\sort{
\field{presort}
}
\sort[final]{
\field{sortkey}
}
\sort{
\field{usera}
}
\sort{
\field{sortname}
\field{author}
\field{editor}
\field{translator}
\field{sorttitle}
\field{title}
}
\sort{
\field{sortyear}
\field{year}
}
}
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map{
\step[fieldsource=author]
\step[fieldset=usera, origfieldval]
\step[fieldsource=usera, match=\regexp{.+?\sand\s}, replace=\regexp{and}]
\step[fieldsource=usera, match=\regexp{((?:and)*).+}, replace=\regexp{$1}]
}
}
}
\begin{document}
\nocite{*}
\printbibliography
\end{document}
答案2
我认为实现这种疯狂排序的最简单方法是sortname
在你想要更改顺序的围兜项目中添加适当的内容:
\begin{filecontents}{crazybib.bib}
@article{AuthorA2010,
title={Titlea},
author={Author, Alan},
journal={Journala},
volume={10},
pages={1--3},
year={2010},
publisher={Publishera}
}%
@article{AuthorAC2005,
title={Titleac},
author={Author, Alan and Cuthor, Carla},
journal={Journalac},
volume={10},
pages={1--3},
year={2005},
publisher={Publisherac}
}%
@article{AuthorAD1990,
title={Titlead},
author={Author, Alan and Duthor, David},
journal={Journalad},
volume={10},
pages={1--3},
year={1990},
publisher={Publisherad}
}%
@article{AuthorAD2000,
title={Titlead two},
author={Author, Alan and Duthor, David},
journal={Journalad two},
volume={10},
pages={1--3},
year={2000},
publisher={Publisherad two}
}%
@article{AuthorABD2000,
title={Titleabd},
author={Author, Alan and Bill Buthor and Cuthor, Carla},
sortname={Author, Alan and Zzzz},% or everything makes the sort correct
journal={Journalabd},
volume={10},
pages={1--3},
year={2000},
publisher={Publisherabd}
}%
\end{filecontents}
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage[english]{babel}
\usepackage[style=authoryear, natbib=true, backend=biber,firstinits=true, dashed=false]{biblatex}
\usepackage{csquotes}
\addbibresource{crazybib.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}