Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
\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?

share|improve this question
    
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 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 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. –  Christian Hupfer Jul 22 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 at 22:36

1 Answer 1

up vote 5 down vote accepted

\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.

share|improve this answer

Your Answer

 
discard

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.