使 \citet 仅在年份显示超链接

使 \citet 仅在年份显示超链接

我怎样才能hyperref仅显示条目中的年份部分\citet

我正在使用\citet,结果是作者和年份以超链接蓝色链接的形式出现。我只想让年份这样显示。

在此处输入图片描述

代码示例为:

\documentclass[onecolumn]{svjour3}       % onecolumn (second format)
\usepackage[authoryear]{natbib}
\setcitestyle{aysep={}}
\usepackage[colorlinks,citecolor=blue,urlcolor=blue,bookmarks=false,hypertexnames=true]{hyperref} 
\usepackage{url}
\def\urlprefix{}
\urlstyle{rm}
\usepackage{etoolbox}
\makeatletter

% Patch case where name and year are separated by aysep
\patchcmd{\NAT@citex}
{\@citea\NAT@hyper@{%
\NAT@nmfmt{\NAT@nm}%
\hyper@natlinkbreak{\NAT@aysep\NAT@spacechar}{\@citeb\@extra@b@citeb}%
\NAT@date}}
{\@citea\NAT@nmfmt{\NAT@nm}%
\NAT@aysep\NAT@spacechar\NAT@hyper@{\NAT@date}}{}{}

% Patch case where name and year are separated by opening bracket
\patchcmd{\NAT@citex}
{\@citea\NAT@hyper@{%
\NAT@nmfmt{\NAT@nm}%
\hyper@natlinkbreak{\NAT@spacechar\NAT@@open\if#1\else#1\NAT@spacechar\fi}%
{\@citeb\@extra@b@citeb}%
\NAT@date}}
{\@citea\NAT@nmfmt{\NAT@nm}%
\NAT@spacechar\NAT@@open\if#1\else#1\NAT@spacechar\fi\NAT@hyper@{\NAT@date}}
{}{}

\makeatother
\begin{document}

\title{title title title
}

... and marine environmental monitoring programs \citep{GuptaandSingh2011}. \citet{ElderCollins} pointed out the convenience of using introduced species as monitoring organisms because of their physiological tolerance range and their wide... 

\renewcommand*{\bibfont}{\footnotesize}
\bibliographystyle{spbasic}
\bibliography{RefLimnoBECT}

\end{document}

bibtex 也是:

@incollection{ElderCollins,
  title={Freshwater molluscs as indicators of bioavailability and toxicity of metals in surface-water systems},
  author={Elder, John F and Collins, Jerilyn J},
  booktitle={Reviews of Environmental Contamination and Toxicology},
  editor={Ware, GW},  
  pages={37--79},
  year={1991},
  publisher={Springer}, 
  address={New York},
}

非常感谢您的帮助!

答案1

我刚刚搞清楚了,补丁代码中用左括号分隔时出现了错误。我决定把这个问题和我的答案一起留下,希望它能帮助到别人。

正确的补丁应该是:

% Patch case where name and year are separated by opening bracket
\patchcmd{\NAT@citex}
  {\@citea\NAT@hyper@{%
     \NAT@nmfmt{\NAT@nm}%
     \hyper@natlinkbreak{\NAT@spacechar\NAT@@open\if*#1*\else#1\NAT@spacechar\fi}%
       {\@citeb\@extra@b@citeb}%
     \NAT@date}}
  {\@citea\NAT@nmfmt{\NAT@nm}%
   \NAT@spacechar\NAT@@open\if*#1*\else#1\NAT@spacechar\fi\NAT@hyper@{\NAT@date}}
  {}{} 

相关内容