[Tex/LaTex] A table of contents for each section. Including only the entries of that section

beamersectioningtable of contents

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

Best Answer

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