# Using a label with \hyperref won't work but using it with \ref works fine

While putting together a presentation about LaTeX i noticed that \hyperref won't recognize any label while \ref works fine. First i thought that there was a error while importing my setup file but i managed to recreate the problem in a MWE.

\documentclass{beamer}
\usepackage{hyperref}
\usepackage{cmbright}
\usepackage{cleveref}

\begin{document}
\begin{frame}{Some Fancy Title}
\section{Some fancy section}\label{sec:section}
This is some fancy text. It would be nice to reference \hyperref[sec:section]{to it}. But hyperref jumps to the start of the document, while ref works fine. \ref{sec:section}
\end{frame}
\end{document}


Some additional information: I am using ShareLaTeX Community Edition (not sure which version) I hope its not just a typo but after searching for over 2 hours it might be possible to overlook the obvious. :D

• Welcome to TeX.SE. If you switch from the beamer class to, say, the article class, the issue you describe vanishes automatically. – Mico May 9 '17 at 21:21

Please do not use \section inside of a frame!

Also you don't need \usepackage{hyperref} with beamer.

You could use \hyperlink{sec:section}{to it} instead -- or if you want to go to the start of the current section, let beamer do it's job and use \hyperlinksectionstart{to it}

\documentclass{beamer}
\usepackage{cmbright}
\usepackage{cleveref}

\begin{document}

\begin{frame}
content...
\end{frame}

\section{Some fancy section}
\label{sec:section}

\begin{frame}
content...
\end{frame}

\begin{frame}{Some Fancy Title}
This is some fancy text. It would be nice to reference \hyperlink{sec:section}{to it}. But hyperref jumps to the start of the document, while ref works fine. \ref{sec:section}


• @user133314 not really an explanation, but for beamer \hyperlink is the standard tool, it uses it to define many new commands. – samcarter_is_at_topanswers.xyz May 9 '17 at 21:38
• @user133314 hypertext is a very "intrusive" package - it redefines many macros that are defined in other packages, and often it needs to know which other package originally defined the macro to redefine it successfully. As such, trying to use it in 'non-standard' ways is usually a high risk option. Since beamer has implemented some of hypertext's functionality already, it's a good bet they are going to fight with each other! – alephzero May 10 '17 at 2:12