7

I am new in LaTeX and I need some help in doing a beamer presentation. I have a dense table of contents with 6 sections and 15 subsections in total. I would like to have a table of contents which lights up each section one by one and shows only the subsections of the selected section and hide all the other subsections. Like this:

When I light up Section 1

Section 1

  • subsection 1

  • subsection 2

  • subsection 3

Section 2

Section 4

Section 5

Section 6

When I light up Section 2

Section 1

Section 2

  • subsection 1

  • subsection 2

  • subsection 3

Section 4

Section 5

Section 6

Is it possible? How can I do it?

3
  • Is this what you are looking for tex.stackexchange.com/a/103458/31058?
    – Ludovic C.
    Sep 4, 2013 at 10:59
  • Maybe you want to adapt the solution from the link I provided by replacing AtBeginSubsection by AtBeginSection and the show/shaded/hide value for the subsection by show/show/hide?
    – Ludovic C.
    Sep 4, 2013 at 11:02
  • Thank you Ludovic! This is quite close to what I was looking for. The only difference is that I want this show/hide of subsection only at the begin of the presentation, where I have the table of content, not at the beginning of each section. How can I do it?
    – Titrio
    Sep 4, 2013 at 11:55

1 Answer 1

10

Using this answer, I came to that code:

\documentclass{beamer}

\usepackage{totcount}
\regtotcounter{section}
\usepackage{multido}

\newcommand{\mytableofcontents}[0]{
\multido{\I=1+1}{\totvalue{section}}{
  \begin{frame}<beamer>
  \setcounter{section}{\I}
  \frametitle{Outline}
  \tableofcontents[
    currentsection,
    sectionstyle=show/show,
    subsectionstyle=show/show/hide,
  ]
  \end{frame}
}
\setcounter{section}{0}
}

\begin{document}

\mytableofcontents

\section{Test Section One}
\begin{frame} test  \total{section} \end{frame}
\subsection{Test Subsection One One}
\begin{frame} test\end{frame}
\subsection{Test Subsection One Two}
\begin{frame} test\end{frame}
\subsection{Test Subsection One Three}
\begin{frame} test\end{frame}

\section{Test Section Two}
\begin{frame} test\end{frame}
\subsection{Test Subsection Two One}
\begin{frame} test\end{frame}
\subsection{Test Subsection Two Two}
\begin{frame} test\end{frame}
\subsection{Test Subsection Two Three}
\begin{frame} test\end{frame}

\section{Test Section Three}
\begin{frame} test\end{frame}
\subsection{Test Subsection Three One}
\begin{frame} test\end{frame}
\subsection{Test Subsection Three Two}
\begin{frame} test\end{frame}
\subsection{Test Subsection Three Three}
\begin{frame} test\end{frame}

\end{document}

And here are the first three frames:

First slide

Second slide

Third slide

1
  • 1
    Thank you very much, this was exactly what I was looking for!
    – Titrio
    Sep 4, 2013 at 12:08

You must log in to answer this question.

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