Beamer 導覽列太長

Beamer 導覽列太長

我的 Beamer 中的導覽列按照目前的格式來說太長了。我曾考慮過採用多行進行圓形導航,但這會導致導航列的垂直空間佔用太多空間。我似乎記得在某個時刻看到一個演示文稿,其中圓圈折疊成一個圓圈,除非實際上在當前小節內,它們在該點上擴展回每個幀都有點。

我希望得到有關如何保持單行導覽列像我一樣的建議,以及如何壓縮導覽列以使其適合我的寬度的方法。

在此輸入影像描述

我似乎還記得看到一個演示文稿,其中演示文稿的每個子部分的圓形導航標記之間都有線條,但尚未找到有關如何做到這一點的資訊。如果您能指出它可能位於哪裡,那就太好了。

提前致謝。

答案1

投影機模板迷你框架有 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}

相關內容