1

I'm using apacite and both cite{author} and citeA{author} commands. When using cite{author}, both author and year are hyperlinked and this is fine.

But when using citeA{author}, i would like the year only to be hyperlinked. Here is a screenshot of citeA{tulving1972, tulving1995} :

I would like the author name (tulving) to be in black like the rest of the text. However, when using cite{} i would like both names and year to be hyperlinked.

found this answer but couldnt manage to adapt it to make it work with citeA{} (note citea{}

Any help ?

Pad
  • 35
  • 4

1 Answers1

1

This turns out to be a lot easier than with the natbib solution. I haven't tested all the other cite commands but this seems to work properly for \citeA and \cite.

\begin{filecontents}{\jobname.bib}

@article{Adams1987,
    Author = {Marianne Adams},
    Journal = {Natural Language \& Linguistic Theory},
    Pages = {1-32},
    Title = {From Old French to the Theory of Pro-Drop},
    Volume = {5},
    Year = {1987}}

@article{Adams1985,
    Author = {Marianne Adams},
    Journal = {Linguistic Inquiry},
    Pages = {305-313},
    Title = {Government of Empty Subjects in Factive Clausal Complements},
    Volume = {16},
    Year = {1985}}

@book{Chomsky1986,
    Address = {Cambridge Mass.},
    Author = {Noam Chomsky},
    Publisher = {{MIT} Press},
    Title = {Barriers},
    Year = {1986}}

\end{filecontents}
\documentclass{article}


\usepackage[colorlinks=true]{hyperref}
\usepackage{apacite}
\bibliographystyle{apacite}

\usepackage{etoolbox}

\makeatletter

\newif\if@citeA
\pretocmd{\citeA}{\@citeAtrue}{}{}
\def\@ifauthorsunequalc@de#1{%
  \if@F@cite
     \@F@citefalse
  \else
     \if@Y@cite
        {\@BAY}%
     \fi
     {\@BBC}%
  \fi
  \edef\@cite@undefined{?}%
  \def\BBA{\@BBA}%
  \if@A@cite
  \if@citeA
     {\csname b@\@citeb\APAC@extra@b@citeb\endcsname}%
     \@citeAfalse
  \else
      \hyper@natlinkstart{#1}%
     {\csname b@\@citeb\APAC@extra@b@citeb\endcsname}%
     \hyper@natlinkend
  \fi
     \if@Y@cite
        {\@BBAY}%
     \fi
  \fi
  \if@Y@cite
     \hyper@natlinkstart{#1}%
     {\csname Y@\@citeb\APAC@extra@b@citeb\endcsname}%
     \hyper@natlinkend
  \fi
  \let\BBA\relax
}
\makeatother

\begin{document}

\noindent 

\cite{Adams1985,Chomsky1986}
\citeA{Adams1985,Adams1987}
\citeA<see>[p.22]{Adams1985}
\cite<see>[p.22]{Adams1985}


\bibliography{\jobname}

\end{document}

output of code

Alan Munn
  • 218,180