6

I am preparing a presentation on Beamer and I will have different sections. I would like to put a title page and a table of contents for each of the section. In particular, for each section a toc with only the entries of that section. For example, suppose I have

  1. Sec 1

    1.1. Subsec 1

    1.2. Subsec 2

  2. Sec 2

    2.1. Subsec 1

    2.2. Subsec 2

    2.3. Subsec 3

  3. Sec 3

    3.1. Subsec 1

    3.2 Subsec 2

At the beginning of sec 2 I would like a slide showing the title Sec 2 and at the following slide I want to see: 2. Sec 2

2.1. Subsec 1

2.2. Subsec 2

2.3. Subsec 3

I have used the following code:

 \documentclass[t,10pt]{beamer}

\title{My presentation}

\date[February 11, 2015] % (optional)
{}

\def\sectionname{\translate{Section}}
\setbeamertemplate{section page}
{
  \begin{centering}
    \vskip1em\par

    \vspace{3cm}
\begin{beamercolorbox}[sep=4pt,center]{part title}
  \usebeamerfont{section title}\insertsection\par
\end{beamercolorbox}
  \end{centering}
}

\setbeamertemplate{section page2}
{\tableofcontents[currentsection, sectionstyle=show, subsectionstyle=show]}

\def\sectionpage{\usebeamertemplate*{section page}}

\def\sectionpageBis{\usebeamertemplate*{section page2}}

\AtBeginSection{\frame{\sectionpage} \frame{\sectionpageBis}}

\begin{document}
\setbeamertemplate{blocks}[rounded][shadow=true]
\begin{frame}
  \titlepage
\end{frame}
\addtocounter{framenumber}{-1}
\linespread{1.5}
\begin{frame}{Outline}
\footnotesize
  \tableofcontents[subsectionstyle=hide]
  % You might wish to add the option [pausesections]
\end{frame}

\section{Section 1}
\subsection{sub 1}
\subsection{sub 2}
\section{Section 2}
\subsection{sub 1}
\subsection{sub 2}
\subsection{sub 3}
\section{Section 3}
\subsection{sub 1}
\subsection{sub 2}
\end{document} 

The title page works fantastically. However the toc shows the name of the other sections and other subsections. Can anyone help? Thanks

2
  • Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem.
    – erik
    Feb 11, 2015 at 16:12
  • Hi Erik thanks for the advice. I did add a compilable example
    – ginu
    Feb 11, 2015 at 16:27

1 Answer 1

6

Try changing your definition of section page2 to the following:

\setbeamertemplate{section page2}
{\tableofcontents[currentsection, sectionstyle=show/hide, subsectionstyle=show/show/hide]}

For sectionstyle, show/hide means show the current section and hide other sections. For subsectionstyle, the three options are for the current subsection, other subsections within the same section, and other subsections in different sections. You also have the shaded option, which makes the entry somewhat transparent. See the beamer documentation section 10.5 for details.

Full code:

\documentclass[t,10pt]{beamer}
\title{My presentation}
\date[February 11, 2015] % (optional)
{}

\def\sectionname{\translate{Section}}
\setbeamertemplate{section page}
{
  \begin{centering}
    \vskip1em\par

    \vspace{3cm}
\begin{beamercolorbox}[sep=4pt,center]{part title}
  \usebeamerfont{section title}\insertsection\par
\end{beamercolorbox}
  \end{centering}
}

\setbeamertemplate{section page2}
{\tableofcontents[currentsection, sectionstyle=show/hide, subsectionstyle=show/show/hide]}

\def\sectionpage{\usebeamertemplate*{section page}}
\def\sectionpageBis{\usebeamertemplate*{section page2}}

\AtBeginSection{\frame{\sectionpage} \frame{\sectionpageBis}}

\begin{document}
\setbeamertemplate{blocks}[rounded][shadow=true]
\begin{frame}
  \titlepage
\end{frame}
\addtocounter{framenumber}{-1}
\linespread{1.5}
\begin{frame}{Outline}
\footnotesize
  \tableofcontents[subsectionstyle=hide]
  % You might wish to add the option [pausesections]
\end{frame}
\section{Section 1}
\subsection{sub 1}
\subsection{sub 2}
\section{Section 2}
\subsection{sub 1}
\subsection{sub 2}
\subsection{sub 3}
\section{Section 3}
\subsection{sub 1}
\subsection{sub 2}
\end{document} 

enter image description here

3
  • Thanks! it works!! Just a small additional question. What if I want to add the title Outline?
    – ginu
    Feb 11, 2015 at 17:03
  • You could just add \frametitle{Outline} in your \AtBeginSection statement, like this: \AtBeginSection{\frame{\sectionpage} \frame{\frametitle{Outline}\sectionpageBis}}
    – erik
    Feb 11, 2015 at 17:09
  • By the way, the way you're using section page is similar to the default behavior of parts. You might consider using parts with \AtBeginPart{\frame{\partpage}} in addition to sections. It may save you from having to customize so much.
    – erik
    Feb 11, 2015 at 17:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .