大家好,新年快樂!
第一次在這裡發帖,我只是有一個快速問題,我無法解決。我使用 Metropolis 主題發布了基本 LaTeX 投影機代碼的 MWE。 * 我希望(全局)讓進度條在其周圍有一個邊框,指定邊框的顏色和厚度(假設一個 0.25pt 的藍色邊框)厚的)。如何才能做到這一點?
如果有什麼需要澄清的地方,請告訴我。先非常感謝任何好心人考慮我的問題。
希望大家2024年快樂健康!
*具體來說,背頁模板,取代了框架,並對 MWE 程式碼的第一行和序言的「我的 Mods」部分進行了少量修改。
最小工作範例 (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
進度條樣式是使用 Beamer 模板progress bar in section page
和中的 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}