假设我们有几个网站条目,并且我们想在文中以 开始引用a
,然后是b
,等等。使用标准 biblatex 符号如下,可以出现b
位于 之前的情况a
:
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage{lipsum}
\usepackage[style=authoryear,
backend=biber,
giveninits=true,
]{biblatex}
\DeclareLabeldate{%
\field{date}
\field{year}
\field{eventdate}
\field{origdate}
\literal{nodate}
}
\begin{filecontents}{\jobname.bib}
@online{wikipedia-link:General,
author = {Everybody},
title = {Wikipedia! General Website},
url = {https://www.wikipedia.org/},
urldate = {2018-01-31},
}
@online{wikipedia-link:ITA,
author = {Everybody},
title = {Wikipedia! Italian Language},
url = {https://it.wikipedia.org/wiki/Pagina_principale},
urldate = {2018-01-31},
}
@online{wikipedia-link:ESP,
author = {Everybody},
title = {Wikipedia! Spanish Language},
url = {https://es.wikipedia.org/wiki/Wikipedia:Portada},
urldate = {2018-01-31},
}
@online{wikipedia-link:English,
author = {Everybody},
title = {Wikipedia! English Language},
url = https://en.wikipedia.org/wiki/Main_Page},
urldate = {2018-01-31},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\begin{document}
\textbf{\autocite{wikipedia-link:General}}
\lipsum[1] \textbf{\textcite{wikipedia-link:English}}
\lipsum[1] \textbf{\textcite{wikipedia-link:ESP}}
\lipsum[1] \textbf{\textcite{wikipedia-link:ITA}}
\printbibliography
\end{document}
因此,在此示例中,在第一段之前提到 Wikipedia 的一般网站概述是有意义的。所以它应该被标记为a
。相反,b
当您编译示例时,它当前被标记为 。是否有任何合适的方法可以获得合理的顺序?按 排序urldate
似乎不正确,因为此字段不是为此目的而设置的。author
有意对所有条目相同。Title
导致错误的顺序,如本例所示。url
也不适合。所以剩下的唯一选择是基于 bib 文件条目手动排序,这对我来说没问题。如何才能实现仅对@online
?其他类型的条目应坚持正常排序。
答案1
有多种方法可以通过向.bib
文件添加字段来覆盖排序机制。以下排序覆盖字段可用:
presort
sortkey
sortname
sorttitle
sortyear
该presort
字段可用于对项目进行分组,与此处无关。sortkey
如果存在该字段,它将覆盖任何其他排序。其他覆盖更具针对性,将覆盖相关排序方法(如果使用)(作者/编辑/译者)、标题或年份。
对于您而言,由于您想要对具有相同作者和年份的项目进行排序,因此您可以sorttitle
在文件中使用一个字段.bib
,并按照您希望相关条目出现的顺序排列。在此示例中,我通过使用将常规页面放在第一位,sorttitle={1}
并按语言名称的字母顺序排列语言页面,通过sortauthor
适当分配来强制执行该顺序。
PS:我认为这不太author={Everybody}
适合维基百科引用,但这与问题的主要观点无关。请参阅引用维基百科。
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage{lipsum}
\usepackage[margin=1in]{geometry}
\usepackage[style=authoryear,
backend=biber,
giveninits=true,
]{biblatex}
\DeclareLabeldate{%
\field{date}
\field{year}
\field{eventdate}
\field{origdate}
\literal{nodate}
}
\begin{filecontents}[overwrite]{\jobname.bib}
@online{wikipedia-link:General,
author = {Everybody},
title = {Wikipedia! General Website},
url = {https://www.wikipedia.org/},
urldate = {2018-01-31},
sorttitle = {1},
}
@online{wikipedia-link:ITA,
author = {Everybody},
title = {Wikipedia! Italian Language},
url = {https://it.wikipedia.org/wiki/Pagina_principale},
urldate = {2018-01-31},
sorttitle = {3},
}
@online{wikipedia-link:ESP,
author = {Everybody},
title = {Wikipedia! Spanish Language},
url = {https://es.wikipedia.org/wiki/Wikipedia:Portada},
urldate = {2018-01-31},
sorttitle = {4},
}
@online{wikipedia-link:English,
author = {Everybody},
title = {Wikipedia! English Language},
url = {https://en.wikipedia.org/wiki/Main_Page},
urldate = {2018-01-31},
sorttitle = {2},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\begin{document}
\textbf{\autocite{wikipedia-link:General}}
\lipsum[1] \textbf{\textcite{wikipedia-link:English}}
\lipsum[1] \textbf{\textcite{wikipedia-link:ESP}}
\lipsum[1] \textbf{\textcite{wikipedia-link:ITA}}
\printbibliography
\end{document}
答案2
您可以biblatex
通过定义新的排序主题板来强制仅考虑名称、年份和引用顺序进行排序。本质上,这意味着在您的引用中,第一次提及的<Name> <year>a
将始终排在等之前<Name> <year>b
。您的读者可能无法仅通过查看参考书目数据来了解条目的顺序(因为它依赖于上下文),但这可能不是什么大问题。
请注意,我对所有条目类型都应用了排序,而不仅仅是@online
,因为一般方案也适用于其他类型,并且在其他类型中同样有意义。
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage{lipsum}
\usepackage[backend=biber,
style=authoryear,
sorting=nyorder,
giveninits=true,
]{biblatex}
\DeclareLabeldate{%
\field{date}
\field{year}
\field{eventdate}
\field{origdate}
\literal{nodate}
}
\DeclareSortingTemplate{nyorder}{
\sort{
\field{presort}
}
\sort[final]{
\field{sortkey}
}
\sort{
\field{sortname}
\field{author}
\field{editor}
\field{translator}
\field{sorttitle}
\field{title}
}
\sort{
\field{sortyear}
\field{year}
}
\sort{\citeorder}
}
\begin{filecontents}{\jobname.bib}
@online{wikipedia-link:General,
author = {Everybody},
title = {Wikipedia! General Website},
url = {https://www.wikipedia.org/},
urldate = {2018-01-31},
}
@online{wikipedia-link:ITA,
author = {Everybody},
title = {Wikipedia! Italian Language},
url = {https://it.wikipedia.org/wiki/Pagina_principale},
urldate = {2018-01-31},
}
@online{wikipedia-link:ESP,
author = {Everybody},
title = {Wikipedia! Spanish Language},
url = {https://es.wikipedia.org/wiki/Wikipedia:Portada},
urldate = {2018-01-31},
}
@online{wikipedia-link:English,
author = {Everybody},
title = {Wikipedia! English Language},
url = {https://en.wikipedia.org/wiki/Main_Page},
urldate = {2018-01-31},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\begin{document}
Lorem \autocite{wikipedia-link:General}
ipsum \textcite{wikipedia-link:English}
dolor \textcite{wikipedia-link:ESP}
sit \textcite{wikipedia-link:ITA}
\printbibliography
\end{document}