![Biblatex:对合格引文列表 \parencites 中的引文进行排序](https://linux22.com/image/320224/Biblatex%EF%BC%9A%E5%AF%B9%E5%90%88%E6%A0%BC%E5%BC%95%E6%96%87%E5%88%97%E8%A1%A8%20%5Cparencites%20%E4%B8%AD%E7%9A%84%E5%BC%95%E6%96%87%E8%BF%9B%E8%A1%8C%E6%8E%92%E5%BA%8F.png)
答案如下https://tex.stackexchange.com/a/70183/56450,我试图对\parencites
命令中的键进行正确的排序,包括前后注释。有没有等效的方法可以做到这一点?我所有的尝试都失败了。
梅威瑟:
%!TEX program = lualatex
\documentclass{scrbook}
\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage{german}
\usepackage{csquotes}
\usepackage[backend=biber%
,style=apa%
,maxcitenames=5%
,uniquename=full%
,sortcites%
]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{refs.bib}
@incollection{Klieme,
author = {Klieme, E.},
title = {Titel},
year = {2001},
}
@book{Clausen,
author = {Clausen, M.},
title = {Titel},
year = {1998},
}
\end{filecontents}
\addbibresource{refs.bib}
\begin{document}
\noindent
\verb+\parencite{Klieme,Clausen}+: \parencite{Klieme,Clausen}, correct sorting\\
\verb+\parencites{Klieme,Clausen}+: \parencites{Klieme,Clausen}, correct sorting\\
\verb+\parencites[vergl.][51]{Klieme}[114]{Clausen}+: \parencites[vergl.][51]{Klieme}[114]{Clausen}, wrong sorting
\end{document}
答案1
奥黛丽的很好的答案\cites
使用命令对引用进行排序biblatex
仅重新定义了\cites
命令,但添加对其他命令的支持\...cites
却出奇地(或者可能并不出奇地)容易。
因为\parencites
我们只需要另外两行
\DeclareMultiCiteCommand{\cbx@parencites}[\mkbibparens]{\parencite}{\multicitedelim}
\DeclareMultiCiteCommand{\parencites}[\cbx@cite@wrapper\cbx@parencites]{\cbx@cite}{}
类似\textcites
地
\DeclareMultiCiteCommand{\cbx@textcites}{\textcite}{\multicitedelim}
\DeclareMultiCiteCommand{\textcites}[\cbx@cite@wrapper\cbx@textcites]{\cbx@cite}{}
平均能量损失
\documentclass{article}
\usepackage[backend=biber%
,style=authoryear%
,maxcitenames=5%
,uniquename=full%
,sortcites%
]{biblatex}
\makeatletter
\DeclareMultiCiteCommand{\cbx@parencites}[\mkbibparens]{\parencite}{\multicitedelim}
\DeclareMultiCiteCommand{\parencites}[\cbx@cite@wrapper\cbx@parencites]{\cbx@cite}{}
\DeclareMultiCiteCommand{\cbx@textcites}{\textcite}{\multicitedelim}
\DeclareMultiCiteCommand{\textcites}[\cbx@cite@wrapper\cbx@textcites]{\cbx@cite}{}
% 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}
\begin{document}
\noindent
\parencite{wilde,sigfridsson}\\
\parencites{wilde,sigfridsson}\\
\parencites[vergl.][51]{wilde}[114]{sigfridsson}\\
\parencites{knuth:ct:c}{knuth:ct:b}{knuth:ct:a}
\noindent
\cite{wilde,sigfridsson}\\
\cite{wilde,sigfridsson}\\
\cites[vergl.][51]{wilde}[114]{sigfridsson}\\
\cites{knuth:ct:c}{knuth:ct:b}{knuth:ct:a}
\noindent
\textcite{wilde,sigfridsson}\\
\textcite{wilde,sigfridsson}\\
\textcites[vergl.][51]{wilde}[114]{sigfridsson}\\
\textcites{knuth:ct:c}{knuth:ct:b}{knuth:ct:a}
\end{document}