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).

naphaneal
  • 2,614
wueb
  • 277
  • 1
    I think it is easier to work with labels, e.g. exploiting \getrefnumber from the refcount package (which is loaded most likely anyways, since beamer uses hyperref by default) –  Dec 30 '16 at 23:27
  • maybe you can get something useful from http://tex.stackexchange.com/questions/338241/how-to-extract-all-subsection-titles-from-beamer-and-iterative-create-commands – samcarter_is_at_topanswers.xyz Dec 31 '16 at 13:46

1 Answers1

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}

Symbol 1
  • 36,855