I would like hyperref to make links only when I use \cite and not with \citeyear and \citeauthor. Here is an example :



\citeauthor{Wysocki1960} has shown something interesting in \citeyear{Wysocki1960} \cite{Wysocki1960}.


With the .bib file :

annote = {cited By (since 1996) 27},
author = {Wysocki, J.J.},
journal = {Journal of Applied Physics},
number = {3},
pages = {571--578},
title = {{Effect of temperature on photovoltaic solar energy conversion}},
volume = {31},
year = {1960}

In the output, I want only the [1] to appear as a link.


The hyperlinks are set by the macro \NAT@hyper@#1 defined in natbib.sty. Using etoolbox you can hook into the low-level citation command \NAT@citexnum to make \NAT@hyper@ do nothing for non-numeric citations. Here's an example.



  author = {Goossens, Michel and Mittelbach, Frank and Samarin, Alexander},
  title = {The LaTeX Companion},
  edition = {1},
  publisher = {Addison-Wesley},
  location = {Reading, Mass.},
  year = {1994}}
  title = {The Restaurant at the End of the Universe},
  author = {Douglas Adams},
  series = {The Hitchhiker's Guide to the Galaxy},
  publisher = {Pan Macmillan},
  year = {1980}}

\newcommand{\cmd}[1]{\texttt{\textbackslash #1}}

\cmd{citeauthor}: \citeauthor{adams}, \citeauthor{companion} \\
\cmd{cite}: \cite{adams}, \cite{companion} \\
\cmd{citeyear}: \citeyear{adams}, \citeyear{companion} \\
\cmd{citet}: \citet{adams}, \citet[see][p. 20]{adams} \\
multi-\cmd{citet}: \citet{companion,adams} \\
\cmd{citep}: \citep{adams}, \citep[see][p. 20]{companion} \\
multi-\cmd{citep}: \citep{companion,adams} \\
\cmd{citetext}, \cmd{citealp}: \citetext{see \citealp{companion}, or even better \citealp{adams}}

enter image description here

  • I get only question marks when I compile your code. Any idea what's wrong? – jul059 Aug 16 '12 at 21:22
  • You probably need to rerun latex. I compiled the above document with pdflatex, bibtex, pdflatex, pdflatex. – Audrey Aug 16 '12 at 21:59
  • If I put the jobname.bib in a separate file, it works. Thanks! – jul059 Aug 17 '12 at 16:18
  • The problem may be related to this new question I asked concerning a specific reference : tex.stackexchange.com/questions/67645/… – jul059 Aug 18 '12 at 4:28
  • @jul059 I already fixed the solution here. Does it work for you now? – Audrey Aug 18 '12 at 4:33

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.