Beamer 与华沙主题:两列导航

Beamer 与华沙主题:两列导航

我正在使用带有华沙主题的 Beamer 进行演示。我非常喜欢在每张幻灯片的开头放一个目录的迷你大纲。但是,我发现它往往会占用相当多的垂直空间。因此,我想知道是否可以将每张幻灯片的目录(\sections\subsections)分成两列,以便:

A
B
C
D

A B  or  A C
C D      B D

我知道有compress选项强制将章节和子章节列表放在一行上,但这有点太极端了。我还看到了几个与将全局目录拆分为两列有关的问题——但我对出现在每个框架开头的迷你目录感兴趣(至少在华沙主题中)。

答案1

这是一个可能的解决方案;我们的想法是重新定义\insertsectionnavigation\insertsubsectionnavigation(在中实现)以使用使用包中的环境beamerbasenavigation.sty生成的两列布局;还需要重新定义模板以通过这种新布局减少标题的高度:multicolsmulticolheadline

\documentclass{beamer}
\usetheme{Warsaw}
\usepackage{multicol}

\makeatletter
\def\insertsectionnavigation#1{%
  \hbox to #1{\vbox{{\usebeamerfont{section in head/foot}%
     \usebeamercolor[fg]{section in head/foot}%
     \def\slideentry##1##2##3##4##5##6{}%
     \def\sectionentry##1##2##3##4##5{%
       \ifnum##5=\c@part%
       \def\insertsectionhead{##2\hskip1em}%
       \def\insertsectionheadnumber{##1}%
       \def\insertpartheadnumber{##5}%
         \hyperlink{Navigation##3}{%
             \ifnum\c@section=##1%
               {\usebeamertemplate{section in head/foot}}%
             \else%
               {\usebeamertemplate{section in head/foot shaded}}%
             \fi%
         }\par
       \fi}%
       \parbox[c][0cm][c]{.5\paperwidth}{%
       \begin{multicols}{2}
       \dohead
       \end{multicols}}\space}
     }%
  \hfil}%
}

\def\insertsubsectionnavigation#1{%
  \hbox to #1{%
    \vbox{{%
      \usebeamerfont{subsection in head/foot}\usebeamercolor[fg]{subsection in head/foot}%
      \vskip0.5625ex%
      \beamer@currentsubsection=0%
      \def\sectionentry##1##2##3##4##5{}%
      \def\slideentry##1##2##3##4##5##6{\ifnum##6=\c@part\ifnum##1=\c@section%
        \ifnum##2>\beamer@currentsubsection%
        \beamer@currentsubsection=##2%
        \def\insertsubsectionhead{##5}%
        \def\insertsectionheadnumber{##1}%
        \def\insertsubsectionheadnumber{##2}%
        \def\insertpartheadnumber{##6}%
        \beamer@link(##4){%
              \ifnum\c@subsection=##2%
                {\usebeamertemplate{subsection in head/foot}}%
              \else%
                {\usebeamertemplate{subsection in head/foot shaded}}%
              \fi\hfill}\par
        \fi\fi\fi}%
       \hspace*{0.5em}\parbox[c][0cm][c]{\dimexpr.5\paperwidth-1em\relax}{%
       \begin{multicols}{2}
       \dohead\vskip0.5625ex\end{multicols}
       }\space
   }\hfil
}}}

\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.125ex%
    \begin{beamercolorbox}[wd=.5\paperwidth,ht=0.5\@tempdimb,dp=2ex]{section in head/foot}%
      \vbox to0.5\@tempdimb{\vfill\insertsectionnavigation{.5\paperwidth}\vfill}%
    \end{beamercolorbox}%
    \begin{beamercolorbox}[wd=.5\paperwidth,ht=0.5\@tempdimb,dp=2ex]{subsection in head/foot}%
      \vbox to0.5\@tempdimb{\vfill\insertsubsectionnavigation{.5\paperwidth}\vfill}%
    \end{beamercolorbox}%
  \fi%
}
\makeatother

\begin{document}

\section{Test Section One}
\frame{test}
\subsection{Test Subsection One One}
\frame{test}
\subsection{Test Subsection One Two}
\frame{test}
\subsection{Test Subsection One Three}
\frame{test}
\subsection{Test Subsection One Four}
\frame{test}
\section{Test Section Two}
\frame{test}
\section{Test Section Three}
\frame{test}
\section{Test Section Four}
\frame{test}
\section{Test Section Five}
\frame{test}
\section{Test Section Six}
\frame{test}
\section{Test Section Seven}
\frame{test}

\end{document}

其中一个框架的标题图像,显示了具有所要求的两列布局的部分和小节:

在此处输入图片描述

为了进行比较,相同的标题使用默认Warsaw主题:

在此处输入图片描述

相关内容