Beamer – How to Reset the Section Numbers in Beamer

beamernumberingpartssectioning

I want to reset the section numbers when a part in beamer starts.

So I tried:

\setcounter{section}{0}

That does not work.

So after searching I found this:

\makeatletter
\numberwithin{section}{part}
\AtBeginPart{\beamer@tocsectionnumber=0\relax}
\makeatother

at

Easier support for numbering sections within parts

It worked once or twice then I started cleaning up and now it can't get to work anymore. I tried to move it into the document and to the preamble. I also change the numbering and title of the part, but I don't know if that would influence it.

An MWE:

\documentclass{beamer}

\setbeamerfont{block title}{size={}}
\setbeamercolor{titlelike}{parent=structure,bg=white}

\usetheme[]{Frankfurt}

\setbeamertemplate{navigation symbols}{}


\AtBeginSection[]{\begin{frame}\frametitle{Agenda}\tableofcontents[currentsection,hideallsubsections]\end{frame}}

\AtBeginDocument{\renewcommand*{\partname}{Theme}}


\begin{document}
\makeatletter
\numberwithin{section}{part}
\AtBeginPart{\beamer@tocsectionnumber=0\relax}
\makeatother


\AtBeginPart{\frame{\partpage}}

\setcounter{part}{2}
\setcounter{section}{0}
\part{1st}
\section{First}
\begin{frame}
First
\end{frame}

\setcounter{part}{3}
\setcounter{section}{0}
\part{2nd}
\section{First}
\begin{frame}
First
\end{frame}

\end{document}

Best Answer

It's enough to make \beamer@tocsectionnumber=0 and to set the section counter to zero each time a new part begins:

\documentclass{beamer}
\usetheme[]{Frankfurt}

\setbeamerfont{block title}{size={}}
\setbeamercolor{titlelike}{parent=structure,bg=white}
\setbeamertemplate{navigation symbols}{}

\AtBeginSection[]{%
  \begin{frame}\frametitle{Agenda}\tableofcontents[currentsection,hideallsubsections]\end{frame}}

\AtBeginDocument{\renewcommand*{\partname}{Theme}}

\makeatletter
\AtBeginPart{%
  \beamer@tocsectionnumber=0\relax
  \setcounter{section}{0}
  \frame{\partpage}%
}
\makeatother

\begin{document}
\part{1st}
\section{Part One - Section~\thesection}
\begin{frame}
First
\end{frame}

\part{2nd}
\section{Part Two - Section~\thesection}
\begin{frame}
First
\end{frame}

\end{document}

Images of the relevant frames showing the desired behaviour for the section counter and for the numbering in the navigation in the ToCs:

enter image description here

enter image description here