Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
add comment

1 Answer 1

up vote 6 down vote accepted

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

share|improve this answer
    
Thank you very much. I eventually included it before every part, because I place a different picture on every page. (My next aim will to add some js to show the time at the bottom of each frame -- LOL). –  Louis Aug 3 '12 at 8:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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