# Beamer: How to reference something other than a frame

I tried a type of reference that works with classic LaTeX article but that I can't get it to work in a beamer presentation.

MWE:

\documentclass{beamer}
\usepackage[ansinew]{inputenc}
\usetheme{Warsaw}
\newcounter{theo}
\newcommand{\theo}{  \refstepcounter{theo} \textbf{Théorème    \arabic{theo}}  }

%\resetcounteronoverlays{theo}
\newcommand{\thm}[1]{
\begin{block}{\theo}
#1
\end{block}
}

\begin{document}

\begin{frame}
Hello world
\end{frame}

\begin{frame}

\thm{\label{th1}
My first theorem
}
\end{frame}

\begin{frame}
As precised in Theorem \ref{th1}
\end{frame}

\end{document}


In the last frame I get: As precised in Theorem 2

where I'm looking for : As precised in Theorem 1

Any idea to fix that?

• – samcarter_is_at_topanswers.xyz Nov 21 '17 at 12:57
• Not exactly @samcarter, as i want to keep the automatic numerotation with my command \thm or i can't get how to adapt it... – Robien1 Nov 21 '17 at 13:15

\documentclass{beamer}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usetheme{Warsaw}
\setbeamertemplate{theorems}[numbered]

\usepackage[french]{babel}
\uselanguage{French}
\languagepath{French}
\deftranslation[to=French]{Theorem}{Th\'eor\eme}

\begin{document}

\begin{frame}
Hello world
\end{frame}

\begin{frame}
\begin{theorem}
\label{th1}
My first theorem
\end{theorem}
\end{frame}

\begin{frame}
As precised in Theorem \ref{th1}
\end{frame}
\end{document}


• Thank you, end of the «bricolage» then. I simply need \usepackage[ansinew]{inputenc} to get it work. No output with [T1]{fontenc}  and unicode error with [utf8]{inputenc} . – Robien1 Nov 21 '17 at 17:08
• @Robien1 For the optional argument of inputenc you should choose the encoding your .tex file is saved in. If your file is saved using ansinew` then this is the correct choice for you. – samcarter_is_at_topanswers.xyz Nov 21 '17 at 17:12