Beamer 导航栏太长

Beamer 导航栏太长

Beamer 中的导航栏太长了,目前的格式是这样的。我曾考虑过将圆形导航改为多行,但这会导致导航栏的垂直空间占用太多空间。我似乎记得在某个时候看到过一个演示文稿,其中的圆圈会折叠成一个圆圈,除非实际上在当前子部分内,否则它们会重新展开,在那时每个框架都有圆点。

我希望得到一些建议,比如如何保留我所拥有的单行导航栏,以及如何压缩导航栏以使其适合我的宽度。

在此处输入图片描述

我似乎还记得看到过一个演示文稿,其中演示文稿的每个子部分的圆形导航标记之间都有线条,但尚未找到有关如何做到这一点的信息。如果您能告诉我它可能位于何处,那就太好了。

提前致谢。

答案1

beamer 模板迷你框架有 3 个预定义模板:

  • [default]显示小圆圈作为迷你框架
  • [box]显示小矩形作为迷你框架
  • [tick]将小垂直条显示为迷你框架

因此,您可以例如切换到tick模板,因为它不占用太多空间:

\setbeamertemplate{mini frame}[tick]
\setbeamertemplate{mini frame in current subsection}{tick}

但看起来你想保留圆圈。那么为什么不把它们缩小呢?要做到这一点,你必须重新定义模板mini frame。所以我只是复制了模板default,将其重命名scaled circle并引入了一个缩放因子。

\defbeamertemplate{mini frame}{scaled circle}[1]
{%
  \begin{pgfpicture}{0pt}{0pt}{#1 * 0.1cm}{#1 * 0.1cm}
    \pgfsetlinewidth{#1 * 0.4pt}
    \pgfpathcircle{\pgfpoint{#1 * 0.05cm}{#1 * 0.05cm}}{#1 * 0.05cm}
    \pgfusepath{fill,stroke}
  \end{pgfpicture}%
}
[action]
{
  \newlength{\myminiframesize}
  \setlength{\myminiframesize}{0.14cm}
  \newlength{\myminiframeoffset}
  \setlength{\myminiframeoffset}{0.03cm}
  \setbeamersize{mini frame size=#1\myminiframesize,mini frame offset=#1\myminiframeoffset}
}

\defbeamertemplate{mini frame in current section}{scaled circle}[1]
{%
  \begin{pgfpicture}{0pt}{0pt}{#1 * 0.1cm}{#1 * 0.1cm}
    \pgfsetlinewidth{#1 * 0.4pt}
    \pgfpathcircle{\pgfpoint{#1 * 0.05cm}{#1 * 0.05cm}}{#1 * 0.05cm}
    \pgfusepath{stroke}
  \end{pgfpicture}%
}

\defbeamertemplate{mini frame in current subsection}{scaled circle}[1]
{%
  \begin{pgfpicture}{0pt}{0pt}{#1 * 0.1cm}{#1 * 0.1cm}
    \pgfsetlinewidth{#1 * 0.4pt}
    \pgfpathcircle{\pgfpoint{#1 * 0.05cm}{#1 * 0.05cm}}{#1 * 0.05cm}
    \pgfusepath{stroke}
  \end{pgfpicture}%
}

然后你就可以加载它

\setbeamertemplate{mini frame}[scaled circle]{0.7}
\setbeamertemplate{mini frame in current section}[scaled circle]{0.7}
\setbeamertemplate{mini frame in current subsection}[scaled circle]{0.7}

其中0.7是比例因子。

完成 MWE:

\documentclass[compress]{beamer}
\usepackage{calc}
\useoutertheme{miniframes}

\defbeamertemplate{mini frame}{scaled circle}[1]
{%
  \begin{pgfpicture}{0pt}{0pt}{#1 * 0.1cm}{#1 * 0.1cm}
    \pgfsetlinewidth{#1 * 0.4pt}
    \pgfpathcircle{\pgfpoint{#1 * 0.05cm}{#1 * 0.05cm}}{#1 * 0.05cm}
    \pgfusepath{fill,stroke}
  \end{pgfpicture}%
}
[action]
{
  \newlength{\myminiframesize}
  \setlength{\myminiframesize}{0.14cm}
  \newlength{\myminiframeoffset}
  \setlength{\myminiframeoffset}{0.03cm}
  \setbeamersize{mini frame size=#1\myminiframesize,mini frame offset=#1\myminiframeoffset}
}

\defbeamertemplate{mini frame in current section}{scaled circle}[1]
{%
  \begin{pgfpicture}{0pt}{0pt}{#1 * 0.1cm}{#1 * 0.1cm}
    \pgfsetlinewidth{#1 * 0.4pt}
    \pgfpathcircle{\pgfpoint{#1 * 0.05cm}{#1 * 0.05cm}}{#1 * 0.05cm}
    \pgfusepath{stroke}
  \end{pgfpicture}%
}

\defbeamertemplate{mini frame in current subsection}{scaled circle}[1]
{%
  \begin{pgfpicture}{0pt}{0pt}{#1 * 0.1cm}{#1 * 0.1cm}
    \pgfsetlinewidth{#1 * 0.4pt}
    \pgfpathcircle{\pgfpoint{#1 * 0.05cm}{#1 * 0.05cm}}{#1 * 0.05cm}
    \pgfusepath{stroke}
  \end{pgfpicture}%
}

\setbeamertemplate{mini frame}[scaled circle]{0.7}
\setbeamertemplate{mini frame in current section}[scaled circle]{0.7}
\setbeamertemplate{mini frame in current subsection}[scaled circle]{0.7}

\begin{document}

\section{Section 1}
\subsection{Subsection 1}
\frame{Frame 1}
\frame{Frame 2}
\frame{Frame 3}
\frame{Frame 4}
\frame{Frame 5}
\frame{Frame 6}
\frame{Frame 7}
\frame{Frame 8}
\frame{Frame 9}
\frame{Frame 10}
\subsection{Subsection 2}
\frame{Frame 1}
\frame{Frame 2}
\frame{Frame 3}
\frame{Frame 4}
\frame{Frame 5}
\frame{Frame 6}
\frame{Frame 7}
\frame{Frame 8}
\frame{Frame 9}
\frame{Frame 10}

\end{document}

比例因子 = 0.7

缩放0.7

缩放因子 = 1

缩放1

缩放因子 = 2

缩放2

编辑 – 连接圆圈

\makeatletter
\def\slideentry#1#2#3#4#5#6{%
  %section number, subsection number, slide number, first/last frame, page number, part number
  \ifnum#6=\c@part\ifnum#2>0\ifnum#3>0%
    \ifbeamer@compress%
      \advance\beamer@xpos by1\relax%
    \else%
      \beamer@xpos=#3\relax%
      \beamer@ypos=#2\relax%
    \fi%
  \hbox to 0pt{%
    \beamer@tempdim=-\beamer@vboxoffset%
    \advance\beamer@tempdim by-\beamer@boxsize%
    \multiply\beamer@tempdim by\beamer@ypos%
    \advance\beamer@tempdim by -.05cm%
    \raise\beamer@tempdim\hbox{%
      \beamer@tempdim=\beamer@boxsize%
      \multiply\beamer@tempdim by\beamer@xpos%
      \advance\beamer@tempdim by -\beamer@boxsize%
      \advance\beamer@tempdim by 1pt%
      \kern\beamer@tempdim
      \global\beamer@section@min@dim\beamer@tempdim
      \hbox{\beamer@link(#4){%
          \usebeamerfont{mini frame}%
          \ifnum\c@section=#1%
            \ifnum\c@subsection=#2%
              \usebeamercolor[fg]{mini frame}%
              \ifnum\c@subsectionslide=#3%
                \ifnum#3=1%
                  \usebeamertemplate{mini frame first}%\beamer@minislidehilight%
                \else%
                  \usebeamertemplate{mini frame}%\beamer@minislidehilight%
                \fi
              \else%
                \ifnum#3=1%
                  \usebeamertemplate{mini frame in current subsection first}%
                \else%
                  \usebeamertemplate{mini frame in current subsection}%\beamer@minisliderowhilight%
                \fi
              \fi%
            \else%
              \usebeamercolor{mini frame}%
              %\color{fg!50!bg}%
              \usebeamertemplate{mini frame in other subsection}%\beamer@minislide%
            \fi%
          \else%
            \usebeamercolor{mini frame}%
            %\color{fg!50!bg}%
            \usebeamertemplate{mini frame in other subsection}%\beamer@minislide%
          \fi%
        }}}\hskip-10cm plus 1fil%
  }\fi\fi%
  \else%
  \fakeslideentry{#1}{#2}{#3}{#4}{#5}{#6}%
  \fi\ignorespaces
  }
\makeatother

\defbeamertemplate{mini frame}{scaled circle}[1]
{%
  \begin{pgfpicture}{0pt}{0pt}{#1 * 0.1cm}{#1 * 0.1cm}
    \pgfsetlinewidth{#1 * 0.4pt}
    \pgfpathmoveto{\pgfpoint{0cm}{#1 * 0.05cm}} 
    \pgfpathlineto{\pgfpoint{#1 * -0.04cm}{#1 * 0.05cm}} 
    \pgfpathcircle{\pgfpoint{#1 * 0.05cm}{#1 * 0.05cm}}{#1 * 0.05cm}
    \pgfusepath{fill,stroke}
  \end{pgfpicture}%
}
[action]
{
  \newlength{\myminiframesize}
  \setlength{\myminiframesize}{0.14cm}
  \newlength{\myminiframeoffset}
  \setlength{\myminiframeoffset}{0.03cm}
  \setbeamersize{mini frame size=#1\myminiframesize,mini frame offset=#1\myminiframeoffset}
}

\defbeamertemplate{mini frame first}{scaled circle}[1]
{%
  \begin{pgfpicture}{0pt}{0pt}{#1 * 0.1cm}{#1 * 0.1cm}
    \pgfsetlinewidth{#1 * 0.4pt}
    \pgfpathcircle{\pgfpoint{#1 * 0.05cm}{#1 * 0.05cm}}{#1 * 0.05cm}
    \pgfusepath{fill,stroke}
  \end{pgfpicture}%
}


\defbeamertemplate{mini frame in current section}{scaled circle}[1]
{%
  \begin{pgfpicture}{0pt}{0pt}{#1 * 0.1cm}{#1 * 0.1cm}
    \pgfsetlinewidth{#1 * 0.4pt}
    \pgfpathmoveto{\pgfpoint{0cm}{#1 * 0.05cm}} 
    \pgfpathlineto{\pgfpoint{#1 * -0.04cm}{#1 * 0.05cm}} 
    \pgfpathcircle{\pgfpoint{#1 * 0.05cm}{#1 * 0.05cm}}{#1 * 0.05cm}
    \pgfusepath{stroke}
  \end{pgfpicture}%
}

\defbeamertemplate{mini frame in other section}{scaled circle}[1]
{%
  \color{fg!50!bg}
  \begin{pgfpicture}{0pt}{0pt}{#1 * 0.1cm}{#1 * 0.1cm}
    \pgfsetlinewidth{#1 * 0.4pt}
    \pgfpathcircle{\pgfpoint{#1 * 0.05cm}{#1 * 0.05cm}}{#1 * 0.05cm}
    \pgfusepath{stroke}
  \end{pgfpicture}%
}

\defbeamertemplate{mini frame in current subsection}{scaled circle}[1]
{%
  \begin{pgfpicture}{0pt}{0pt}{#1 * 0.1cm}{#1 * 0.1cm}
    \pgfsetlinewidth{#1 * 0.4pt}
    \pgfpathmoveto{\pgfpoint{0cm}{#1 * 0.05cm}} 
    \pgfpathlineto{\pgfpoint{#1 * -0.04cm}{#1 * 0.05cm}} 
    \pgfpathcircle{\pgfpoint{#1 * 0.05cm}{#1 * 0.05cm}}{#1 * 0.05cm}
    \pgfusepath{stroke}
  \end{pgfpicture}%
}

\defbeamertemplate{mini frame in current subsection first}{scaled circle}[1]
{%
  \begin{pgfpicture}{0pt}{0pt}{#1 * 0.1cm}{#1 * 0.1cm}
    \pgfsetlinewidth{#1 * 0.4pt}
    \pgfpathcircle{\pgfpoint{#1 * 0.05cm}{#1 * 0.05cm}}{#1 * 0.05cm}
    \pgfusepath{stroke}
  \end{pgfpicture}%
}

\defbeamertemplate{mini frame in other subsection}{scaled circle}[1]
{%
  \color{fg!50!bg}
  \begin{pgfpicture}{0pt}{0pt}{#1 * 0.1cm}{#1 * 0.1cm}
    \pgfsetlinewidth{#1 * 0.4pt}
    \pgfpathcircle{\pgfpoint{#1 * 0.05cm}{#1 * 0.05cm}}{#1 * 0.05cm}
    \pgfusepath{stroke}
  \end{pgfpicture}%
}

\setbeamertemplate{mini frame}[scaled circle]{0.7}
\setbeamertemplate{mini frame first}[scaled circle]{0.7}
\setbeamertemplate{mini frame in current section}[scaled circle]{0.7}
\setbeamertemplate{mini frame in current subsection}[scaled circle]{0.7}
\setbeamertemplate{mini frame in current subsection first}[scaled circle]{0.7}
\setbeamertemplate{mini frame in other section}[scaled circle]{0.7}
\setbeamertemplate{mini frame in other subsection}[scaled circle]{0.7}

输出:

连接的

编辑 2 – 折叠其他子部分

\makeatletter
\def\slideentry#1#2#3#4#5#6{%
  %section number, subsection number, slide number, first/last frame, page number, part number
  \ifnum#6=\c@part\ifnum#2>0\ifnum#3>0%
    \ifbeamer@compress%
      \ifnum\c@section=#1
        \ifnum\c@subsection=#2
          \advance\beamer@xpos by1\relax%
        \else%
          \ifnum#3=1%
            \advance\beamer@xpos by1\relax%
          \fi
        \fi
      \else%
        \ifnum#3=1%
          \advance\beamer@xpos by1\relax%
        \fi
      \fi
    \else%
      \beamer@xpos=#3\relax%
      \beamer@ypos=#2\relax%
    \fi%
  \hbox to 0pt{%
    \beamer@tempdim=-\beamer@vboxoffset%
    \advance\beamer@tempdim by-\beamer@boxsize%
    \multiply\beamer@tempdim by\beamer@ypos%
    \advance\beamer@tempdim by -.05cm%
    \raise\beamer@tempdim\hbox{%
      \beamer@tempdim=\beamer@boxsize%
      \multiply\beamer@tempdim by\beamer@xpos%
      \advance\beamer@tempdim by -\beamer@boxsize%
      \advance\beamer@tempdim by 1pt%
      \kern\beamer@tempdim
      \global\beamer@section@min@dim\beamer@tempdim
      \hbox{\beamer@link(#4){%
          \usebeamerfont{mini frame}%
          \ifnum\c@section=#1%
            \ifnum\c@subsection=#2%
              \usebeamercolor[fg]{mini frame}%
              \ifnum\c@subsectionslide=#3%
                \ifnum#3=1%
                  \usebeamertemplate{mini frame first}%\beamer@minislidehilight%
                \else%
                  \usebeamertemplate{mini frame}%\beamer@minislidehilight%
                \fi
              \else%
                \ifnum#3=1%
                  \usebeamertemplate{mini frame in current subsection first}%
                \else%
                  \usebeamertemplate{mini frame in current subsection}%\beamer@minisliderowhilight%
                \fi
              \fi%
            \else%
              \ifnum#3=1%
                \usebeamercolor{mini frame}%
                %\color{fg!50!bg}%
                \usebeamertemplate{mini frame in other subsection}%\beamer@minislide%
              \fi
            \fi%
          \else%
            \ifnum#3=1%
              \usebeamercolor{mini frame}%
              %\color{fg!50!bg}%
              \usebeamertemplate{mini frame in other subsection}%\beamer@minislide%
            \fi
          \fi%
        }}}\hskip-10cm plus 1fil%
  }\fi\fi%
  \else%
  \fakeslideentry{#1}{#2}{#3}{#4}{#5}{#6}%
  \fi\ignorespaces
  }
\makeatother

\defbeamertemplate{mini frame}{scaled circle}[1]
{%
  \begin{pgfpicture}{0pt}{0pt}{#1 * 0.1cm}{#1 * 0.1cm}
    \pgfsetlinewidth{#1 * 0.4pt}
    \pgfpathmoveto{\pgfpoint{0cm}{#1 * 0.05cm}} 
    \pgfpathlineto{\pgfpoint{#1 * -0.04cm}{#1 * 0.05cm}} 
    \pgfpathcircle{\pgfpoint{#1 * 0.05cm}{#1 * 0.05cm}}{#1 * 0.05cm}
    \pgfusepath{fill,stroke}
  \end{pgfpicture}%
}
[action]
{
  \newlength{\myminiframesize}
  \setlength{\myminiframesize}{0.14cm}
  \newlength{\myminiframeoffset}
  \setlength{\myminiframeoffset}{0.03cm}
  \setbeamersize{mini frame size=#1\myminiframesize,mini frame offset=#1\myminiframeoffset}
}

\defbeamertemplate{mini frame first}{scaled circle}[1]
{%
  \begin{pgfpicture}{0pt}{0pt}{#1 * 0.1cm}{#1 * 0.1cm}
    \pgfsetlinewidth{#1 * 0.4pt}
    \pgfpathcircle{\pgfpoint{#1 * 0.05cm}{#1 * 0.05cm}}{#1 * 0.05cm}
    \pgfusepath{fill,stroke}
  \end{pgfpicture}%
}


\defbeamertemplate{mini frame in current section}{scaled circle}[1]
{%
  \begin{pgfpicture}{0pt}{0pt}{#1 * 0.1cm}{#1 * 0.1cm}
    \pgfsetlinewidth{#1 * 0.4pt}
    \pgfpathmoveto{\pgfpoint{0cm}{#1 * 0.05cm}} 
    \pgfpathlineto{\pgfpoint{#1 * -0.04cm}{#1 * 0.05cm}} 
    \pgfpathcircle{\pgfpoint{#1 * 0.05cm}{#1 * 0.05cm}}{#1 * 0.05cm}
    \pgfusepath{stroke}
  \end{pgfpicture}%
}

\defbeamertemplate{mini frame in other section}{scaled circle}[1]
{%
  \color{fg!50!bg}
  \begin{pgfpicture}{0pt}{0pt}{#1 * 0.1cm}{#1 * 0.1cm}
    \pgfsetlinewidth{#1 * 0.4pt}
    \pgfpathcircle{\pgfpoint{#1 * 0.05cm}{#1 * 0.05cm}}{#1 * 0.05cm}
    \pgfusepath{stroke}
  \end{pgfpicture}%
}

\defbeamertemplate{mini frame in current subsection}{scaled circle}[1]
{%
  \begin{pgfpicture}{0pt}{0pt}{#1 * 0.1cm}{#1 * 0.1cm}
    \pgfsetlinewidth{#1 * 0.4pt}
    \pgfpathmoveto{\pgfpoint{0cm}{#1 * 0.05cm}} 
    \pgfpathlineto{\pgfpoint{#1 * -0.04cm}{#1 * 0.05cm}} 
    \pgfpathcircle{\pgfpoint{#1 * 0.05cm}{#1 * 0.05cm}}{#1 * 0.05cm}
    \pgfusepath{stroke}
  \end{pgfpicture}%
}

\defbeamertemplate{mini frame in current subsection first}{scaled circle}[1]
{%
  \begin{pgfpicture}{0pt}{0pt}{#1 * 0.1cm}{#1 * 0.1cm}
    \pgfsetlinewidth{#1 * 0.4pt}
    \pgfpathcircle{\pgfpoint{#1 * 0.05cm}{#1 * 0.05cm}}{#1 * 0.05cm}
    \pgfusepath{stroke}
  \end{pgfpicture}%
}

\defbeamertemplate{mini frame in other subsection}{scaled circle}[1]
{%
  \color{fg!50!bg}
  \begin{pgfpicture}{0pt}{0pt}{#1 * 0.1cm}{#1 * 0.1cm}
    \pgfsetlinewidth{#1 * 0.4pt}
    \pgfpathcircle{\pgfpoint{#1 * 0.05cm}{#1 * 0.05cm}}{#1 * 0.05cm}
    \pgfusepath{stroke}
  \end{pgfpicture}%
}

\setbeamertemplate{mini frame}[scaled circle]{0.7}
\setbeamertemplate{mini frame first}[scaled circle]{0.7}
\setbeamertemplate{mini frame in current section}[scaled circle]{0.7}
\setbeamertemplate{mini frame in current subsection}[scaled circle]{0.7}
\setbeamertemplate{mini frame in current subsection first}[scaled circle]{0.7}
\setbeamertemplate{mini frame in other section}[scaled circle]{0.7}
\setbeamertemplate{mini frame in other subsection}[scaled circle]{0.7}

相关内容