我觉得我陷入了僵局。我想在 Beamer 中制作具有以下特征的目录:
- 章节应编号。所有编号应为方格或圆圈(任意),如 [方格] 选项中所示。
- 我希望目录在每个部分更改时显示(即它必须与 AtBeginSection[] 配合使用)。每当出现新部分时,应在相应部分加下划线,其余部分应加阴影,而不是加下划线。
这是 MWE,目前重点关注幻灯片 2:
\documentclass{beamer}
\setbeamertemplate{section in toc}{\Large{\underline{\inserttocsection}}}
\setbeamertemplate{section in toc shaded}{\inserttocsection}
\begin{document}
\begin{frame}
Slide 1
\end{frame}
\AtBeginSection[]{
\begin{frame}{Both sections should have circles with section numbers!}
\tableofcontents[currentsection]
\end{frame}
}
\section{This section should be underlined}
\begin{frame}
Slide 3
\end{frame}
\section{This section should be shaded and NOT underlined}
\begin{frame}
Slide 5
\end{frame}
\end{document}
但我似乎无法得到正方形或第二部分的标题阴影。如能得到任何帮助我将不胜感激。
答案1
\documentclass{beamer}
\setbeamertemplate{section in toc}{%
\leavevmode\leftskip=2ex%
\llap{%
\usebeamerfont*{section number projected}%
\usebeamercolor{section number projected}%
\begin{pgfpicture}{-1ex}{0ex}{1ex}{2ex}
\color{bg}
\pgfpathcircle{\pgfpoint{0pt}{.75ex}}{1.2ex}
\pgfusepath{fill}
\pgftext[base]{\color{fg}\inserttocsectionnumber}
\end{pgfpicture}\kern1.25ex%
}%
\underline{\inserttocsection}\par%
}
\setbeamertemplate{section in toc shaded}{%
\begin{colormixin}{20!parent.bg}
\leavevmode\leftskip=2ex%
\llap{%
\usebeamerfont*{section number projected}%
\usebeamercolor{section number projected}%
\begin{pgfpicture}{-1ex}{0ex}{1ex}{2ex}
\color{bg}
\pgfpathcircle{\pgfpoint{0pt}{.75ex}}{1.2ex}
\pgfusepath{fill}
\pgftext[base]{\color{fg}\inserttocsectionnumber}
\end{pgfpicture}\kern1.25ex%
}%
\inserttocsection\par%
\end{colormixin}\unskip}
\AtBeginSection[]{
\begin{frame}{Both sections should have circles with section numbers!}
\tableofcontents[currentsection]
\end{frame}
}
\begin{document}
\begin{frame}
Slide 1
\end{frame}
\section{This section should be underlined}
\begin{frame}
Slide 3
\end{frame}
\section{This section should be shaded and NOT underlined}
\begin{frame}
Slide 5
\end{frame}
\end{document}