Beamer:当新的小节开始时,目录包含当前节和该小节(仅限)

Beamer:当新的小节开始时,目录包含当前节和该小节(仅限)

我在使用 beamer 时遇到了问题。每次开始新的子节时,我都想仅使用当前节和子节来激活目录(我已经可以处理在每个节的开头激活当前节和所有子节的情况)。在 MWE 下方。

\documentclass{beamer}
 
\usetheme{CambridgeUS}
\usepackage[english]{babel}

\title[Title]{Title}
\author[Author]{Author}
\institute{Institute}
\date[21/10/1985]{21/10/1985}

\AtBeginSection[]
{
  \begin{frame}<beamer>
    \frametitle{Outline}
    \tableofcontents[currentsection, hideothersubsections]
  \end{frame}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

\begin{frame}
\titlepage
\end{frame}

\begin{frame}
\frametitle{Outline}
\tableofcontents%
[hideallsubsections]
\end{frame}

\begin{frame}
\frametitle{Bla}
Bla
\end{frame}

%%%%%%%%%%
%%%%%%%%%%
\section{Section 1}

\begin{frame}
\frametitle{Bla}
Bla
\end{frame}

%%%%%%%%%%
\subsection{Sub 1.1}

\begin{frame}
\frametitle{Bla}
Bla
\end{frame}

%%%%%%%%%%
\subsection{Sub 1.2}

\begin{frame}
\frametitle{Bla}
Bla
\end{frame}

%%%%%%%%%%
%%%%%%%%%%
\section{Section 2}

\begin{frame}
\frametitle{Bla}
Bla
\end{frame}

%%%%%%%%%%
\subsection{Sub 2.1}

\begin{frame}
\frametitle{Bla}
Bla
\end{frame}

%%%%%%%%%%
\subsection{Sub 2.2}

\begin{frame}
\frametitle{Bla}
Bla
\end{frame}

\end{document}

我尝试添加下面一段代码,但没有效果。

\AtBeginSubsection[]
{
  \begin{frame}<beamer>
    \frametitle{Outline}
    \tableofcontents[currentsection, currentsubsection, hideothersubsections]
  \end{frame}
}

欢迎任何反馈。

答案1

如果使用subsectionstyle=<style for current subsection>/<style for other subsections in current section>/<style for subsections from other sections>而不是currentsubsection和 类似选项,则可以进行更精细的控制。可能的样式有showshadedhide

\documentclass{beamer}
 
\usetheme{CambridgeUS}
\usepackage[english]{babel}

\AtBeginSubsection[]
{
  \begin{frame}<beamer>
    \frametitle{Outline}
    \tableofcontents[ sectionstyle=show/shaded,subsectionstyle=show/shaded/shaded]
  \end{frame}
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

\begin{frame}
\titlepage
\end{frame}

\begin{frame}
\frametitle{Outline}
\tableofcontents[hideallsubsections]
\end{frame}

\begin{frame}
\frametitle{Bla}
Bla
\end{frame}

%%%%%%%%%%
%%%%%%%%%%
\section{Section 1}

\begin{frame}
\frametitle{Bla}
Bla
\end{frame}

%%%%%%%%%%
\subsection{Sub 1.1}

\begin{frame}
\frametitle{Bla}
Bla
\end{frame}

%%%%%%%%%%
\subsection{Sub 1.2}

\begin{frame}
\frametitle{Bla}
Bla
\end{frame}

%%%%%%%%%%
%%%%%%%%%%
\section{Section 2}

\begin{frame}
\frametitle{Bla}
Bla
\end{frame}

%%%%%%%%%%
\subsection{Sub 2.1}

\begin{frame}
\frametitle{Bla}
Bla
\end{frame}

%%%%%%%%%%
\subsection{Sub 2.2}

\begin{frame}
\frametitle{Bla}
Bla
\end{frame}

\end{document}

在此处输入图片描述

相关内容