Biblatex 引用:两篇文章同一作者,年份-年份全文印刷?

Biblatex 引用:两篇文章同一作者,年份-年份全文印刷?

我引用了同一作者在同一年的两篇文章,引用的键是auth00aauth00b。使用 样式authoryear-comp,我可以使用,textcite{auth00a,auth00b}但这会在结果中给出“Author (2000a,b)”。我更希望得到“Author (2000a, 2000b)”;即完整的年份。有没有简单的方法可以做到这一点?谢谢!

答案1

在序言中添加以下几行(xpatch需要包):

\usepackage{xpatch}
\xpatchbibmacro{textcite}
  {\setunit{\addcomma}\usebibmacro{cite:extrayear}}
  {\setunit{\compcitedelim}\usebibmacro{cite:labelyear+extrayear}}
  {}
  {}

梅威瑟:

\documentclass{article}

\usepackage[backend=biber,style=authoryear-comp]{biblatex}

\usepackage{xpatch}
\xpatchbibmacro{textcite}
  {\setunit{\addcomma}\usebibmacro{cite:extrayear}}
  {\setunit{\compcitedelim}\usebibmacro{cite:labelyear+extrayear}}
  {}
  {}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{auth00a,
  author = {Author},
  title = {MyBook A},
  date = {2000}
}
@article{auth00b,
  author = {Author},
  title = {MyBook B},
  date = {2000}
}
\end{filecontents*}
\addbibresource{\jobname.bib}

\begin{document}
\textcite{auth00a,auth00b}
\end{document} 

输出:

在此处输入图片描述

答案2

假设您希望所有\...cite命令都具有这种行为,而不仅仅是\textcite(问题仅提到\textcite输出),您可以尝试以下方法。这个想法依赖于这样一个事实:为了隐藏年份并仅打印额外的日期字母,biblatex需要记住最后一年。如果我们biblatex忘记最后一年,那么年份将永远不会被省略。

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber, style=authoryear-comp]{biblatex}

\makeatletter
\AtEveryCitekey{\global\undef\cbx@lastyear}
\makeatother

\addbibresource{biblatex-examples.bib}

\begin{document}
Lorem \autocite{knuth:ct:b,knuth:ct:c}

ipsum \autocite{knuth:ct:a,knuth:ct:c}

\printbibliography
\end{document}

Lorem(Knuth 1986a、1986b)ipsum(Knuth 1984、1986b)

答案3

那么,关于xpatch解决方案。在 Moewe 指出我们应该在宏名称中用 -date 替换 -year 之后,结果如下。但我警告你,这不适用于 ext-authoryear-comp,只适用于 authoryear-comp,这确实应该使 Moewe 的“3 行解决方案”(见上文)成为你最喜欢的选择。

   \documentclass{article}

\usepackage[backend=biber,style=authoryear-comp]{biblatex}

\usepackage{xpatch}

\xpatchbibmacro{textcite}
  {\setunit{\addcomma}\usebibmacro{cite:extradate}}
  {\setunit{\compcitedelim}\usebibmacro{cite:labeldate+extradate}}
  {}
  {}

\xpatchbibmacro{cite}
  {\setunit{\addcomma}\usebibmacro{cite:extradate}}
  {\setunit{\compcitedelim}\usebibmacro{cite:labeldate+extradate}}
  {}
  {}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{auth00a,
  author = {Author},
  title = {MyBook A},
  date = {2000}
}
@article{auth00b,
  author = {Author},
  title = {MyBook B},
  date = {2000}
}
\end{filecontents*}
\addbibresource{\jobname.bib}

\begin{document}
\textcite[cf.][56]{auth00a,auth00b}

\cite[cf.][56]{auth00a,auth00b}

\parencite[cf.][56]{auth00a,auth00b}
\end{document}

在此处输入图片描述

相关内容