我有一个References.bib
包含如下两个条目的文件:
@article{hartmascolell,
author = "Sergiu Hart and Andreu Mas-Colell",
title = "Bargaining and Value",
journal = "Econometrica",
volume = "64",
number = "2",
pages = "357 -- 380",
year = "1996",
url = "https://doi.org/10.2307/2171787"
}
@article{hartmascolell2,
author = "Sergiu Hart and Andreu Mas-Colell",
title = "Potential, Value, and Consistency",
journal = "Econometrica",
volume = "57",
number = "3",
pages = "589 -- 614",
year = "1989",
url = "https://doi.org/10.2307/1911054"
}
然后我有了我的主文档,其中我定义了一种自定义样式,citeyearpar
将我的引用年份设为可点击的超链接。
\documentclass{article}
\usepackage[]{biblatex}
\usepackage[colorlinks=true]{hyperref}
\addbibresource{References.bib}
% REDEFINING CITEYEAR
\DeclareCiteCommand{\citeyear}
{}
{\bibhyperref{\printdate}}
{\multicitedelim}
{}
\DeclareCiteCommand{\citeyearpar}
{}
{\mkbibparens{\bibhyperref{\printdate}}}
{\multicitedelim}
{}
\begin{document}
\citeauthor{hartmascolell}'s \citeyearpar{hartmascolell2,hartmascolell} approach...
\end{document}
输出如下:
我希望有 (1989, 1996),而不是 (1989),(1996)。我怎样才能做到这一点?另外,我怎样才能更改分隔符(即得到“(1989;1996)”而不是“(1989,1996)”?
答案1
这个怎么样?
\documentclass{article}
\usepackage[]{biblatex}
\usepackage[colorlinks=true]{hyperref}
\addbibresource{References.bib}
% REDEFINING CITEYEAR
\DeclareCiteCommand{\citeyear}
{}
{\bibhyperref{\printdate}}
{\multicitedelim}
{}
\DeclareCiteCommand{\citeyearpar}
{\bibopenparen}
{\bibhyperref{\printdate}}
{;}
{\bibcloseparen}
\begin{document}
\citeauthor{hartmascolell}'s \citeyearpar{hartmascolell2,hartmascolell} approach...
\end{document}
答案2
如果您想要作者年份引文,则应使用\parencite*
省略作者姓名的括号引文。对于“压缩”输出,您需要-comp
类似这样的样式authoryear-comp
。
这种方法的优点是,当你改变引用样式时,它也能很好地工作。此外,它在标记中稍微更具语义性。
\documentclass{article}
\usepackage[style=authoryear-comp]{biblatex}
\usepackage[colorlinks=true]{hyperref}
\addbibresource{biblatex-examples.bib}
\begin{document}
\Citeauthor{knuth:ct:a}'s \parencite*{knuth:ct:a,knuth:ct:b} approach\dots
\Textcite{knuth:ct:a,knuth:ct:b} showed\dots
\printbibliography
\end{document}