答案如下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}