Beamer:如何将迷你镜框从圆形改为矩形

Beamer:如何将迷你镜框从圆形改为矩形

我想将迷你框架从圆形改为矩形,并使已经查看的符号与背景颜色相同,未来的符号与前景颜色相同。

\documentclass{beamer}
\usetheme{Frankfurt}
\usecolortheme{dove}
\setbeamercolor{section in head/foot}{fg=white, bg=black}

\makeatletter
\setbeamertemplate{footline}
{
  \leavevmode%
  \hbox{%
  \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
    \usebeamerfont{author in head/foot}\insertshortauthor~~\beamer@ifempty{\insertshortinstitute}{}{(\insertshortinstitute)}
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
    \usebeamerfont{title in head/foot}\insertshorttitle
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
    \usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
    \insertframenumber{} / \inserttotalframenumber\hspace*{2ex} 
  \end{beamercolorbox}}%
  \vskip0pt%
}
\makeatother

\begin{document}

    \section{Introduction}
        \subsection{Introduction}   
            \begin{frame}{Frame}        
            \end{frame}

        \subsection{Introduction}   
            \begin{frame}{Frame}
            \end{frame}
\end{document}

答案1

mini frame模板mini frame in current subsection有一个box选项,可以给你正方形而不是圆形(还有一个tick选项可以产生勾号):

\documentclass{beamer}
\usetheme{Frankfurt}
\usecolortheme{dove}
\setbeamercolor{section in head/foot}{fg=white, bg=black}

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

\begin{document}

\section{Introduction}

\subsection{Test Subsection One}   
\begin{frame}{Frame}        
test \thepage
\end{frame}

\subsection{Test Subsection Two}   
\begin{frame}{Frame}        
test \thepage
\end{frame}

\subsection{Test Subsection Three}   
\begin{frame}{Frame}        
test \thepage
\end{frame}

\subsection{Test Subsection Four}   
\begin{frame}{Frame}        
test \thepage
\end{frame}

\subsection{Test Subsection Five}   
\begin{frame}{Frame}        
test \thepage
\end{frame}

\end{document}

在此处输入图片描述

由于问题要求的是矩形,不一定是正方形,因此beamerbaseauxtemplates.sty可以重新定义模板(如中所定义);这些模板用于\pgfpathrectangle构建具有相同高度和宽度的矩形:

\pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\the\beamer@boxsize}{\the\beamer@boxsize}}

在下面的代码中我将其更改为

\pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\the\dimexpr0.5\beamer@boxsize\relax}{\the\beamer@boxsize}}

使宽度等于高度的一半。

为了实现颜色方案的更改,还需要重新定义\slideentry(中的原始定义beamerbasenavigation.sty)。我故意将已经访问过的子部分保留为绘制状态,而不是完全涂黑,因为可能需要返回上一张幻灯片:

\documentclass{beamer}
\usetheme{Frankfurt}
\usecolortheme{dove}
\setbeamercolor{section in head/foot}{fg=white, bg=black}

\makeatletter
\setbeamertemplate{mini frame}
{%
  \begin{pgfpicture}{0pt}{0pt}{.1cm}{.1cm}
    \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\the\dimexpr0.5\beamer@boxsize\relax}{\the\beamer@boxsize}}
    \pgfusepath{fill,stroke}
  \end{pgfpicture}%
}
\setbeamertemplate{mini frame in current subsection}
{%
  \begin{pgfpicture}{0pt}{0pt}{.1cm}{.1cm}
    \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\the\dimexpr0.5\beamer@boxsize\relax}{\the\beamer@boxsize}}
    \pgfsetfillcolor{section in head/foot.bg}
    \pgfusepath{fill,stroke}
  \end{pgfpicture}%
}

\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%
                \usebeamertemplate{mini frame}%\beamer@minislidehilight%
              \else%
                \usebeamertemplate{mini frame in current subsection}%\beamer@minisliderowhilight%
              \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
  }


\setbeamertemplate{footline}
{
  \leavevmode%
  \hbox{%
  \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
    \usebeamerfont{author in head/foot}\insertshortauthor~~\beamer@ifempty{\insertshortinstitute}{}{(\insertshortinstitute)}
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
    \usebeamerfont{title in head/foot}\insertshorttitle
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
    \usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
    \insertframenumber{} / \inserttotalframenumber\hspace*{2ex} 
  \end{beamercolorbox}}%
  \vskip0pt%
}
\makeatother

\begin{document}

\section{Introduction}

\subsection{Test Subsection One}   
\begin{frame}{Frame}        
test \thepage
\end{frame}

\subsection{Test Subsection Two}   
\begin{frame}{Frame}        
test \thepage
\end{frame}

\subsection{Test Subsection Three}   
\begin{frame}{Frame}        
test \thepage
\end{frame}

\subsection{Test Subsection Four}   
\begin{frame}{Frame}        
test \thepage
\end{frame}

\subsection{Test Subsection Five}   
\begin{frame}{Frame}        
test \thepage
\end{frame}

\end{document}

在此处输入图片描述

相关内容