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}
\hypersetup{colorlinks, linkcolor={black}}
\title{This is the title}
\begin{document}
\let\oldref\ref
\let\ref\ref*
\begin{equation}
\label{eq:one}
e^{i\pi} + 1 = 0
\end{equation}
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:
- How do I get this temporary redefinition of
\refto work? - 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)
\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