我正在使用目录幻灯片来显示当前部分和当前子部分。如果在某一部分之后和下一子部分开始之前有帧,则会产生预期的行为。但如果部分和子部分紧邻且中间没有帧,则会产生两个几乎相同的目录。参见示例。
理想情况下,我想隐藏第 7 页,只显示第 8 页;即 C 帧和 D 帧之间的页面。手动技术(在文本中打开/关闭样式等)并不是一个真正的选择;从 org-mode 生成的幻灯片太多了。
我找不到任何相关的想法来解决这个问题。谢谢任何提示!
\documentclass[nooutline]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\AtBeginSection[]{
\begin{frame}<beamer>
\frametitle{Table of contents}
\tableofcontents[currentsection,hideothersubsections]
\end{frame}}
\AtBeginSubsection[]{
\begin{frame}<beamer>
\frametitle{Table of contents}
\tableofcontents[currentsubsection,currentsection, subsectionstyle=show/shaded/hide]
\end{frame}}
%---------
\begin{document}
\section{Section 1}
\begin{frame}{Frame A}
\end{frame}
\subsection{Subsection 1.1}
\begin{frame}{Frame B}
\end{frame}
\subsection{Subsection 1.2}
\begin{frame}{Frame C}
\end{frame}
\section{Section 2}
\subsection{Subsection 2.1}
\begin{frame}{Frame D}
\end{frame}
\subsection{Subsection 2.2}
\begin{frame}{Frame E}
\end{frame}
\end{document}
答案1
可能性 1:隐藏子部分页面
\documentclass[nooutline]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\newcounter{foo}
\AtBeginSection[]{
\begin{frame}<beamer>
\frametitle{Table of contents}
\tableofcontents[currentsection,hideothersubsections]
\end{frame}}
\AtBeginSubsection[]{
\setcounter{foo}{\insertsectionstartpage}
\addtocounter{foo}{1}
\ifnum\thepage=\thefoo
\else
\begin{frame}<beamer>
\frametitle{Table of contents}
\tableofcontents[currentsubsection,currentsection, subsectionstyle=show/shaded/hide]
\end{frame}
\fi
}
%---------
\begin{document}
\section{Section 1}
\begin{frame}{Frame A}
\end{frame}
\subsection{Subsection 1.1}
\begin{frame}{Frame B}
\end{frame}
\subsection{Subsection 1.2}
\begin{frame}{Frame C}
\end{frame}
\section{Section 2}
\subsection{Subsection 2.1}
\begin{frame}{Frame D}
\end{frame}
\subsection{Subsection 2.2}
\begin{frame}{Frame E}
\end{frame}
\end{document}
可能性 2:隐藏部分页面
\documentclass[nooutline]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\newcounter{foo}
\makeatletter
\AtBeginSection[]{
\beamer@nextpage\beamer@endpageofsubsection%
\setcounter{foo}{\beamer@tempcount}
\ifnum\thepage=\thefoo
\else
\begin{frame}<beamer>
\frametitle{Table of contents}
\tableofcontents[currentsection,hideothersubsections]
\end{frame}
\fi
}
\makeatother
\AtBeginSubsection[]{
\begin{frame}<beamer>
\frametitle{Table of contents}
\tableofcontents[currentsubsection,currentsection, subsectionstyle=show/shaded/hide]
\end{frame}
}
\begin{document}
\section{Section 1}
\begin{frame}{Frame A}
\end{frame}
\subsection{Subsection 1.1}
\begin{frame}{Frame B}
\end{frame}
\subsection{Subsection 1.2}
\begin{frame}{Frame C}
\end{frame}
\section{Section 2}
\subsection{Subsection 2.1}
\begin{frame}{Frame D}
\end{frame}
\subsection{Subsection 2.2}
\begin{frame}{Frame E}
\end{frame}
\end{document}