\documentclass[xcolor=dvipsnames]{beamer} \usepackage[T1]{fontenc} \usetheme{AnnArbor} \usecolortheme{whale} \setbeamercolor{title}{bg=RoyalPurple} \setbeamercolor{frametitle}{fg=white,bg=RoyalPurple} \usepackage{amsmath} \newcounter{exm} \makeatletter \newcommand\ExmT[1][]{% \frametitle{% \refstepcounter{exm}% \ifx\relax#1\relax\else \edef\@currentlabelname{Example~\theexm}% \label{#1}% \fi Example~\theexm}% } \makeatother \resetcounteronoverlays{exm} \begin{document} \frame{% \frametitle{Testframe} To avoid that exmaples and frames have the same number. } \frame{ \ExmT[ex:hilbert]% David Hilbert is a great Mathematician! } \frame{ \ExmT[ex:riemann]% Bernhard Riemann is another greatest mathematician in the history! } \frame{{How do you define Mathematics?} Mathematics is a language of sciences. Moreover, $\cdots$ } \frame{{Rmarks on \nameref{ex:hilbert}} {\color{red}\textbf{I am writing Remarks on Example~\ref{ex:hilbert} on page~\pageref{ex:hilbert} (on the title of this frame) manually but is there a way to reference \nameref{ex:hilbert} automatically?}} Not the frame number. } \end{document}