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?

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

| improve this answer | |
  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.