如何减少演示文稿中目录项之间的间距beamer
?这是我当前的 LaTeX 代码:
\documentclass{beamer}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\title[Short title]{My very long title that doesn't fit into the footer}
\author{Me}
\date{\today}
\beamertemplatenavigationsymbolsempty
\setbeamertemplate{footline}[frame number]
\usetheme{CambridgeUS}
\AtBeginSection[]
{
\begin{frame}
\frametitle{Outline}
\tableofcontents[currentsection, hideothersubsections]
\end{frame}
}
\begin{document}
\maketitle
\clearpage
\begin{frame}
\frametitle{Outline}
\tableofcontents[hideothersubsections]
\end{frame}
\section{Intro}
\begin{frame}
\frametitle{Welcome}
...
\end{frame}
\section{Topic 1}
\begin{frame}
\frametitle{Topic 1}
...
\end{frame}
\section{Topic 2}
\begin{frame}
\frametitle{Topic 2}
...
\end{frame}
\subsection{Red}
\begin{frame}
\frametitle{Red}
...
\end{frame}
\subsection{Green}
\begin{frame}
\frametitle{Green}
...
\end{frame}
\subsection{Blue}
\begin{frame}
\frametitle{Blue}
...
\end{frame}
\section{Topic 3}
\begin{frame}
\frametitle{Topic 3}
...
\end{frame}
\section{Topic 4}
\begin{frame}
\frametitle{Topic 4}
...
\end{frame}
\section{Topic 5}
\begin{frame}
\frametitle{Topic 5}
...
\end{frame}
\section{The end}
\begin{frame}
\frametitle{The end}
End of file :-)
\end{frame}
\end{document}
请参阅第 7 页,缺少“结尾”这一要点,而我需要这一要点。
答案1
内部命令\beamer@sectionintoc
(在文件中定义beamerbasetoc.sty
)控制如何在目录中排版章节条目;它发出一个\vskip1.5em
命令,在章节条目之间添加垂直间距。借助该etoolbox
软件包,您可以轻松修补命令以减少垂直间距。一个小例子:
\documentclass{beamer}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\beamer@sectionintoc}{\vskip1.5em}{\vskip0.5em}{}{}
\makeatother
\title[Short Title]{My very long title that doesn't fix into the footer}
\author{Me}
\date{\today}
\beamertemplatenavigationsymbolsempty
\setbeamertemplate{footline}[frame number]
\usetheme{CambridgeUS}
\AtBeginSection[]
{
\begin{frame}
\frametitle{Outline}
\tableofcontents[currentsection, hideothersubsections]
\end{frame}
}
\begin{document}
\maketitle
\clearpage
\begin{frame}
\frametitle{Outline}
\tableofcontents[hideothersubsections]
\end{frame}
\section{Intro}
\begin{frame}
\frametitle{Welcome}
...
\end{frame}
\section{Topic 1}
\begin{frame}
\frametitle{Topic 1}
...
\end{frame}
\section{Topic 2}
\begin{frame}
\frametitle{Topic 2}
...
\end{frame}
\subsection{Red}
\begin{frame}
\frametitle{Red}
...
\end{frame}
\subsection{Green}
\begin{frame}
\frametitle{Green}
...
\end{frame}
\subsection{Blue}
\begin{frame}
\frametitle{Blue}
...
\end{frame}
\section{Topic 3}
\begin{frame}
\frametitle{Topic 3}
...
\end{frame}
\section{Topic 4}
\begin{frame}
\frametitle{Topic 4}
...
\end{frame}
\section{Topic 5}
\begin{frame}
\frametitle{Topic 5}
...
\end{frame}
\section{The end}
\begin{frame}
\frametitle{The end}
End of file :-)
\end{frame}
\end{document}
答案2
对于像我一样寻找如何减少subsection
a 的末尾section
和下一个section
目录条目之间的空间以及 OP 的问题的人来说,答案是@Gonzalo Medina可以这样调整:
\makeatletter
\patchcmd{\beamer@sectionintoc}{\vskip1.5em}{\vskip0.5em}{}{}
\patchcmd{\beamer@sectionintoc}{\vfill}{\vskip0.2em}{}{}
\makeatother
其中,\vfill
命令重新定义为\vskip
可以修改为您想要的任何值。之前(不重新定义\patchcmd
):
添加上述\patchcmd
命令后(OP 的 MWE 不允许,hideothersubsections
对于我的目的来说这不是必要的):
我希望这对那些与我一样不知道该怎么做的人有帮助!
修改后的代码:
% arara: pdflatex: {options: -halt-on-error}
% arara: pdflatex: {options: -halt-on-error}
\documentclass{beamer}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\title[Short title]{My very long title that doesn't fit into the footer}
\author{Me}
\date{\today}
\beamertemplatenavigationsymbolsempty
\setbeamertemplate{footline}[frame number]
\usetheme{CambridgeUS}
\AtBeginSection[]
{
\begin{frame}
\frametitle{Outline}
\tableofcontents[currentsection]
\end{frame}
}
\makeatletter
\patchcmd{\beamer@sectionintoc}{\vskip1.5em}{\vskip0.5em}{}{}
\patchcmd{\beamer@sectionintoc}{\vfill}{\vskip0.2em}{}{}
\makeatother
\begin{document}
\maketitle
\clearpage
\begin{frame}
\frametitle{Outline}
\tableofcontents
\end{frame}
\section{Intro}
\begin{frame}
\frametitle{Welcome}
...
\end{frame}
\section{Topic 1}
\begin{frame}
\frametitle{Topic 1}
...
\end{frame}
\section{Topic 2}
\begin{frame}
\frametitle{Topic 2}
...
\end{frame}
\subsection{Red}
\begin{frame}
\frametitle{Red}
...
\end{frame}
\subsection{Green}
\begin{frame}
\frametitle{Green}
...
\end{frame}
\subsection{Blue}
\begin{frame}
\frametitle{Blue}
...
\end{frame}
\section{Topic 3}
\begin{frame}
\frametitle{Topic 3}
...
\end{frame}
\section{Topic 4}
\begin{frame}
\frametitle{Topic 4}
...
\end{frame}
\section{Topic 5}
\begin{frame}
\frametitle{Topic 5}
...
\end{frame}
\section{The end}
\begin{frame}
\frametitle{The end}
End of file :-)
\end{frame}
\end{document}