有时我会引用同一作者在同一年发表的论文或书籍。默认选项是按标题字母顺序排列。因此,如果项目 1 的标题以“A”开头,项目 2 的标题以“Z”开头,并且两者都是 Kagan 于 2012 年出版的,那么项目 1 将是 (Kagan 2012a),项目 2 将是 (Kagan 2012b)。但如果我先引用项目 2,这看起来很奇怪。如何按照我引用的顺序对这些项目进行排序,而不是按标题字母顺序排序?我仍然希望所有其他项目的顺序都按作者姓氏的字母顺序排列,然后是出版年份。谢谢!
以下是 MWE:
\documentclass[12pt]{article}
\usepackage{enumitem} %adjusts lists
\usepackage{baskervillef} %font
\usepackage[T1]{fontenc} %font
\usepackage[margin=25mm]{geometry} %changes margins
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{Kagan2012a,
address = {New Haven, CT},
author = {Kagan, Shelly},
file = {:Users/James/Library/Application Support/Mendeley Desktop/Downloaded/Kagan - 2012 - Death.pdf:pdf},
publisher = {Yale University Press},
title = {{Death}},
year = {2012}
}
@book{Kagan2012,
address = {Oxford},
author = {Kagan, Shelly},
file = {:Users/James/Library/Application Support/Mendeley Desktop/Downloaded/Kagan - 2012 - The Geometry of Desert.pdf:pdf},
publisher = {Oxford University Press},
title = {{The Geometry of Desert}},
year = {2012}
}
\end{filecontents}
%%%%%%%%%%BIBLIOGRAPHY
\usepackage[style=apa6, doi=false, url=false, isbn=false, date=year, natbib=true]{biblatex}
\setlength\bibitemsep{1.5\itemsep}
\AtEveryBibitem{\clearfield{chapter}} %gets rid of chapters
\DeclareFieldFormat{apacase}{#1} %stops capitalisation
\AtEveryBibitem{\clearfield{number}} %clears issue numbers
\DeclareFieldFormat[article]{volume}{\apanum{#1}} %de-italicises volume numbers
\renewcommand*{\finalnamedelim}{%
\ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
\addspace\&\space} %replaces 'and' with '&' in in-text citations.
\addbibresource{\jobname.bib}
%%%%%%%%%%%%%%%%%%%%
%%%commands to stop hyphenation in bibliography
\renewcommand*{\bibsetup}{%
\interlinepenalty=5000\relax
\widowpenalty=10000\relax
\clubpenalty=10000\relax
% no hyphenation in the bibliography
\hyphenpenalty=10000\exhyphenpenalty=10000\relax
% increase allowed stretch to avoid overfull boxes
\setlength{\emergencystretch}{1em}%
\raggedbottom
\frenchspacing
\biburlsetup}
%%%
\title{Change the Ordering of Same-Author Same-Year Citations}
\begin{document}
\maketitle
In 2012, Shelly Kagan wrote two books. Suppose that I cite his book on what people deserve first, \citet{Kagan2012}, and then his book on death, \citet{Kagan2012a}. Since I've cited his book on desert first I would like that one to be (2012a) rather than (2012b). That is, I would like the `a' and `b' to be ordered according to the order in which they are cited as opposed to by the alphabetical order of the titles.
\printbibliography
\end{document}
输出:
答案1
当然,这一变化意味着文档不再符合 APA 样式。如果您不想使用 APA 样式,通常使用通用作者年份标准样式之一 ( style=authoryear,
) 作为基础比以biblatex-apa
或为基础自定义样式更容易biblatex-apa6
。
只需在当前排序模板的正确位置添加即可\sort{\citeorder}
,使引用顺序优先于标题。(您可以apa
在以下位置找到排序模板的原始定义apa6.bbx
,第 189-224 行,于 v8.5 2020/08/28)
\DeclareSortingTemplate{apa}{
\sort{
\field{presort}
}
\sort[final]{
\field{sortkey}
}
\sort{
\field{sortname}
\field{author}
\field{editor}
\field{translator}
\field{writer}
\field{director}
\field{producer}
\field{execproducer}
\field{sorttitle}
\field{title}
}
\sort{
\field{pubstate}
}
\sort{
\field{sortyear}
\field{year}
\literal{-2000000000}% APA has "nodates" coming first
}
\sort{\citeorder}
\sort{
\field{sorttitle}
\field{title}
}
\sort{
\field{volume}
\literal{0}
}
}
然后
\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{baskervillef}
\usepackage[style=apa6, doi=false, url=false, isbn=false, date=year, natbib=true]{biblatex}
\setlength\bibitemsep{1.5\itemsep}
\DeclareFieldFormat{apacase}{#1}
\AtEveryBibitem{%
\clearfield{chapter}
\clearfield{number}}
\DeclareFieldFormat[article]{volume}{\apanum{#1}}
\DeclareDelimFormat{finalnamedelim}{%
\ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
\addspace\&\space}
\renewcommand*{\bibsetup}{%
\interlinepenalty=5000\relax
\widowpenalty=10000\relax
\clubpenalty=10000\relax
\hyphenpenalty=10000\exhyphenpenalty=10000\relax
\setlength{\emergencystretch}{1em}%
\raggedbottom
\frenchspacing
\biburlsetup}
\DeclareSortingTemplate{apa}{
\sort{
\field{presort}
}
\sort[final]{
\field{sortkey}
}
\sort{
\field{sortname}
\field{author}
\field{editor}
\field{translator}
\field{writer}
\field{director}
\field{producer}
\field{execproducer}
\field{sorttitle}
\field{title}
}
\sort{
\field{pubstate}
}
\sort{
\field{sortyear}
\field{year}
\literal{-2000000000}% APA has "nodates" coming first
}
\sort{\citeorder}
\sort{
\field{sorttitle}
\field{title}
}
\sort{
\field{volume}
\literal{0}
}
}
\begin{filecontents}{\jobname.bib}
@book{Kagan2012a,
address = {New Haven, CT},
author = {Kagan, Shelly},
publisher = {Yale University Press},
title = {Death},
year = {2012},
}
@book{Kagan2012,
address = {Oxford},
author = {Kagan, Shelly},
publisher = {Oxford University Press},
title = {The Geometry of Desert},
year = {2012},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
In 2012, Shelly Kagan wrote two books.
Suppose that I cite his book on what people deserve first, \citet{Kagan2012},
and then his book on death, \citet{Kagan2012a}.
Since I've cited his book on desert first
I would like that one to be (2012a) rather than (2012b).
That is, I would like the `a' and `b' to be ordered
according to the order in which they are cited
as opposed to by the alphabetical order of the titles.
\printbibliography
\end{document}
生产