有没有办法让 beamer 在我使用\section{title}
或\subsection{title}
或 (但愿不会)时自动粘贴在带有居中标题的幻灯片中\subsubsection{title}
?我希望每次使用这些命令之一时,某个包或命令都会执行此操作,但我会满足\maketitle
于在每个部分或小节中起作用的类型命令。
答案1
您可以使用宏\AtBeginSection
、\AtBeginSubsection
和\AtBeginSubsubsection
在每个 (sub)(sub) 节的开头自动执行某些操作。要创建标题框,beamer
提供命令\sectionpage
和\subsectionpage
。\subsubsectionpage
默认情况下缺失,但您可以轻松地自行定义它:
\documentclass{beamer}
\usetheme{Ilmenau}
% Add support for \subsubsectionpage
\def\subsubsectionname{\translate{Subsubsection}}
\def\insertsubsubsectionnumber{\arabic{subsubsection}}
\setbeamertemplate{subsubsection page}
{
\begin{centering}
{\usebeamerfont{subsubsection name}\usebeamercolor[fg]{subsubsection name}\subsubsectionname~\insertsubsubsectionnumber}
\vskip1em\par
\begin{beamercolorbox}[sep=4pt,center]{part title}
\usebeamerfont{subsubsection title}\insertsubsubsection\par
\end{beamercolorbox}
\end{centering}
}
\def\subsubsectionpage{\usebeamertemplate*{subsubsection page}}
\AtBeginSection{\frame{\sectionpage}}
\AtBeginSubsection{\frame{\subsectionpage}}
\AtBeginSubsubsection{\frame{\subsubsectionpage}}
\begin{document}
\section{Section 1}
\subsection{Subsection 1}
\frame{}\frame{}
\subsection{Subsection 2}
\subsubsection{Subsubsection 1}
\frame{}
\section{Section 2}
\frame{}
\end{document}