TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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)
share|improve this question
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
up vote 16 down vote accepted

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:

share|improve this answer
thanks for the explanation! – Seamus Nov 29 '10 at 14:45

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.