latex beamer: prevent showing the TOC at one occasion
Asked Answered
L

2

10

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.

Lynnet answered 8/5, 2010 at 20:18 Comment(0)
J
16

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}.

Jiles answered 10/5, 2010 at 8:32 Comment(1)
\section* removes the entire section from the TOC, which I don't want. The second part, using a boolean variable, works perfectly! Thanks!Limpkin
E
2

Another approach is to temporarily change the content of \AtBeginSection:

\documentclass{beamer}


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


\begin{document}

\section{section with toc}  
\begin{frame}
    abc
\end{frame} 

\begingroup
    \AtBeginSection[]{}
    \section{section without toc}   
    \begin{frame}
        abc
    \end{frame} 
\endgroup

\section{section with toc}  
\begin{frame}
    abc
\end{frame} 

\end{document}
Epstein answered 27/2, 2019 at 14:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.