I'm writing a document which includes a list of URLs that I want to be clickable, so I'm using hyperref to achieve this. This has the awkward side effect that my equation numbers, some of which I don't want to be clickable links, to also be clickable. I've hidden this by giving hypersetup the options colorlinks, linkcolor={black}

But this is suboptimal, in that the link is still clickable. I tried the following MWE, but it didn't work (the * just displays above the environment.)

\documentclass{article}
\usepackage{xcolor}
\usepackage{hyperref}
\title{This is the title}
\begin{document}
\let\oldref\ref
\let\ref\ref*
$$\label{eq:one} e^{i\pi} + 1 = 0$$
This is a link to the equation \ref{eq:one}, when it shouldn't be...
\let\ref\oldref %% Changing it back to normal behaviour
\end{document}


I also tried using renewcommand, but that failed too.

It's got something to do with the *, since \let\ref\autoref works fine.

I can't just find and replace the ones I want unlinked, because they are inside LTXexample environments, and I want the code to display as \ref not as \ref*

So I have two questions:

1. How do I get this temporary redefinition of \ref to work?
2. Or, how do I turn off equation links globally, but still have URL links work? (And if possible, is there a way to then have some equations linky with a different command)
-
Just to explain why \let\ref\ref* can't work: * is not letter, so the command is not \ref* but \ref, and this takes an optional argument *. So what you did was \let\ref\ref (not helpful :-)) and then typset *. –  Hendrik Vogt Nov 29 '10 at 14:27
Would it be that bad to have clickable links all over if they didn't have any special colors or boxes around them in the PDF? –  MSC Apr 4 '14 at 17:49

Instead of \ref* use \@refstar:

\makeatletter
\let\ref\@refstar
\makeatother


Why? hyperref redefines \ref this way.

\DeclareRobustCommand\ref{\@ifstar\@refstar\T@ref}%


\@ifstar is a LaTeX command which tests if the next character is a *. In this case the * would be gobbled and the first of the following commands will be executed (\@refstar), otherwise the second (\T@ref).

Thus, \ref* is essentially the same as \@refstar und you could use that instead.

If one would like to go deeper: the source code documentation of hyperref (or hyperref.dtx on CTAN or on your local TeX system) tells that \HyRef@StarSetRef belongs to \ref* and would not be linked, and \@refstar is defined this way:

\def\@refstar#1{%
\HyRef@StarSetRef{#1}\@firstoffive
}

-
thanks for the explanation! –  Seamus Nov 29 '10 at 14:45