Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 11 down vote accepted

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

Thanks to Kurt for pointing out that the initial solution didn't work.

share|improve this answer
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
There is an error in your example. Please add the line \cmd{cite}: \cite{adams}, \cite{companion} before the line \bibliographystyle{plainnat} and compile. You will see that the links with \cite{} are not working. –  Kurt Aug 18 '12 at 1:08
@Kurt Well that was dumb. Thanks for letting me know. –  Audrey Aug 18 '12 at 4:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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