进度条主题上的导航栏太长,可以换行吗?

进度条主题上的导航栏太长,可以换行吗?

每张幻灯片顶部的导航栏(链接到每个部分)包含太多部分。我想保留导航栏和每个部分,但我想将其换行,即将其放在两行上。

那可能吗?

我正在使用compress,我正在使用progressbar作为主题。

答案1

您可以重新定义\insertsectionnavigationhorizontal命令并用 parbox 包装各部分。

这是一个可以普遍实现的快速而粗略的示例:

\makeatletter
\def\insertsectionnavigationhorizontal#1#2#3{%
 \hbox to #1{{%
   \def\slideentry##1##2##3##4##5##6{}%
   #2\hskip.3cm%
   \newdimen\tmp@parbox%
   \setlength\tmp@parbox{#1}%
   \addtolength\tmp@parbox{-.6cm}%
   \parbox{\tmp@parbox}{\raggedleft%
     \usebeamerfont{section in head/foot}\usebeamercolor[fg]{section in head/foot}%
     \setbox\beamer@sectionbox=\hbox{}%
     \ht\beamer@sectionbox=1.875ex%
     \dp\beamer@sectionbox=0.75ex%
     \hskip-1.875ex plus-1fill\dohead%
     \box\beamer@sectionbox}\hfil\hskip.3cm%
     #3}}}
\makeatother

这是主题的完整示例progressbar,其中标题高度增加了。

\documentclass[compress]{beamer}

\usetheme{progressbar}
\progressbaroptions{headline=sections}

\makeatletter
\def\insertsectionnavigationhorizontal#1#2#3{%
  \hbox to #1{{%
    \def\slideentry##1##2##3##4##5##6{}%
    #2\hskip.3cm%
    \newdimen\tmp@parbox%
    \setlength\tmp@parbox{#1}%
    \addtolength\tmp@parbox{-.6cm}%
    \parbox{\tmp@parbox}{\raggedleft%
      \usebeamerfont{section in head/foot}\usebeamercolor[fg]{section in head/foot}%
      \setbox\beamer@sectionbox=\hbox{}%
      \ht\beamer@sectionbox=1.875ex%
      \dp\beamer@sectionbox=0.75ex%
      \hskip-1.875ex plus-1fill\dohead%
      \box\beamer@sectionbox}\hfil\hskip.3cm%
      #3}}}

\setbeamertemplate{headline}
{%
  \edef\tempa{sections}
  \ifx\progressbar@headline\tempa
  \leavevmode%
  \begin{beamercolorbox}[ignorestructure.bg=true,wd=\paperwidth,ht=8ex,dp=1.125ex]{structure.fg}%
    \insertsectionnavigationhorizontal{\paperwidth}{}{}%\hskip0pt plus1filll}{}%
    \vspace*{0mm}
  \end{beamercolorbox}%
  \else
  \leavevmode%
  \begin{beamercolorbox}[wd=\paperwidth,ht=4ex,dp=1.125ex]{structure.fg}%
  \end{beamercolorbox}%
  \fi
}

\makeatother

\begin{document}

\section{First very long section name}
\section{Second very long section name}
\section{Third very long section name}
\section{Fourth very long section name}
\section{Fifth very long section name}

\begin{frame}{Title}
Content
\end{frame}

\end{document}

在此处输入图片描述

相关内容