我在 Beamer 文档中有几个部分,从第二部分开始第 1 部分。为此,我使用
\tableofcontents[firstsection=2]
但第一节的数字为零。所以,我希望第一节没有数字。有点像\frontmatter
书籍类的选项。有什么想法吗?
这是 MWE:
\documentclass{beamer}
\usetheme{CambridgeUS}
\begin{document}
\begin{frame}{Contents}
\tableofcontents[firstsection=2]
\end{frame}
\section{no-numerated section}
\begin{frame}
\begin{itemize}
\item
\end{itemize}
\end{frame}
\section{First Section}
\subsection{First sub-section}
\begin{frame}
\begin{itemize}
\item
\end{itemize}
\end{frame}
\subsection{Second sub-section}
\begin{frame}
\begin{itemize}
\item
\end{itemize}
\end{frame}
\section{Second Section}
\subsection{First sub-section}
\begin{frame}
\begin{itemize}
\item
\end{itemize}
\end{frame}
\subsection{Second sub-section}
\begin{frame}
\begin{itemize}
\item
\end{itemize}
\end{frame}
\section{Third section}
\begin{frame}
\begin{itemize}
\item
\end{itemize}
\end{frame}
\end{document}
答案1
\beamer@sectionintoc
这是一个解决方案,使用文件中实现的内部命令的重新定义beamerbasetoc.sty
;通过重新定义,如果小于,则不会在 ToC 中排版任何数字1
:
\documentclass{beamer}
\usetheme{CambridgeUS}
\makeatletter
\def\beamer@sectionintoc#1#2#3#4#5{%
\ifnum\c@tocdepth>0%
\ifnum#4=\beamer@showpartnumber%
{
\beamer@saveanother%
\gdef\beamer@todo{}%
\beamer@slideinframe=#1\relax%
\expandafter\only\beamer@tocsections{\gdef\beamer@todo{%
\beamer@tempcount=#5\relax%
\advance\beamer@tempcount by\beamer@sectionadjust%
\ifnum\beamer@tempcount>0
\edef\inserttocsectionnumber{\the\beamer@tempcount}\else
\edef\inserttocsectionnumber{}\fi%
\def\inserttocsection{\hyperlink{Navigation#3}{#2}}%
\beamer@tocifnothide{\ifnum\c@section=#1\beamer@toc@cs\else\beamer@toc@os\fi}%
{
\ifbeamer@pausesections\pause\fi%
\ifx\beamer@toc@ooss\beamer@hidetext
\vskip1.5em
\else
\vfill
\fi
{%
\hbox{\vbox{%
\def\beamer@breakhere{\\}%
\beamer@tocact{\ifnum\c@section=#1\beamer@toc@cs\else\beamer@toc@os\fi}{section in toc}}}%
\par%
}%
}%
}
}%
\beamer@restoreanother%
}
\beamer@todo%
\fi\fi%
}
\makeatother
\begin{document}
\begin{frame}{Contents}
\tableofcontents[firstsection=2]
\end{frame}
\section{no-numerated section}
\begin{frame}
\begin{itemize}
\item
\end{itemize}
\end{frame}
\section{First Section}
\subsection{First sub-section}
\begin{frame}
\begin{itemize}
\item
\end{itemize}
\end{frame}
\subsection{Second sub-section}
\begin{frame}
\begin{itemize}
\item
\end{itemize}
\end{frame}
\section{Second Section}
\subsection{First sub-section}
\begin{frame}
\begin{itemize}
\item
\end{itemize}
\end{frame}
\subsection{Second sub-section}
\begin{frame}
\begin{itemize}
\item
\end{itemize}
\end{frame}
\section{Third section}
\begin{frame}
\begin{itemize}
\item
\end{itemize}
\end{frame}
\end{document}