使用 \insertnavigation 在自定义 Beamer 主题标题中显示多行部分

使用 \insertnavigation 在自定义 Beamer 主题标题中显示多行部分

ua-beamer我正在使用由 Nico Schlomer 进行大量修改的主题版本,该版本可从以下网址获取:

https://github.com/nschloe/ua-beamer/blob/master/theme/beamerouterthemeUniversiteitAntwerpen.sty

我修改了.sty文件,我想当行空间用完时,新的部分会出现在标题的新行上。请看下图中的示例。文件中有 9 个部分.tex,但最后 2 个部分被截断了。

部分被切断

我希望一旦空间用完,各个部分就移动到新行,如下图所示:

关于新留置权的条款

我在下面创建了一个最小的示例。

所需的文件之一是beamerthemeUniversityCustom.sty文件

% Original from 2009--2011 by Nico Schlomer
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.

% -------------------------------------------------------------------------
% introduce options
\DeclareOptionBeamer{compress}{\beamer@compresstrue}

\newif\ifbeamer@dark
\beamer@darkfalse
\DeclareOptionBeamer{dark}{\beamer@darktrue}

\newif\ifbeamer@darktitle
\beamer@darktitlefalse
\DeclareOptionBeamer{darktitle}{\beamer@darktitletrue}

\newif\ifbeamer@framenumber
\beamer@framenumberfalse
\DeclareOptionBeamer{framenumber}{\beamer@framenumbertrue}

\newif\ifbeamer@totalframenumber
\beamer@totalframenumberfalse
\DeclareOptionBeamer{totalframenumber}{\beamer@totalframenumbertrue}

\ProcessOptionsBeamer
% -------------------------------------------------------------------------

\mode<presentation>

%\useinnertheme{UniversityCustom}
%\usefonttheme {UniversityCustom}
%\usecolortheme{UniversityCustom}
\useoutertheme{UniversityCustom}

%\useoutertheme[subsection=false]{smoothbars}
%\useinnertheme[shadow=true]{rounded}
%\usecolortheme{orchid}
%\usecolortheme{whale}

\setbeamerfont{block title}{size={}}


\mode
<all>

需要的另一个文件是该beamerouterthemeUniversityCustom.sty文件。

% Copyright 2009--2011 by Nico Schlomer
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.

% \geometry{paperheight=7.5in,paperwidth=10.0in}
% ... Hang on! As suggested in the manual, don't mess around with beamer's
% assumed page dimensions (128mm x 96mm). Fonts, for example, do no get 
% automatically scaled and will look tiny if the above is executed.
% Instead, define a multiplier 12.8/(10.0*2.54) = 64/127 and adjust all
% respective lengths.


% ----------------------------------------------------------------------------
% *** required packages <<<
% ----------------------------------------------------------------------------
\RequirePackage{calc}
\RequirePackage{ifthen}
% ----------------------------------------------------------------------------
% *** END required packages >>>
% ----------------------------------------------------------------------------

\mode<presentation>

% ----------------------------------------------------------------------------
% *** DEFINE LENGTHS <<<
% ----------------------------------------------------------------------------
\newlength{\margin}
\setlength{\margin}{0.8832cm}% 

\newlength{\ulogowidth}
\setlength{\ulogowidth}{1.1136cm}% 
\newlength{\ulogoheight}
\setlength{\ulogoheight}{0.90066895151709692cm}% 
\ifbeamer@dark\else%
  \newlength{\ulogopadding}
  \setlength{\ulogopadding}{0.2784cm}
\fi
% ----------------------------------------------------------------------------
% *** END DEFINE LENGTHS >>>
% ----------------------------------------------------------------------------


% ----------------------------------------------------------------------------
% *** DEFINE IMAGES <<<
% ----------------------------------------------------------------------------

\pgfdeclareimage[width=2.5cm]{ULogo}{UGlogo}

\newlength{\textlogoheight}
\setlength{\textlogoheight}{0.37218461538461539cm}
\pgfdeclareimage[width=0cm]{uTextColor}{mathstat}


\ifthenelse{ \boolean{beamer@dark} \OR \boolean{beamer@darktitle} }
{\pgfdeclareimage[width=\paperwidth]{uaBackgroundDark}{uaBackgroundDarkBlue}}
{}

\ifbeamer@dark%
  \pgfdeclareimage[width=\paperwidth]{uaBackgroundLight}{uaBackgroundLightBlue}
\else%
  \newlength{\wavewidth}
  \setlength{\wavewidth}{10.0cm}%
  \newlength{\waveheight}
  \setlength{\waveheight}{0.6cm}%
  \pgfdeclareimage[width=\wavewidth,height=\waveheight]{uWave}{uabottomwave}
\fi
% ----------------------------------------------------------------------------
% *** END DEFINE IMAGES <<<
% ----------------------------------------------------------------------------



% ----------------------------------------------------------------------------
% *** HEADLINE <<<
% ----------------------------------------------------------------------------

\ifthenelse{ \boolean{beamer@dark} \OR \(\boolean{beamer@darktitle}\AND\c@framenumber=1\) }{%
  \defbeamertemplate*{headline}{univ theme}%
  {
    % page number
    \ifbeamer@framenumber%
      \ifnum\c@framenumber=1\else
       \pgftext[right,top,at=\pgfpoint{\paperwidth-\margin}{-0.04\paperheight}]{%
          \usebeamerfont{frame number in head}%
          \usebeamercolor[fg]{frame number in head}%
          \insertframenumber{}%
          \ifbeamer@totalframenumber%
            /\inserttotalframenumber%
          \fi
        }%
      \fi
    \fi%
  }%
}{
  \newlength{\logotopmargin}%
  \setlength{\logotopmargin}{0.300cm}%  
  \defbeamertemplate*{headline}{univ theme}%
  {%
    \vskip\logotopmargin%
    \hskip\margin%
    \ifthenelse{ \boolean{beamer@dark} \OR \(\boolean{beamer@darktitle}\AND\c@framenumber=1\) }
    {%
      \vskip5cm
    }
    {

\hspace*{-0.5cm}
\begin{minipage}[t][][b]{0.35\textwidth}
\centering
    \pgfuseimage{ULogo}
\end{minipage}% <---------------- Note the use of "%"
\begin{minipage}[t][][b]{0.5\textwidth}
\raggedright
\hbox{
\begin{beamercolorbox}[wd=\paperwidth,ht=3.00ex,dp=5.5ex]{palette quaternary}%
    \insertnavigation{0.5\textwidth}
  \end{beamercolorbox}%
}
\end{minipage}
    }
  }
}
% ----------------------------------------------------------------------------
% *** END HEADLINE <<<
% ----------------------------------------------------------------------------



% ----------------------------------------------------------------------------
% *** FRAMETITLE <<<
% ----------------------------------------------------------------------------
\newlength\frametitletopmargin
\ifbeamer@compress%
  \setlength{\frametitletopmargin}{-1.01cm}% 
\else
  \setlength{\frametitletopmargin}{-1.01cm}% 
\fi

\ifbeamer@dark\else%
  \newlength{\frametitlewidth}
  \setlength{\frametitlewidth}{\textwidth-\ulogowidth-\ulogopadding}
\fi

\defbeamertemplate*{frametitle}{univ theme}
{%
  \ifbeamer@dark%
    % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    \vskip\frametitletopmargin%
    \raggedleft\insertframetitle\par%
    % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  \else%
    \ifbeamer@compress%
      \nointerlineskip%
      \vskip-\ulogoheight%
      \vbox to \ulogoheight{%
        \vfil%
        \leftskip=\ulogowidth%
        \advance\leftskip by\ulogopadding%
        \begin{beamercolorbox}[right=1.1136cm]{frame title}%
        \hfill\insertframetitle\par%
        \end{beamercolorbox}%
        \vfil%
      }%
    \else%
      \vspace*{-0.50cm} %%%% FRAME TITLE HEIGHT
      \rule{\textwidth}{0.50pt}
      \hfill\\[-0.15em]
      \begin{beamercolorbox}[left]{frame title}%
      \parbox{\textwidth}
        \insertframetitle\par%
      \end{beamercolorbox}%
    \fi%
  \fi%
}
% ----------------------------------------------------------------------------
% *** END FRAMETITLE >>>
% ----------------------------------------------------------------------------



% ----------------------------------------------------------------------------
% *** FOOTLINE <<<
% ----------------------------------------------------------------------------

\newlength{\textlogobottommarginDark}
\setlength{\textlogobottommarginDark}{0.41452307692307688cm}% 
\newcommand\uTextColorPosDark {\pgfpoint{\margin}{\textlogobottommarginDark}}

\newlength{\textlogobottommarginLight}
\setlength{\textlogobottommarginLight}{0.45292307692307715cm}% 
\newcommand\uTextColorPosLight{\pgfpoint{\margin}{\textlogobottommarginLight}}

\newlength{\logorightmargin}%
\setlength{\logorightmargin}{12.1344cm}%
\newlength{\logobottommargin}%
\setlength{\logobottommargin}{0.512cm}%
\newcommand\posUlogoFoot{\pgfpoint{\logorightmargin}{\logobottommargin}}

\newcommand{\uWavePos}{\pgfpoint{\paperwidth}{0cm}}

% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\defbeamertemplate*{footline}{univ theme dark}
{%
  \ifthenelse{ \boolean{beamer@dark} \OR \(\boolean{beamer@darktitle}\AND\c@framenumber=1\) }
  % *** THEN *** dark footline
  {%
    \pgftext[left,bottom,at=\uTextColorPosDark]{\pgfuseimage{uTextColor}}%
    \pgftext[right,bottom,at=\posUlogoFoot]{\pgfuseimage{ULogo}}%
  }
  % *** ELSE *** light footline
  {%
     % conditionally put the univ text logo on the page
    \ifthenelse{\c@framenumber=1 \OR \NOT \boolean{beamer@compress}}
    {\pgftext[left,bottom,at=\uTextColorPosLight]{\pgfuseimage{uTextColor}}}%

    {}%
    % removed bottom wave image to get more space
    % page number
    \ifbeamer@framenumber%
      \ifnum\c@framenumber=1\else
        \pgftext[right,bottom,at=\pgfpoint{0.98\paperwidth}{0.02\paperwidth}]{%
          \usebeamerfont{frame number in foot}%
          \usebeamercolor[fg]{frame number in foot}\insertframenumber{}%
          \ifbeamer@totalframenumber%
            \inserttotalframenumber%
          \fi
        }%
      \fi
    \fi%
    }
}%
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

% ----------------------------------------------------------------------------
% *** END of FOOTLINE >>>
% ---------------------------------------------------------------------------- 


% ----------------------------------------------------------------------------
% *** MARGINS <<<
% ----------------------------------------------------------------------------
% set left and right text margins
\setbeamersize{text margin left=\margin,%
               text margin right=\margin}
% ----------------------------------------------------------------------------
% *** END MARGINS >>>
% ----------------------------------------------------------------------------



% ----------------------------------------------------------------------------
% *** BACKGROUND <<<
% ----------------------------------------------------------------------------
\defbeamertemplate*{background canvas}{univ theme}
{%
  \ifthenelse{ \boolean{beamer@dark} \OR \(\boolean{beamer@darktitle}\AND\c@framenumber=1\) }
  % *** THEN ***
  {%
    \ifnum\c@framenumber=1%
      \pgfuseimage{uaBackgroundDark}
    \else%
      \pgfuseimage{uaBackgroundLight}%
    \fi%
  }
  % *** ELSE ***
  {}
}
% ----------------------------------------------------------------------------
% *** END BACKGROUND <<<
% ----------------------------------------------------------------------------

\mode
<all>

还需要任何 2 张标题为UGlogo和的虚拟图像。任何 2 张具有这些名称的图像就足够了。我使用了黑色矩形,例如下面的矩形(请分别重命名并保存为和)。mathstatUGlogo.jpegmathstat.jpeg

黑色矩形

presentation.tex包含所有部分的主文件的代码是:

\documentclass[xcolor=svgnames]{beamer}
\mode<presentation>

\setbeamertemplate{navigation symbols}{} 
\usefonttheme{serif}

\usetheme{UniversityCustom}

\useinnertheme{rectangles}
\setbeamertemplate{items}[circle]
\setbeamertemplate{blocks}[rounded=false, shadow=false]

\renewcommand{\contentsname}{Outline}
\AtBeginSection[]
{
\begin{frame}<beamer>{Outline}
        \normalsize{\tableofcontents[currentsection,currentsubsection]}
\end{frame}
}

\makeatletter
  \beamer@compressfalse
\makeatother


\title{Title}
\subtitle{Subtitle}
\author{My Name}
\institute{My University}
\date{Date}



\begin{document}

\begin{frame}[t]
    \maketitle
\end{frame}


\begin{frame}[t]
\frametitle{Outline}
\tableofcontents
\end{frame}

\section{Section 8}

\begin{frame}[t]
\frametitle{Section 8}
Text goes here
\end{frame}

\section{Section 9}

\begin{frame}[t]
\frametitle{Section 9}
Text goes here
\end{frame}

\section{Section 3}

\begin{frame}[t]
\frametitle{Section 3}
Text goes here
\end{frame}

\section{Section 4}

\begin{frame}[t]
\frametitle{Section 4}
Text goes here
\end{frame}

\section{Section 5}

\begin{frame}[t]
\frametitle{Section 5}
Text goes here
\end{frame}

\section{Section 6}

\begin{frame}[t]
\frametitle{Section 6}
Text goes here
\end{frame}

\section{Section 7}

\begin{frame}[t]
\frametitle{Section 7}
Text goes here
\end{frame}

\section{Section 8}

\begin{frame}[t]
\frametitle{Section 8}
Text goes here
\end{frame}

\section{Section 9}

\begin{frame}[t]
\frametitle{Section 9}
Text goes here
\end{frame}

\end{document}

\insertnavigation我相信它与其中的线条部分有关,beamerouterthemeUniversityCustom.sty但是我无法弄清楚解决我的问题所需的更改。

\begin{beamercolorbox}[wd=\paperwidth,ht=3.00ex,dp=5.5ex]{palette quaternary}%
    \insertnavigation{0.5\textwidth}
  \end{beamercolorbox}%

我尝试使用\parbox并指定宽度,但不幸的是这并不能解决问题。

是否可以使用此自定义模板使新部分出现在新行上?

感谢您看我的帖子。

相关内容