我正在编写自定义引用样式,并尝试编写排序规则。我希望参考书目中的名称仅按姓氏排序,忽略所有名字和首字母。但是,我还希望在实际参考书目列表中打印首字母。这是一个最小的工作示例:
\documentclass[10pt]{article}
\usepackage[style=authoryear,backend=biber,sorting=last]{biblatex}
\DeclareNameFormat{lastname}{#1\addspace}
\DeclareNameFormat{last-init}{#1 #4\addspace}
\DeclareNameAlias{sortname}{lastname}
\DeclareNameAlias{default}{lastname}
\DeclareNameAlias{author}{last-init}
\DeclareSortingScheme{last}{
\sort{
\field{presort}
}
\sort[final]{
\field{author}
}
\sort{
\field{title}
\field{year}
}
}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{first,
author = {John Doe and Mary Jane},
title = {Lorem Ipsum},
publisher = {Oxford University Press},
location = {Oxford},
}
@book{second,
author = {Apple Doe and Mary Sue},
title = {Another},
publisher = {Cambridge},
location = {Cambridge},
date = {1917},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}
这将打印出引用:
Doe A. Sue M. (1917). Another. Cambridge: Cambridge.
Doe J. Jane M. Lorem Ipsum. Oxford: Oxford University Press.
但是,这使用首字母来消除具有相同姓氏的歧义,而不是使用第二个姓氏。结果应该是:
Doe J. Jane M. Lorem Ipsum. Oxford: Oxford University Press.
Doe A. Sue M. (1917). Another. Cambridge: Cambridge.
答案1
alphabetic
这可以通过结合风格(及其排序模式)的想法来实现。
首先,加载 labelalpha
选项。然后将其包含labelname
在排序方案中。
所以你需要
\usepackage[style=authoryear,backend=biber,sorting=last,labelalpha]
{biblatex}
排序模式的定义如下:
\DeclareSortingScheme{last}{
\sort{
\field{presort}
}
\sort{
\field{labelalpha}
}
\sort{
\field{author}
}
\sort{
\field{title}
\field{year}
}
}