3

My question is: Is is possible to change the color of the borders of one or several internal links in LaTeX, without changing them all? I know it is possible to define a different colored borders for different kinds of links (one color for internal links, one color for URL links, one color for file links, etc). But is it possible to take one internal link (\ref{whatever}) and change the color of its border, without changing the color of all the borders for all other internal links?

I am convinced that this isn't possible, but it would be great if someone happens to know a way to make it possible!

6

Sure it is possible; you can use \hypersetup inside a group to locally change the color:

\documentclass{article}
\usepackage{xcolor}
\usepackage{amsmath}
\usepackage{hyperref}

\begin{document}

As we see, equation~{\hypersetup{linkbordercolor=cyan}\eqref{whatever}} is identical to equation~\eqref{whatever}.
\begin{equation}
\label{whatever}
a=b.
\end{equation}

\end{document}

enter image description here

And, of course, you can define dedicated commands:

\documentclass{article}
\usepackage{xcolor}
\usepackage{amsmath}
\usepackage{hyperref}

\newcommand\cyaneqref[1]{{\hypersetup{linkbordercolor=cyan}\eqref{#1}}}
\begin{document}

As we see, equation~\cyaneqref{whatever} is identical to equation~\eqref{whatever}.
\begin{equation}
\label{whatever}
a=b.
\end{equation}

\end{document}
  • @Lauren You're welcome. Don't forget that you can accept the answer, if you consider it solved your problem, by clicking the checkmark to its left. In case of doubt, please see How do you accept an answer?. – Gonzalo Medina Feb 4 '15 at 16:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.