latex beamer: prevent showing the TOC at one occasion

无人久伴 提交于 2019-12-10 04:06:44

问题


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.


回答1:


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




回答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}


来源:https://stackoverflow.com/questions/2795478/latex-beamer-prevent-showing-the-toc-at-one-occasion

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!