2

I'm writing my own beamer theme, I had some fancy idea to layout my header in beamer class: I progress bar on top and below the sections corresponding to the slides where they start, namely:

----------
          Section 1 

The progress bar is designed as follows:

\progressbar{\footerBarHeight}
\dimen0=\textwidth
\multiply\dimen0 by \insertframenumber
\divide\dimen0 by \inserttotalframenumber
\edef\progressbarwidth{\the\dimen0}
\leavevmode%
\begin{beamercolorbox}[wd=\textwidth,ht=.1ex,dp=.1ex]{progress bar}
    \begin{beamercolorbox}[wd=\progressbarwidth,ht=.1ex,dp=.1ex]{progress bar progress}
    \end{beamercolorbox}%
\end{beamercolorbox}%

So, my idea was to use the data in the .toc-file

\beamer@sectionintoc {1}{Section 1}{2}{0}{1}
\defcounter {refsection}{0}\relax 
\beamer@subsectionintoc {1}{1}{Subsection 1.1}{7}{0}{1}
\defcounter {refsection}{0}\relax 
\beamer@subsectionintoc {1}{2}{Subsection 1.2}{10}{0}{1}
\defcounter {refsection}{0}\relax 
\beamer@sectionintoc {2}{Section 2}{13}{0}{2}
\defcounter {refsection}{0}\relax 
\beamer@sectionintoc {3}{Section 3}{22}{0}{3}

that provides the page number where the section starts and compare this with (e.g. \insertframenumber) to align & print the three section title by \insertsection.

My questions:

(1) Can I use this data? Is there any variable already defined in beamer to get the page number of the @sectionintoc?

(2) Is there an easier way just to print all three section titles? (Maybe iterate modulo something).

1

(1) Yes, \insertsectionstartpage. See the manual page 65.

(2) Yes,

\documentclass{beamer}

\begin{document}

\section{title of section 1}
\section{title of section 2}
\section{title of section 3}
\section{title of section 4}
\section{title of section 5}
\subsection{title of subsection 5-1}

\makeatletter
\def\beamer@endinputifotherversion#1{}
\def\beamer@sectionintoc#1#2#3#4#5{#2;}
\def\beamer@subsectionintoc#1#2#3#4#5#6{}
%\def\beamer@subsubsectionintoc#1#2#3#4#5#6#7{}

\frame{
    \@input{\jobname.toc}
}

\end{document}

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.