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.)

\hypersetup{colorlinks, linkcolor={black}}
\title{This is the title}
  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

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)
  • 4
    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 *. Nov 29, 2010 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, 2014 at 17:49

2 Answers 2


Instead of \ref* use \@refstar:


Why? hyperref redefines \ref this way.


\@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:


Just for the record, another simple way defined within the hyperref package would be to do the following:

\begin{NoHyper}              %% hyperref hyperlinking disabling environment!
      e^{i\pi} + 1 = 0

Agreed, this won't disable all the necessary equation hyperlinks in one shot, but if needed a hyperref has already made it available for you, if you don't mind a bit of manual labour.


You must log in to answer this question.

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