[Tex/LaTex] Theorem/Definition/Lemma problem — Numbering in Beamer

beamernumberingtheorems

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.

Best Answer

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} 

enter image description here

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

Related Question