You can define your own link command for equations and change the (border) color for links locally.
LaTeX with \ref
\documentclass[a5paper]{article}
\usepackage{xcolor}
\colorlet{linkequation}{blue}
\usepackage[colorlinks]{hyperref}
\newcommand*{\refeq}[1]{%
\begingroup
\hypersetup{
linkcolor=linkequation,
linkbordercolor=linkequation,
}%
\ref{#1}%
\endgroup
}
\begin{document}
\tableofcontents
\section{Example}\label{sec:example}
\begin{equation}
\label{eq:einstein}
E=mc^2
\end{equation}
See section \ref{sec:example} and equation \refeq{eq:einstein}.
\end{document}
Package amsmath
and \eqref
And an example for the redefinition of \eqref
from package amsmath
:
\documentclass[a5paper]{article}
\usepackage{amsmath}
\usepackage{xcolor}
\colorlet{linkequation}{blue}
\usepackage[colorlinks]{hyperref}
\newcommand*{\SavedEqref}{}
\let\SavedEqref\eqref
\renewcommand*{\eqref}[1]{%
\begingroup
\hypersetup{
linkcolor=linkequation,
linkbordercolor=linkequation,
}%
\SavedEqref{#1}%
\endgroup
}
\begin{document}
\tableofcontents
\section{Example}\label{sec:example}
\begin{equation}
\label{eq:einstein}
E=mc^2
\end{equation}
See section \ref{sec:example} and equation \eqref{eq:einstein}.
\end{document}
Package cleveref
and \cref
\documentclass[a5paper]{article}
\usepackage{xcolor}
\colorlet{linkequation}{blue}
\usepackage[colorlinks]{hyperref}
\usepackage{cleveref}
\makeatletter
\creflabelformat{equation}{%
\textup{%
\hypersetup{
linkcolor=linkequation,
linkbordercolor=linkequation,
}%
(#2#1#3)%
}%
}
\makeatother
\begin{document}
\tableofcontents
\section{Example}\label{sec:example}
\begin{equation}
\label{eq:einstein}
E=mc^2
\end{equation}
See section \ref{sec:example} and \cref{eq:einstein}.
\end{document}
amsmath
or any other cross-referencing package?amsmath
as one of the packages.