对于我的论文,我需要引用以下作者:
Some text form Author (2013) says that etc
然而,当引用多个来源时,格式应该是
Some statement dictates such and such [Author I (2012), Author 2 et al. (2005)]
我正在使用 biblatex 来生成我的参考书目。
biblatex 配置是
\usepackage[
natbib=true,
citestyle=authoryear-comp,
bibstyle=authoryear,
hyperref=false,
backend=biber,
maxbibnames=99,
uniquename=false,
maxcitenames=1,
dashed=false,
url=false,
doi=false,
isbn=false,
eprint=false,
]{biblatex}
\renewcommand{\cite}{\textcite}
\DeclareFieldFormat[article]{volume}{\textbf{#1}\addcolon\space}
% remove "in:" from articles.
\renewbibmacro{in:}{%
\ifentrytype{article}{}{%
\printtext{\bibstring{in}\intitlepunct}}}
所以我的显而易见的问题是如何在引用多个来源时实现括号?
答案1
在 biblatex 中,可以通过两种方式进行多重引用:1) 使用传统命令,例如\textcite{key1,key2,...}
2) 使用“multicite”命令,例如\textcites{key1}{key2}...
(我省略了前注和后注,因为它们在类似 textcite 的命令中可能没用;但您可以使用它们,请参阅 biblatex 手册)。所以我们需要调整这些命令。但关键是\textcite(s)
--- 不像\cite(s),\parencite(s)
等 --- 的设计使得直接重新定义它们很困难(或不可能?)。但我们可以改变一些内部结构。
首先,我们需要定义一个包装器,以避免在只有一个entrykey时使用括号:
\newcommand*{\mywrapper}[1]{%
\ifthenelse{\value{textcitetotal}>1}
{\mkbibbrackets{#1}}
{#1}}
然后,对于第一种情况我们这样做:
\makeatletter
\DeclareCiteCommand{\cbx@textcite}[\mywrapper]
{\usebibmacro{cite:init}}
{\usebibmacro{citeindex}%
\usebibmacro{textcite}}
{}
{\usebibmacro{textcite:postnote}}
\makeatother
对于第二种情况(我认为这是更可取的):
\makeatletter
\DeclareMultiCiteCommand{\cbx@textcites}[\mywrapper]{\cbx@textcite}{}
\makeatother
要更改分隔符(如果需要):
\renewcommand*{\textcitedelim}{\addcomma\space}
简短的 MWE:
\documentclass{article}
\usepackage[
natbib=true,
citestyle=authoryear-comp,
bibstyle=authoryear,
hyperref=false,
backend=biber,
maxbibnames=99,
uniquename=false,
maxcitenames=1,
dashed=false,
url=false,
doi=false,
isbn=false,
eprint=false,
]{biblatex}
\bibliography{biblatex-examples.bib}
\renewcommand*{\textcitedelim}{\addcomma\space}% if you want another delimiter
\newcommand*{\mywrapper}[1]{%
\ifthenelse{\value{textcitetotal}>1}
{\mkbibbrackets{#1}}
{#1}}
\makeatletter
\DeclareMultiCiteCommand{\cbx@textcites}[\mywrapper]{\cbx@textcite}{}
\DeclareCiteCommand{\cbx@textcite}[\mywrapper]
{\usebibmacro{cite:init}}
{\usebibmacro{citeindex}%
\usebibmacro{textcite}}
{}
{\usebibmacro{textcite:postnote}}
\makeatother
\begin{document}
\textcites{knuth:ct}
\par\textcites{stdmodel}{knuth:ct}{doody}
\par\textcite{knuth:ct}
\par\textcite{stdmodel,knuth:ct,doody}
\end{document}