大家好,新年快乐!
第一次在这里发帖,我刚刚有个小问题,一直没法解决。我发布了一个使用 Metropolis 主题的基本 LaTeX 投影机代码的 MWE。*我想(全局地)让进度条周围有一个边框,并指定边框的颜色和厚度(假设是 0.25pt 厚的蓝色边框)。如何实现?
如果有什么我可以澄清的,请告诉我。非常感谢任何愿意考虑我的问题的人。
祝大家 2024 年快乐、健康!
*具体来说,Overleaf 模板,替换了框架,并对 MWE 代码的第一行和序言的“我的模组”部分进行了细微修改。
最小工作示例(MWE)
\documentclass[12pt,aspectratio=169,xcolor={svgnames, dvipsnames}]{beamer}
\usetheme[progressbar=frametitle]{metropolis}
\usepackage{appendixnumberbeamer}
\usepackage{booktabs}
\usepackage[scale=2]{ccicons}
\usepackage{pgfplots}
\usepgfplotslibrary{dateplot}
\usepackage{xspace}
\newcommand{\themename}{\textbf{\textsc{metropolis}}\xspace}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% My Mods
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\setlength{\metropolis@titleseparator@linewidth}{2pt}
\setlength{\metropolis@progressonsectionpage@linewidth}{2pt}
\setlength{\metropolis@progressinheadfoot@linewidth}{2pt}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\title{Metropolis -- Modified}
\subtitle{A modern beamer theme}
% \date{\today}
\date{}
\author{Matthias Vogelgesang}
\institute{Center for modern beamer themes}
% \titlegraphic{\hfill\includegraphics[height=1.5cm]{logo.pdf}}
\begin{document}
\maketitle
\begin{frame}{First Frame}
blah blah blah?
\begin{itemize}
\item blah blah blah.
\item blah blah.
\item yadda yadda yadda.
\end{itemize}
\end{frame}
\begin{frame}{Second Frame}
blah blah!
\begin{enumerate}
\item blah blah blah.
\item blah blah.
\item blah blah bah.
\end{enumerate}
\end{frame}
\end{document}
答案1
progress bar in section page
进度条样式使用 Beamer 模板和中的 TikZ 定义progress bar in head/foot
。这些模板的定义可在metropolis
文档通过将这些定义复制粘贴到您的 MWE 中并修改 TikZ 代码,我能够在进度条周围获得一个非常简单的边框(2pt 厚度,便于查看):
\documentclass[12pt,aspectratio=169,xcolor={svgnames, dvipsnames}]{beamer}
\usetheme[progressbar=frametitle]{metropolis}
\usepackage{appendixnumberbeamer}
\usepackage{booktabs}
\usepackage[scale=2]{ccicons}
\usepackage{pgfplots}
\usepgfplotslibrary{dateplot}
\usepackage{xspace}
\newcommand{\themename}{\textbf{\textsc{metropolis}}\xspace}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% My Mods
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\setlength{\metropolis@titleseparator@linewidth}{2pt}
\setlength{\metropolis@progressonsectionpage@linewidth}{2pt}
\setlength{\metropolis@progressinheadfoot@linewidth}{2pt}
% Redefine `progress bar in head/foot` to add border
\newlength{\metropolis@progressinheadfoot@borderwidth}
\setlength{\metropolis@progressinheadfoot@borderwidth}{2pt}
\setbeamertemplate{progress bar in head/foot}{
\nointerlineskip
\setlength{\metropolis@progressinheadfoot}{%
\paperwidth * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}%
}%
\begin{beamercolorbox}[wd=\paperwidth]{progress bar in head/foot}
\begin{tikzpicture}
% Add blue progress bar border
\fill[blue] (0,-\metropolis@progressinheadfoot@borderwidth) rectangle (\paperwidth, \metropolis@progressinheadfoot@linewidth+\metropolis@progressinheadfoot@borderwidth);
\fill[bg] (\metropolis@progressinheadfoot@borderwidth,0) rectangle (\paperwidth-\metropolis@progressinheadfoot@borderwidth, \metropolis@progressinheadfoot@linewidth);
\fill[fg] (\metropolis@progressinheadfoot@borderwidth,0) rectangle (\metropolis@progressinheadfoot-\metropolis@progressinheadfoot@borderwidth, \metropolis@progressinheadfoot@linewidth);
\end{tikzpicture}%
\end{beamercolorbox}
}
% Redefine `progress bar in section page` to add border
\newlength{\metropolis@progressonsectionpage@borderwidth}
\setlength{\metropolis@progressonsectionpage@borderwidth}{2pt}
\setbeamertemplate{progress bar in section page}{
\setlength{\metropolis@progressonsectionpage}{%
\textwidth * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}%
}%
\begin{tikzpicture}
% Add blue progress bar border
\fill[blue] (0,-\metropolis@progressonsectionpage@borderwidth) rectangle (\textwidth, \metropolis@progressonsectionpage@linewidth+\metropolis@progressonsectionpage@borderwidth);
\fill[bg] (\metropolis@progressonsectionpage@borderwidth,0) rectangle (\textwidth-\metropolis@progressonsectionpage@borderwidth, \metropolis@progressonsectionpage@linewidth);
\fill[fg] (\metropolis@progressonsectionpage@borderwidth,0) rectangle (\metropolis@progressonsectionpage-\metropolis@progressonsectionpage@borderwidth, \metropolis@progressonsectionpage@linewidth);
\end{tikzpicture}%
}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\title{Metropolis -- Modified}
\subtitle{A modern beamer theme}
% \date{\today}
\date{}
\author{Matthias Vogelgesang}
\institute{Center for modern beamer themes}
% \titlegraphic{\hfill\includegraphics[height=1.5cm]{logo.pdf}}
\begin{document}
\maketitle
\begin{frame}{First Frame}
blah blah blah?
\begin{itemize}
\item blah blah blah.
\item blah blah.
\item yadda yadda yadda.
\end{itemize}
\end{frame}
\begin{frame}{Second Frame}
blah blah!
\begin{enumerate}
\item blah blah blah.
\item blah blah.
\item blah blah bah.
\end{enumerate}
\end{frame}
\section{Test section}
\begin{frame}{Third Frame}
blah blah!
\begin{enumerate}
\item blah blah blah.
\item blah blah.
\item blah blah bah.
\end{enumerate}
\end{frame}
\end{document}