我用biblatex
它来做引文和参考书目。现在我经常有多个引文列表,这个命令biblatex
可以帮到我\cites
。现在如果我不需要页码,我可以让引文自动排序,但是页码就无法正确排序了。
我想要的是所有引用都按时间顺序排列(最早的引用排在最前面)。这可能吗,还是我必须手动执行?
这是一个例子。
\documentclass[11pt,oneside]{memoir}
\usepackage[
style=authortitle,
useprefix=false,
maxnames=2,
firstinits=true,
sortcites=true,
uniquename=init,
abbreviate=true,
backend=biber,
sorting=ynt
]{biblatex}
\begin{filecontents}{jobname.bib}
@book{tom1,
author = {Author, A.},
year = {2001},
title = {This book is from 2001},
shorttitle = {2001},
}
@book{tom2,
author = {Author, A.},
year = {1999},
title = {This book is from 1999},
shorttitle = {1999},
}
\end{filecontents}
\addbibresource{jobname.bib}
\begin{document}
This one is corrent.\footnote{\Cites{tom1,tom2}.}
This one is corrent.\footnote{\Cite{tom1,tom2}.}
This one is incorrent.\footnote{\Cites{tom1}{tom2}.}
This one is incorrent.\footnote{\Cites[1]{tom1}[12]{tom2}.}
\end{document}
答案1
由 moewe 于 2018-07-14 针对 >= v3.8 编辑。查看旧版本
biblatex
的编辑历史。biblatex
multicite 命令可以接受任意多个参数。它们并非设计用于输出排序的引文列表。可以构建一个两遍版本,\cites
它将生成排序的合格引文列表。
\documentclass{article}
\usepackage[style=authortitle,sorting=ynt,sortcites]{biblatex}
\makeatletter
% original definition of \cites
\DeclareMultiCiteCommand{\cbx@cites}{\cite}{\multicitedelim}
% new definition
\DeclareMultiCiteCommand{\cites}[\cbx@cite@wrapper\cbx@cites]{\cbx@cite}{}
% first pass saves keys, prenotes, postnotes
\DeclareCiteCommand{\cbx@cite}
{\csxdef{prenote:\thefield{entrykey}}{\thefield{prenote}}}
{\listxadd\cbx@savekeys{\thefield{entrykey}}}
{}
{\csxdef{postnote:\thefield{entrykey}}{\thefield{postnote}}}
% second pass outputs sorted citation list
\newrobustcmd{\cbx@cite@wrapper}[2]{%
\def\cbx@savekeys{}%
\def\cbx@citecall{#1}%
#2\cbx@sortkeysinit\cbx@citesort\cbx@citecall}
% internal list of saved keys => sorted argument list
\def\cbx@citesort{%
\def\do##1{%
\ifinlist{##1}{\cbx@savekeys}
{\protected@xappto\cbx@citecall{%
[\csuse{prenote:##1}][\csuse{postnote:##1}]{##1}}}
{}}%
\dolistloop{\cbx@sortkeys}}
% internal list of sorted entry keys
\def\cbx@sortkeysinit{%
\ifcsundef{blx@dlist@entry@\the\c@refsection @\blx@refcontext@context}
{}
{\global\csletcs{cbx@sortkeys}{blx@dlist@entry@\the\c@refsection @\blx@refcontext@context}}}
\def\cbx@sortkeys{}
\makeatother
\addbibresource{biblatex-examples.bib}
\newcommand{\cmd}[1]{\texttt{\textbackslash #1}}
\setlength{\parindent}{0pt}
\begin{document}
\cmd{cite}: \cite{companion,ctan,vangennep,markey} \\
\cmd{cites}: \cites[e.g.][10]{companion}{ctan}{markey}[10--11]{vangennep} \\
\cmd{Cites}: \Cites{ctan}{markey}[e.g.][5--10]{companion}[10--11]{vangennep}
\printbibliography
\end{document}
请注意,这个新版本\cites
不能正确支持以下形式的multiprenote
参数multipostnote
\cites(<pre>)(<post>)...
整洁的解决方案可能需要扩展biblatex
内部结构。我们应该考虑这一点,因为\textcites
冗长的样式也受到同样的限制。