LaTeX Beamer:如何在某个场合下防止显示目录?

10

通常我使用

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

我在导言中设置了一个功能,使得在新的章节开始之前,TOC(目录)会显示当前正在开始的章节。

但是,在我准备的演讲中,有一个特殊的章节,我不希望出现这种行为。前一个章节和这个章节之间的过渡应该是“静默”的。所有其他章节都应该像现在一样开始。

我相信这一定是可能的。

2个回答

16
在Beamer手册中,命令\AtBeginSection的解释如下:
\AtBeginSection[special star text]{text}
如果你使用星号命令\section*声明特殊章节,那么章节目录将不会出现。这个解决方案是首先想到的,但可能会改变章节在文档中的表示方式。
另一种方法(实验性质的,我从未测试过)是使用布尔参数。如果设置了布尔参数,则代码将不会被打印。然后你可以正常地声明你的章节,但需要在你的代码周围设置布尔值。
下面是一个可以解决问题的代码示例:
\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}
}

然后在文档中,只需将你的特殊部分声明为\toclesssection{My section without the toc}


\section* 会将整个章节从目录中移除,而我并不想要这样。第二部分使用布尔变量的方法完美解决了问题!谢谢! - snwflk

2
另一种方法是暂时更改\AtBeginSection的内容:

最初的回答是修改\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}

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接