考虑以下 MWE,其.tex
文件由以下部分组成:
\documentclass[xcolor={svgnames},hyperref={colorlinks,allcolors=Blue}]{beamer}
\usepackage[style=authoryear-comp,backend=biber,natbib,hyperref=true]{biblatex}
\addbibresource{References.bib}
\begin{document}
\begin{frame}
\citet{serrano} is a great paper!
\citeauthor{serrano}'s \citeyearpar{serrano} paper is great!
\end{frame}
\begin{frame}
\printbibliography
\end{frame}
\end{document}
并且包含一个.bib
名为References.bib
@article{serrano,
author = "Roberto Serrano",
title = "Reinterpreting the Kernel",
journal = "Journal of Economic Theory",
volume = "77",
number = "1",
pages = "58 -- 80",
year = "1997",
url = "https://doi.org/10.1006%2Fjeth.1997.2314"
}
如下图所示,使用\citet{serrano}
会产生可点击的蓝色链接。但是,使用\citeauthor{serrano}'s \citeyearpar{serrano}
则不会。它看起来不一致,而且显然我无法自行解决此问题。因此,谁能告诉我如何使其\citeyearpar{serrano}
可点击并变成蓝色?
附言:我将这个问题放在 Beamer 中,因为这种行为似乎既没有出现在标准文章中,也没有出现在 KOMA Script 文章中(至少在我当前的完整序言中没有出现)。
非常感谢大家抽出时间。
答案1
您需要添加以下代码:
\DeclareCiteCommand{\citeyearpar}
{}
{\mkbibparens{\bibhyperref{\printdate}}}
{\multicitedelim}
{}
拥有完整的 MWE
\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{serrano,
author = "Roberto Serrano",
title = "Reinterpreting the Kernel",
journal = "Journal of Economic Theory",
volume = "77",
number = "1",
pages = "58 -- 80",
year = "1997",
url = "https://doi.org/10.1006%2Fjeth.1997.2314"
}
\end{filecontents}
\documentclass[%
xcolor={svgnames},
hyperref={colorlinks,allcolors=Blue}
]{beamer}
\usepackage[%
style=authoryear-comp,
backend=biber,
natbib,
hyperref=true
]{biblatex}
\addbibresource{\jobname.bib}
\DeclareCiteCommand{\citeyearpar}
{}
{\mkbibparens{\bibhyperref{\printdate}}}
{\multicitedelim}
{}
\begin{document}
\begin{frame}
\citet{serrano} is a great paper!
\citeauthor{serrano}'s \citeyearpar{serrano} paper is great!
\end{frame}
\begin{frame}
\printbibliography
\end{frame}
\end{document}
你得到你想要的: