# hyperref command doesn't point to the right place in beamer

I write some equations in the beamer and I want to point to these equations by using the hyperlink, but the link produced by the command hyperref[label]{text} in package hyperref doesn't point to the right place while the \ref command points to the right place. For example

\documentclass{beamer}
\hypersetup{
}
\begin{document}
\begin{frame}[c]\frametitle{page 1}
$$\label{eq:1} 123$$
\end{frame}

\begin{frame}[c]\frametitle{page 2}
$$\label{eq:2} 456$$
\end{frame}

\begin{frame}[c]\frametitle{page 3}
Right link, will point to page 2:\ref{eq:2}\par
Wrong link, doesn't point to page 2:\hyperref[eq:2]{The equation 2}\par
\end{frame}
\end{document}


I use xelatex as the compiler and the platform is TL2016 and windows 7.

• Apparently beamer does provide link anchors other than 'usual' classes and packages. Replace \hyperref[eq:2]{The equation 2} with \hyperlink{eq:2}{The equation 2} and it will work inside beamer, but it wouldn't work inside a document setup with aother document class. Besides that, there's not much to gain with \hyperref here what could not be done with \ref already – user31729 Apr 13 '17 at 5:05

Instead of \hyperref[]{} use \hyperlink{}{} -- \hyperlink is redefined in beamer to use the usual \ref internally, since that command uses links by default (with hyperref) and the link will work,but it would fail in another document set up with another document class since \hyperlink applies the anchor name and not the label name.

Also note that \hyperlink does support the slide overlay <> syntax in beamer as well.

\documentclass{beamer}
\hypersetup{
}
\begin{document}
\begin{frame}[c]\frametitle{page 1}
$$\label{eq:1} 123$$
\end{frame}

\begin{frame}[c]\frametitle{page 2}
$$\label{eq:2} 456$$
\end{frame}

\begin{frame}[c]\frametitle{page 3}
Right link, will point to page 2:\ref{eq:2}