1

I am using apacite package for references with author year citation style. I need links only for the year. How to achieve this?

MWE:

\documentclass{article}

\usepackage{hyperref}

\usepackage[natbibapa]{apacite}

\begin{document}

\noindent

See \verb+\citep{Adams2004}+ - \citep{Adams2004}\\

\verb+\citet{Adams2004}+ - \citet{Adams2004}\\

\verb+\citeyear{Adams2004}+ - \citeyear{Adams2004}\\

\verb+\citeauthor{Adams2004}+ - \citeauthor{Adams2004}\\

\verb+\citealp{Adams2004}+ - (\citealp{Adams2004}).

\begin{thebibliography}{}

\bibitem[\protect\citeauthoryear{Adams, Graf, {\&} Ernst}{Adams et al.}{2004}]{Adams2004}
Adams, W. J., Graf, E. W., \& Ernst, M. O. (2004). Experience can change the `light-from-above' prior.
Nature Neuroscience, Volume 7 (10), 1057--1058. doi: \url{https://doi.org/10.1038/nn1312}

\end{thebibliography}

\end{document}

Output:

Current output with apacite

  • You should add the question in the main part of your post and not on the title ;-) – Romain Picot Feb 6 '17 at 8:06
  • Somebody, please help me on the above request. – Pramila Krishnamoorthy Feb 8 '17 at 15:26
1

I got the answer from the following link: How to hyperlink only the year part when using natbib and hyperref

Input:

\documentclass{article}

\usepackage{hyperref}

\usepackage[natbibapa]{apacite}

\usepackage{etoolbox}

\makeatletter

\let\oldciteauthor\citeauthor

\def\citeauthor#1{{\NoHyper\oldciteauthor{#1}}}

% 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}

\noindent 

See \verb+\cite{Adams2004}+ - \cite{Adams2004}\\ 

\verb+\citep{Adams2004}+ - \citep{Adams2004}\\ 

\verb+\citet{Adams2004}+ - \citet{Adams2004}\\

\verb+\citeyear{Adams2004}+ - \citeyear{Adams2004}\\

\verb+\citeauthor{Adams2004}+ - {\citeauthor{Adams2004}}\\

\verb+\citealp{Adams2004}+ - (\citealp{Adams2004}).

\begin{thebibliography}{}

\bibitem[\protect\citeauthoryear{Adams, Graf, {\&} Ernst}{Adams et al.}{2004}]{Adams2004}
Adams, W. J., Graf, E. W., \& Ernst, M. O. (2004). Experience can change the `light-from-above' prior.
Nature Neuroscience, Volume~7 (10), 1057--1058. doi: \url{https://doi.org/10.1038/nn1312}

\end{thebibliography}

\end{document}

Output:

link-for-only-year

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.