1

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?

2

1 Answer 1

4

You'll get automatic theorem numbering for free from beamer:

\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}

enter image description here

2
  • 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, 2017 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. Nov 21, 2017 at 17:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .