进度条位置问题

进度条位置问题

在网上混合了一些代码后,我基于 metropolis 幻灯片制作了所需的演示文稿。第一个问题是我想将进度条放在标题下。(使用 footline place 有点丑陋,使用 headline 关键字会将进度条放在幻灯片顶部)。另外我需要做的是停止计算插入在页面底部的页码和进度条计数器中的帧数。在此先感谢那些可以提供帮助的人!

Presentation.tex 文件

\documentclass[10pt]{beamer}
\usepackage{booktabs}
\definecolor{DarkTeal}{HTML}{23373b}
\usetheme[progressbar=frametitle]{metropolis}
\useoutertheme{sidebar}
\setbeamercolor{sidebar}{parent=palette primary}
\makeatletter
\setbeamertemplate{sidebar canvas \beamer@sidebarside}%
[vertical shading][top=green,bottom=blue]
\makeatother
\setbeamercolor{palette sidebar secondary}{fg=yellow,bg=blue}
\setbeamercolor{section in sidebar shaded}{fg=red,bg=black}
\AtBeginSection{
    \begingroup
    \setbeamercolor{background canvas}{bg=DarkTeal}
    \setbeamercolor{normal text}{fg=white}
    \begin{frame}[plain,noframenumbering]
    \sectionpage
    \end{frame}
    \endgroup
}
\setbeamertemplate{footline}[frame number]
\title{Report}
\subtitle{Last Part}
\date{\today}
\author{V A}
\institute{Lab}
 %\titlegraphic{\hfill\includegraphics[height=1.5cm]{logo1.png}}
%\logo{\includegraphics[width = 0.1\textwidth]{logo2.png}}
\definecolor{lightgr}{rgb}{1 0.7 0.7}
\makeatletter
\addtobeamertemplate{footline}{%
    \color{lightgr}% to color the progressbar
    \hspace*{-\beamer@leftmargin}%
    \rule{\beamer@leftmargin}{2pt}%
    \rlap{\rule{\dimexpr
            \beamer@startpageofframe\dimexpr
            \beamer@rightmargin+\textwidth\relax/\beamer@endpageofdocument}{1pt}}
    \vspace{0\baselineskip}
    {}
}
\makeatother
\begin{document}
\maketitle
\begin{frame}{Table of contents}
  \setbeamertemplate{section in toc}[sections numbered]
  \tableofcontents[hideallsubsections]
\end{frame}
\section{S1}
\begin{frame}{F1}
\end{frame}
\begin{frame}{F2}
\end{frame}
\begin{frame}{F3}
\end{frame}
\appendix
\end{document}

beamerinnerthememetropolis.sty

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{beamerinnerthememetropolis}[2017/01/23 Metropolis inner theme]
\RequirePackage{etoolbox}
\RequirePackage{keyval}
\RequirePackage{calc}
\RequirePackage{pgfopts}
\RequirePackage{tikz}
\setbeamertemplate{title page}{
  \begin{minipage}[b][\paperheight]{\textwidth}
    \ifx\inserttitlegraphic\@empty\else\usebeamertemplate*{title graphic}\fi
    \vfill%
    \ifx\inserttitle\@empty\else\usebeamertemplate*{title}\fi
    \ifx\insertsubtitle\@empty\else\usebeamertemplate*{subtitle}\fi
    \usebeamertemplate*{title separator}
    \ifx\beamer@shortauthor\@empty\else\usebeamertemplate*{author}\fi
    \ifx\insertdate\@empty\else\usebeamertemplate*{date}\fi
    \ifx\insertinstitute\@empty\else\usebeamertemplate*{institute}\fi
    \vfill
    \vspace*{1mm}
  \end{minipage}
}
\def\maketitle{%
  \ifbeamer@inframe
    \titlepage
  \else
    \frame[plain,noframenumbering]{\titlepage}
  \fi
}
\def\titlepage{%
  \usebeamertemplate{title page}
}
\setbeamertemplate{title graphic}{
  \vbox to 0pt {
    \vspace*{2em}
    \inserttitlegraphic%
  }%
  \nointerlineskip%
}
\setbeamertemplate{title}{
  \raggedright%
  \linespread{1.0}%
  \inserttitle%
  \par%
  \vspace*{0.5em}
}
\setbeamertemplate{subtitle}{
  \raggedright%
  \insertsubtitle%
  \par%
  \vspace*{0.5em}
}
\newlength{\metropolis@titleseparator@linewidth}
\setlength{\metropolis@titleseparator@linewidth}{0.4pt}
\setbeamertemplate{title separator}{
  \begin{tikzpicture}
    \fill[fg] (0,0) rectangle (\textwidth, \metropolis@titleseparator@linewidth);
  \end{tikzpicture}%
  \par%
}
\setbeamertemplate{author}{
  \vspace*{2em}
  \insertauthor%
  \par%
  \vspace*{0.25em}
}
\setbeamertemplate{date}{
  \insertdate%
  \par%
}
\setbeamertemplate{institute}{
  \vspace*{3mm}
  \insertinstitute%
  \par%
}

\setbeamertemplate{subsection page}{%
  \usebeamertemplate*{section page}
}
\newcommand{\metropolis@disablesubsectionpage}{
  \AtBeginSubsection{
    % intentionally empty
  }
}
\newcommand{\metropolis@enablesubsectionpage}{
  \AtBeginSubsection{
    \ifbeamer@inframe
      \subsectionpage
    \else
      \frame[plain,c,noframenumbering]{\subsectionpage}
    \fi
  }
}
\newlength{\metropolis@progressonsectionpage}
\newlength{\metropolis@progressonsectionpage@linewidth}
\setlength{\metropolis@progressonsectionpage@linewidth}{0.4pt}
\setbeamertemplate{progress bar in section page}{
  \setlength{\metropolis@progressonsectionpage}{%
    \textwidth * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}%
  }%
  \begin{tikzpicture}
    \fill[bg] (0,0) rectangle (\textwidth, \metropolis@progressonsectionpage@linewidth);
    \fill[fg] (0,0) rectangle (\metropolis@progressonsectionpage, \metropolis@progressonsectionpage@linewidth);
  \end{tikzpicture}%
}
\def\inserttotalframenumber{100}
\newlength{\metropolis@blocksep}
\newlength{\metropolis@blockadjust}
\setlength{\metropolis@blocksep}{0.75ex}
\setlength{\metropolis@blockadjust}{0.25ex}
\providecommand{\metropolis@strut}{%
  \vphantom{ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz()}%
}
\newcommand{\metropolis@block}[1]{
  \par\vskip\medskipamount%
  \setlength{\parskip}{0pt}
  \ifbeamercolorempty[bg]{block title#1}{%
    \begin{beamercolorbox}[rightskip=0pt plus 4em]{block title#1}}{%
  \ifbeamercolorempty[bg]{block title}{%
    \begin{beamercolorbox}[rightskip=0pt plus 4em]{block title#1}%
  }%
  {%
    \begin{beamercolorbox}[
      sep=\dimexpr\metropolis@blocksep-\metropolis@blockadjust\relax,
      leftskip=\metropolis@blockadjust,
      rightskip=\dimexpr\metropolis@blockadjust plus 4em\relax
    ]{block title#1}%
  }}%
      \usebeamerfont*{block title#1}%
      \metropolis@strut%
      \insertblocktitle%
      \metropolis@strut%
  \end{beamercolorbox}%
  \nointerlineskip%
  \ifbeamercolorempty[bg]{block body#1}{%
    \begin{beamercolorbox}[vmode]{block body#1}}{
  \ifbeamercolorempty[bg]{block body}{%
    \begin{beamercolorbox}[vmode]{block body#1}%
  }{%
    \begin{beamercolorbox}[sep=\metropolis@blocksep, vmode]{block body#1}%
    \vspace{-\metropolis@parskip}
  }}%
      \usebeamerfont{block body#1}%
      \setlength{\parskip}{\metropolis@parskip}%
}
\setbeamertemplate{block begin}{\metropolis@block{}}
\setbeamertemplate{block alerted begin}{\metropolis@block{ alerted}}
\setbeamertemplate{block example begin}{\metropolis@block{ example}}
\setbeamertemplate{block end}{\end{beamercolorbox}\vspace*{0.2ex}}
\setbeamertemplate{block alerted end}{\end{beamercolorbox}\vspace*{0.2ex}}
\setbeamertemplate{block example end}{\end{beamercolorbox}\vspace*{0.2ex}}
\setbeamertemplate{itemize items}{\textbullet}
\setbeamertemplate{caption label separator}{: }
\setbeamertemplate{caption}[numbered]
\setbeamertemplate{footnote}{%
  \parindent 0em\noindent%
  \raggedright
  \usebeamercolor{footnote}\hbox to 0.8em{\hfil\insertfootnotemark}\insertfootnotetext\par%
}
\newlength{\metropolis@parskip}
\setlength{\metropolis@parskip}{0.5em}
\setlength{\parskip}{\metropolis@parskip}
\linespread{1.15}
\define@key{beamerframe}{c}[true]{% centered
  \beamer@frametopskip=0pt plus 1fill\relax%
  \beamer@framebottomskip=0pt plus 1fill\relax%
  \beamer@frametopskipautobreak=0pt plus .4\paperheight\relax%
  \beamer@framebottomskipautobreak=0pt plus .6\paperheight\relax%
  \def\beamer@initfirstlineunskip{}%
}
\providebool{metropolis@standout}
\define@key{beamerframe}{standout}[true]{%
  \booltrue{metropolis@standout}
  \begingroup
    \setkeys{beamerframe}{c}
    \setkeys{beamerframe}{noframenumbering}
    \ifbeamercolorempty[bg]{palette primary}{
      \setbeamercolor{background}{
        use=palette primary,
        bg=-palette primary.fg
      }
    }{
      \setbeamercolor{background}{
        use=palette primary,
        bg=palette primary.bg
      }
    }
  \centering
  \usebeamercolor[fg]{palette primary}
  \usebeamerfont{standout}
}
  \apptocmd{\beamer@reseteecodes}{%
    \ifbool{metropolis@standout}{
      \endgroup
      \boolfalse{metropolis@standout}
    }{}
  }{}{}
\metropolis@inner@setdefaults
\ProcessPgfPackageOptions{/metropolis/inner}
\endinput

答案1

大都会主题有将进度条放置在框架标题下方的选项。要从脚注中删除框架编号,您可以使用\setbeamertemplate{frame numbering}[none]

\documentclass{beamer}

\usetheme[progressbar=frametitle]{moloch}% modern fork of the metropolis theme
\setbeamertemplate{frame numbering}[none]
\begin{document}

    \begin{frame}{test}  
            1
    \end{frame}
    
    \begin{frame}{bla}  
            2
    \end{frame}    
\end{document}

相关内容