2

How to get the lastpage of each section, so that I could put it on the headline.

\documentclass{beamer}

\usepackage{lastpage}

\begin{document}
\section{1}
\begin{frame}
123 Total \pageref{LastPage} pages

How to get the pages of section 1?
\end{frame}
\begin{frame}
1234
\end{frame}
\section{1}
\begin{frame}
1235
\end{frame}

\end{document} 
1
  • Welcome to TeX.SX! You can highlight code in your post using back-ticks. To highlight code-blocks, either indent them by four spaces or use the {} on the gui.
    – user30471
    May 5, 2019 at 13:41

1 Answer 1

3

In order to access the first and last page of the current part, section or subsection the beameroffers the commands \insertZstartpage and \insertZendpage with Z= part, section or subsection. A short description of these commands can be found on page 66 of the beamer userguide.

MWE with a very simple headline:

\documentclass{beamer}

\setbeamertemplate{headline}{%
  \parbox{\linewidth}{\vspace{10pt} \hspace{10pt} \insertsectionstartpage / \insertsectionendpage}}


\begin{document}
\section{1}
\begin{frame}
Section 1 starts at: \insertsectionstartpage

Section 1 ends at: \insertsectionendpage
\end{frame}

\begin{frame}
1234
\end{frame}

\section{2}
\begin{frame}
First frame of section 2

\end{frame}
\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.