9
\documentclass{scrartcl}
\usepackage[english]{babel}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[colorlinks=true,linkcolor=green]{hyperref}
\begin{document}
\begin{align} \label{test}
a+b=c
\end{align}
\eqref{test}
\end{document}

How can I combine hyperref and eqref such that the braces () are also green and clickable and not only the 1?

  • Welcome to TeX.SE! Your posting is a possible duplicate of autoref and braces around equation number. Please check that posting and advise if it's in fact your new posting is a duplicate. – Mico Jul 22 '14 at 22:11
  • @Mico I don't see any mention of \autoref in the question. How can it be a duplicate of a question dealing with \autoref? – yo' Jul 22 '14 at 22:24
  • @tohecz: The question referred to by Mico is titled misleadingly, in my opinion, although autoref is mentioned in the OP as well in Mico's solution. Both solution (by Heiko Oberdiek and Mico) seem to be applicable for this question as well. – user31729 Jul 22 '14 at 22:29
  • @Mico: I do not consider the possible duplicate question as related, but not as a duplicate. \autoref and \eqref are independent from each other, a user might want to use both. – Heiko Oberdiek Jul 22 '14 at 22:36
10

\eqref uses \ref for the equation number, therefore \ref is the link, the surrounding parentheses are not part of the link. The following example redefines \eqref to include the parentheses into the link:

\documentclass{scrartcl}
\usepackage[english]{babel}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[colorlinks=true,linkcolor=green]{hyperref}

\makeatletter
\renewcommand*{\eqref}[1]{%
  \hyperref[{#1}]{\textup{\tagform@{\ref*{#1}}}}%
}
\makeatother

\begin{document}
\begin{align} \label{test}
a+b=c
\end{align}
\eqref{test}
\end{document}

Result

BTW: Instead of "green" I would use something darker ("darkgreen", ...) for a better contrast to the usual white background.

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.