# Theorem/Definition/Lemma problem — Numbering in Beamer

I am trying to work on the numbering of the theorems/definitions/lemmas etc., and I have some problems with the numbering.

I would like the theorems, propositions, corollarys, definitions, examples in Beamer (a presentation) as follows:

1 Functions (SECTION)

1.1 Basics (SUBSECTION)

Definition 1.1.1.

Theorem 1.1.1.

Theorem 1.1.2.

Example 1.1.1.

1.2 Some result (SUBSECTION)

Definition 1.2.1.

Theorem 1.2.1.

Theorem 1.2.2.

Example 1.2.1.

• \newtheorem{theorem}{Theorem}[section] – Sigur Feb 23 '15 at 16:16
• I got Theorem 1.1. Theorem 1.2. – alpha Feb 23 '15 at 16:18
• Ow, there is no chapter. So use subsection instead. – Sigur Feb 23 '15 at 16:19
• I already use subsection but I got Theorem 0.1. Theorem 0.2. It is not Theorem 1.1.1. Theorem 1.1.2. – alpha Feb 23 '15 at 16:21
• Your attendants will suffer with that numbering schema. At least, make all structures to share a counter. – Gonzalo Medina Feb 23 '15 at 16:39

You need to number subsections within sections and theorems within sections, to achieve what you want.

\numberwithin{subsection}{section}
\numberwithin{theorem}{subsection}


Also, you need to declare

\setbeamertemplate{theorems}[numbered]


otherwise they are not numbered at all.

MWE:

\documentclass{beamer}

\setbeamertemplate{theorems}[numbered]
\numberwithin{subsection}{section}
\numberwithin{theorem}{subsection}

\begin{document}
\section{Functions}
\subsection{Basics}
\begin{frame}
\frametitle{A Theorem on Infinite Sets}
\begin{theorem}
There exists an infinite set.
\end{theorem}
\begin{proof}
This follows from the axiom of infinity.
\end{proof}
\begin{example}[Natural Numbers]
The set of natural numbers is infinite.
\end{example}
\end{frame}
\end{document}


Note that I haven't changed the fact that all theorem-like environments share the same counter.