7

I would like my document to have clickable hyperlinks inside \overset environments. I'm using XeLaTeX because of the fonts…

This is a (rather) minimal example:

\documentclass[a4paper, 12pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage[xetex, colorlinks=true, citecolor=blue, linkcolor=blue]{hyperref}

\begin{document}

\begin{equation}
    a = b \label{eq} \tag{$\ast$}
\end{equation}

\[ \eqref{eq} \] % working hyperlink here.

\[ c = a \overset{\eqref{eq}}{=} b \] % existing but non-clickable hyperlink here.

\end{document}

Any help is greatly appreciated!

  • 1
    Welcome to TeX.SE, and thanks for providing a complete MWE. Interesting that it works fine with pfdLaTeX, but not XeLaTeX. – Peter Grill Feb 26 '13 at 3:43
  • @PeterGrill Thanks for pointing that out! I tried to compile my document with LuaLaTeX and amazingly it simply worked and showed the correct hyperlinks! While this doesn't explain the behaviour of XeLaTeX, it's a simpler workaround than I could have dreamed of! Cheers! – sjakobi Feb 26 '13 at 4:12
  • If you use (\ref{eq}) rather than \eqref{eq} it will work, even with xelatex – Ari Brodsky Feb 26 '13 at 4:56
  • 2
    The problem occurs any time you have \text{\ref{eq}} in a math size other than \displaystyle. So in display math mode you need a superscript to produce the problem (\overset implicitly creates a superscript, and \eqref uses the \textup command that unravels to \text), but in inline math the problem occurs without a superscript. – Ari Brodsky Feb 26 '13 at 7:43
  • 2
    $ c = a \overset{\mbox{\scriptsize\eqref{eq}}}{=} b $ works. – user4686 Feb 26 '13 at 8:21
3

This is a workaround for XeLaTeX as pointed out by @user700902:

\documentclass[a4paper, 12pt]{article}
\usepackage{amsmath}
\usepackage[xetex, colorlinks=true, linkcolor=blue]{hyperref}

\begin{document}

\begin{equation}
    a = b \label{eq} \tag{$\ast$}
\end{equation}

\[ c  = a \overset{\mbox{\scriptsize\eqref{eq}}}{=} b\] % thanks user700902 

\end{document}

I however chose to use LuaLaTeX, which didn't require any change of the source code.

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.