Beamer Slide header 不包括小节
Beamer Slide header is not including subsubsection
我正在使用 beamer 制作幻灯片。我设法让小节显示在 header 中。例如,Security 的子部分是 (1) Background (2) PerSpectron (3) Commercial ....
如何在 header 中也添加 subsubsections
?例如,我想在 header 中的一个额外列中显示多个背景小节,类似于 subsections
。有什么办法吗?谢谢。
首先我想引用 beamer 用户指南:
"Do not use subsubsections, they are evil."
如果你想折磨你的听众,你可以使用这个快速技巧。确保:
你比小节多sections/subsections,否则高度可能不对
你为每个小节中的小节数设置计数器
\documentclass{beamer}
\usetheme{Warsaw}
\usepackage{pgffor}
\newcounter{totalsubsub}
\AtBeginSubsubsection[]{\label{subsubsec:\thesection:\thesubsection:\thesubsubsection}}
\makeatletter
\setbeamertemplate{headline}{%
\leavevmode%
\@tempdimb=2.4375ex%
\ifnum\beamer@subsectionmax<\beamer@sectionmax%
\multiply\@tempdimb by\beamer@sectionmax%
\else%
\multiply\@tempdimb by\beamer@subsectionmax%
\fi%
\ifdim\@tempdimb>0pt%
\advance\@tempdimb by 1.825ex%
\begin{beamercolorbox}[wd=.33\paperwidth,ht=\@tempdimb]{section in head/foot}%
\vbox to\@tempdimb{\vfil\insertsectionnavigation{.33\paperwidth}\vfil}%
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.34\paperwidth,ht=\@tempdimb]{subsection in head/foot}%
\vbox to\@tempdimb{\vfil\insertsubsectionnavigation{.33\paperwidth}\vfil}%
\end{beamercolorbox}%
\begin{beamercolorbox}[leftskip=3.3ex,wd=.33\paperwidth,ht=\@tempdimb]{section in head/foot}%
\begin{minipage}[b][\@tempdimb][c]{.9\linewidth}%
\ifnum\thetotalsubsub>0
\foreach \i in {1,...,\thetotalsubsub}{%
\ifnum\i=\thesubsubsection
\usebeamercolor[fg]{subsubsection in sidebar}
\else
\usebeamercolor[fg]{subsubsection in sidebar shaded}
\fi
\hyperlink{subsubsec:\thesection:\thesubsection:\i}{\nameref{subsubsec:\thesection:\thesubsection:\i}}\par
}
\fi
\end{minipage}%
\end{beamercolorbox}%
\fi%
}
\makeatother
\begin{document}
\section{section}
\subsection{sub 1}
\setcounter{totalsubsub}{3}
\subsubsection{subsub 1}
\begin{frame}
subsub 1
\end{frame}
\subsubsection{subsub 2}
\begin{frame}
subsub 2
\end{frame}
\subsubsection{subsub 3}
\begin{frame}
subsub 3
\end{frame}
\subsection{sub 2}
\setcounter{totalsubsub}{0}
\begin{frame}
abc
\end{frame}
\subsection{sub 3}
\setcounter{totalsubsub}{2}
\begin{frame}
content...
\end{frame}
\subsubsection{subsub 1}
\begin{frame}
subsub 1
\end{frame}
\subsubsection{subsub 2}
\begin{frame}
subsub 2
\end{frame}
\end{document}
我正在使用 beamer 制作幻灯片。我设法让小节显示在 header 中。例如,Security 的子部分是 (1) Background (2) PerSpectron (3) Commercial ....
如何在 header 中也添加 subsubsections
?例如,我想在 header 中的一个额外列中显示多个背景小节,类似于 subsections
。有什么办法吗?谢谢。
首先我想引用 beamer 用户指南:
"Do not use subsubsections, they are evil."
如果你想折磨你的听众,你可以使用这个快速技巧。确保:
你比小节多sections/subsections,否则高度可能不对
你为每个小节中的小节数设置计数器
\documentclass{beamer}
\usetheme{Warsaw}
\usepackage{pgffor}
\newcounter{totalsubsub}
\AtBeginSubsubsection[]{\label{subsubsec:\thesection:\thesubsection:\thesubsubsection}}
\makeatletter
\setbeamertemplate{headline}{%
\leavevmode%
\@tempdimb=2.4375ex%
\ifnum\beamer@subsectionmax<\beamer@sectionmax%
\multiply\@tempdimb by\beamer@sectionmax%
\else%
\multiply\@tempdimb by\beamer@subsectionmax%
\fi%
\ifdim\@tempdimb>0pt%
\advance\@tempdimb by 1.825ex%
\begin{beamercolorbox}[wd=.33\paperwidth,ht=\@tempdimb]{section in head/foot}%
\vbox to\@tempdimb{\vfil\insertsectionnavigation{.33\paperwidth}\vfil}%
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.34\paperwidth,ht=\@tempdimb]{subsection in head/foot}%
\vbox to\@tempdimb{\vfil\insertsubsectionnavigation{.33\paperwidth}\vfil}%
\end{beamercolorbox}%
\begin{beamercolorbox}[leftskip=3.3ex,wd=.33\paperwidth,ht=\@tempdimb]{section in head/foot}%
\begin{minipage}[b][\@tempdimb][c]{.9\linewidth}%
\ifnum\thetotalsubsub>0
\foreach \i in {1,...,\thetotalsubsub}{%
\ifnum\i=\thesubsubsection
\usebeamercolor[fg]{subsubsection in sidebar}
\else
\usebeamercolor[fg]{subsubsection in sidebar shaded}
\fi
\hyperlink{subsubsec:\thesection:\thesubsection:\i}{\nameref{subsubsec:\thesection:\thesubsection:\i}}\par
}
\fi
\end{minipage}%
\end{beamercolorbox}%
\fi%
}
\makeatother
\begin{document}
\section{section}
\subsection{sub 1}
\setcounter{totalsubsub}{3}
\subsubsection{subsub 1}
\begin{frame}
subsub 1
\end{frame}
\subsubsection{subsub 2}
\begin{frame}
subsub 2
\end{frame}
\subsubsection{subsub 3}
\begin{frame}
subsub 3
\end{frame}
\subsection{sub 2}
\setcounter{totalsubsub}{0}
\begin{frame}
abc
\end{frame}
\subsection{sub 3}
\setcounter{totalsubsub}{2}
\begin{frame}
content...
\end{frame}
\subsubsection{subsub 1}
\begin{frame}
subsub 1
\end{frame}
\subsubsection{subsub 2}
\begin{frame}
subsub 2
\end{frame}
\end{document}