latex beamer: prevent showing the TOC at one occasion

cknoll picture cknoll · May 8, 2010 · Viewed 9.2k times · Source

Normally I use

\AtBeginSection[]
{
  \begin{frame}<beamer>{Gliederung}
    \tableofcontents[currentsection]
  \end{frame}
}

in my preamble to achieve that before a new sections starts the TOC is shown with the now starting section highlighted.

In the talk I am actually preparing I have one special section for which I do not want this behavior. The transition from the section before should be "silent". All the other sections should start like they do now.

I am sure that must be possible.

Answer

Lohrun picture Lohrun · May 10, 2010

In the beamer manual, the command \AtBeginSection is explained as follows:

\AtBeginSection[special star text]{text}

If you declare the special section with the star command \section*, the section table of content will not appear. This solution is the first that comes to mind but may change the way the section is represented in the document.

Another approach (experimental, I never tested it) would be to use a boolean parameter. If the boolean parameter is set, then the code is not printed. Then you declare your section normally but you set the boolean value around your code.

Here is a code sample that should do the trick :

\RequirePackage{ifthen} % package required

\newboolean{sectiontoc}
\setboolean{sectiontoc}{true} % default to true

\AtBeginSection[]
{
  \ifthenelse{\boolean{sectiontoc}}{
    \begin{frame}<beamer>{Gliederung}
      \tableofcontents[currentsection]
    \end{frame}
  }
}

\newcommand{\toclesssection}[1]{
  \setboolean{sectiontoc}{false}
  \section{#1}
  \setboolean{sectiontoc}{true}
}

Then in the document, just declare your special section as \toclesssection{My section without the toc}.