23

I'm using both the natbib and the hyperref packages. I would like to be able to selectively not generate hyperlinks for some of the in-text citations. I know that I can use the asterisk with \ref*{...} in order to prevent a hyperlink from being generated for that reference, but adding an asterisk changes nothing with \cite*{...}.

I see that Selectively turn off hyperref links and Remove link from selected references describe how to selectively disable hyperlinks for cross-references, and How to turn on/off certain types (e.g. citation, url, file) of hyperref links? describes how to disable ALL hyperlinks of a given type, but neither of these address my problem.

0

2 Answers 2

32

Environment NoHyper should help:

\begin{NoHyper}\cite{foobar}\end{NoHyper}

A star form is problematic, because some citing commands already have one (e.g. \citep, \citet). But macros can be defined, e.g.:

\newcommand*{\nolink}[1]{%
  \begin{NoHyper}#1\end{NoHyper}%
}

\nolink{\cite{foobar}}
0
12

Heiko's answer is great. However, it doesn't work inside captions, for instance. To make it work, use:

\newcommand*{\nolink}[1]{%
  {\protect\NoHyper#1\protect\endNoHyper}%
}

The curly braces inside are important.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .