# Customized frame title with examples and how reference those examples?

I am trying to create examples on the LaTeX Beamer frame title, count them and reference them in the other frame title. By googling, I was able to count the examples but not able to reference it in the next slide in the title.

So, I am wondering if there is any sort of idea to achieve this goal.

Here is the minimal working example with the corresponding generated pdf file.

\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}
\newcommand\ExmT{%
\frametitle{\refstepcounter{exm}{Example}~\theexm}}
\resetcounteronoverlays{exm}

\begin{document}

\frame{
\ExmT
David Hilbert is a great Mathematician!
}

\frame{
\ExmT
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 Example 1}

{\color{red}\textbf{I am writing Remarks on Example 1 (on the title of this
frame) manually but is there a way to reference Example 1 automatically?}}
Not the frame number.

}

\end{document}


• An excellent solution is now available at latex.org/forum/… by Ijon Tichy. Thank you Ijon Tichy! – CMP Aug 23 at 14:10