beamer 侧边栏中有两列(或更多列)导航

beamer 侧边栏中有两列(或更多列)导航

我有一个很长的演示文稿,基本上是练习的集合。每个练习都有自己的子部分,显示在侧边栏中,如下所示:

\documentclass{beamer}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usetheme[hideothersubsections,left,width=1.4cm]{Goettingen}

\begin{document}
 \begin{frame}
  \frametitle{Start page}
 \end{frame}
 \begin{frame} 
  \section{section 1}
  \subsection{1}
  \subsection{2}
  \subsection{3}
  \subsection{4}
  \subsection{5}
  \subsection{6}
  \subsection{7}
 \end{frame}
\end{document} 

最终我得到了这个:在此处输入图片描述 超过一定数字后,侧边栏就会被填满,并且一些数字会在框架之外结束。

我想要的是两列(或更多)侧边栏导航,以便我可以添加更多练习。

看起来类似的问题已经解决了这里,但我的技能还不够,无法将该解决方案应用于垂直侧边栏。

任何帮助深表感谢。

后续#1

现在我已经到了这一步: 在此处输入图片描述
我仍然不能做的是:

1) 从 multicol 环境中排除部分,即第 2 部分应该在第一行,而不是第二行

2)第二列的第一小节应与第一列的第一小节水平对齐,即 1.5 应与 1.1 对齐。

这是代码,我只是在定义的末尾添加了 multicol 环境\insertverticalnavigation

\documentclass{beamer}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{multicol}

\usetheme[hideothersubsections,left,width=1.4cm]{Goettingen}


\makeatletter
\def\insertverticalnavigation#1{%
  \vbox{%
    \def\sectionentry##1##2##3##4##5{%
      \ifnum##5=\c@part%
      \def\insertsectionhead{##2}%
      \def\insertsectionheadnumber{##1}%
      \def\insertpartheadnumber{##5}%
      \hbox{{%
        \usebeamerfont{section in sidebar}\usebeamercolor[fg]{section in sidebar}%
          \hyperlink{Navigation##3}{%
          \ifnum\c@section=##1%
            \ifnum\c@subsection=0\relax%
              {\usebeamertemplate{section in sidebar}}%
            \else%
              \ifx\beamer@nav@css\beamer@hidetext%
                {\usebeamertemplate{section in sidebar}}%
              \else%
                {\usebeamertemplate{section in sidebar shaded}}%
              \fi%
            \fi%
          \else
            {\usebeamertemplate{section in sidebar shaded}}%
          \fi}}}%
      \beamer@currentsubsection=0\relax\fi}%
    \def\slideentry##1##2##3##4##5##6{}%
    \def\beamer@subsectionentry##1##2##3##4##5{%
      \ifnum##1=\c@part%
      \def\insertpartheadnumber{##1}%
      \def\insertsectionheadnumber{##2}%
      \def\insertsubsectionheadnumber{##3}%
      \def\insertsubsectionhead{##5}%
       \beamer@tocifnothide{\ifnum\c@section=##2\ifnum\c@subsection=##3\beamer@nav@css\else\beamer@nav@oss\fi\else\beamer@nav@ooss\fi}%
      {\hbox{{%
        \usebeamerfont{subsection in sidebar}\usebeamercolor[fg]{subsection in sidebar}%
          \hyperlink{Navigation##4}{%
          \ifnum\c@section=##2%
            \ifnum\c@subsection=##3%
              \ifnum\c@subsubsection=0\relax%
                {\usebeamertemplate{subsection in sidebar}}%
              \else%
                {\usebeamertemplate{subsection in sidebar shaded}}%
              \fi%
            \else%
              {\usebeamertemplate{subsection in sidebar shaded}}%
            \fi%
          \else%
            {\usebeamertemplate{subsection in sidebar shaded}}%
          \fi}}}%
      }%
      \fi}%
    \def\beamer@subsubsectionentry##1##2##3##4##5##6{%
      \ifnum##1=\c@part%
      \def\insertpartheadnumber{##1}%
      \def\insertsectionheadnumber{##2}%
      \def\insertsubsectionheadnumber{##3}%
      \def\insertsubsubsectionheadnumber{##3}%
      \def\insertsubsubsectionhead{##6}%
      \beamer@tocifnothide{\ifnum\c@section=##2\ifnum\c@subsection=##3\beamer@nav@css\else\beamer@nav@oss\fi\else\beamer@nav@ooss\fi}%
      {\hbox{{%
        \usebeamerfont{subsubsection in sidebar}\usebeamercolor[fg]{subsubsection in sidebar}%
          \hyperlink{Navigation##5}{%
          \ifnum\c@section=##2%
            \ifnum\c@subsection=##3%
              \ifnum\c@subsubsection=##4%
                {\usebeamertemplate{subsubsection in sidebar}}%
              \else
                {\usebeamertemplate{subsubsection in sidebar shaded}}%
              \fi%
            \else%
              {\usebeamertemplate{subsubsection in sidebar shaded}}%
            \fi%
          \else%
            {\usebeamertemplate{subsubsection in sidebar shaded}}%
          \fi}}}%
           }%        
      \fi}%
       \hspace*{0.1em}\parbox[c][1cm][c]{1cm}{              %%%%%%%%%%%%%%%%
       \begin{multicols}{2}                                 % multicol     % 
       \dohead\end{multicols}                               % code         %
       }                                                    %%%%%%%%%%%%%%%%
  }%
}
\makeatother


\begin{document}
  \section{1}
  \subsection{1.1}
 \frame{test} 
  \subsection{1.2}
 \frame{test} 
  \subsection{1.3}
 \frame{test} 
  \subsection{1.4}
 \frame{test} 
  \subsection{1.5}
 \frame{test} 
  \subsection{1.6}
 \frame{test} 
  \subsection{1.7}
 \frame{test} 
  \section{2}
  \subsection{2.1}
 \frame{test} 
  \subsection{2.2}
 \frame{test} 
\end{document}

答案1

由于自定义\insertverticalnavigation似乎太复杂,我尝试了不同的方法并设法获得了我想要的。我无法从多列环境中排除部分,因此我决定将部分和子部分导航分开,将后者放在前者的末尾。

以下是代码:

\documentclass{beamer}

\usepackage{multicol}

\usetheme[hideothersubsections,left,width=1.4cm]{Goettingen}


\makeatletter
\def\insertsubsectionnavigation#1{%
  \hbox to #1{%
    \vbox{{%
      \usebeamerfont{subsection in sidebar}\usebeamercolor[fg]{subsection in sidebar}%
      \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.1em}\parbox[c][1cm][c]{1.4cm}{%
       \begin{multicols}{3}
       \dohead\end{multicols}
       }\space
   }\hfil
}}}

\setbeamertemplate{sidebar left}
{%
  \leavevmode\@tempdimb=2.7ex%
      \multiply\@tempdimb by\beamer@sectionmax%
    \begin{beamercolorbox}[wd=1.4cm,ht=0.5cm,dp=2ex]{title in sidebar}%
      {\par\centering\inserttitle\par}%
    \end{beamercolorbox}\\
    \begin{beamercolorbox}[wd=1.4cm,ht=0.5cm,dp=2ex]{author in sidebar}%
      {\par\centering\insertauthor\par}%
    \end{beamercolorbox}\\
    \begin{beamercolorbox}[wd=1.4cm,ht=\@tempdimb,dp=2ex]{section in sidebar}%
      {\vfill\insertsectionnavigation{1.4cm}}%
    \end{beamercolorbox}\\
    \begin{beamercolorbox}[wd=1.4cm,ht=0.8cm]{subsection in sidebar}%
      {\vfill\insertsubsectionnavigation{1.4cm}}%
    \end{beamercolorbox}%
}
\makeatother

\title{Title}
\author{Author}

\begin{document}
  \section{Section 1}
  \subsection{1}
 \frame{test} 
  \subsection{2}
 \frame{test} 
  \subsection{3}
 \frame{test} 
  \subsection{4}
 \frame{test} 
  \subsection{5}
 \frame{test} 
  \subsection{6}
 \frame{test} 
  \subsection{7}
 \frame{test}
 \subsection{8}
 \frame{test}
  \subsection{9}
 \frame{test} 
  \subsection{10}
 \frame{test} 
  \subsection{11}
 \frame{test} 
  \subsection{12}
 \frame{test} 
  \section{Section 2}
  \subsection{1}
 \frame{test} 
  \subsection{2}
 \frame{test} 
  \subsection{3}
 \frame{test} 
  \subsection{4}
 \frame{test} 
  \subsection{5}
 \frame{test} 
  \subsection{6}
 \frame{test} 
  \subsection{7}
 \frame{test}
 \subsection{8}
 \frame{test}
  \subsection{9}
 \frame{test} 
  \subsection{10}
 \frame{test} 
  \subsection{11}
 \frame{test} 
  \subsection{12}
 \frame{test} 
\end{document}  

必填截图:
在此处输入图片描述

简而言之,我重新定义了\insertsubsectionnavigation一个包含三列布局的模板,然后设置了一个新的侧边栏模板,其中包含默认 Goettingen 模板中的所有内容,但子部分导航移到了部分导航的末尾。出于某种原因,我不得不使用 head/foot 子部分模板而不是侧边栏模板,因为后者搞砸了多列导航。

相关内容