我希望框架结构如下:
-- 章节标题 --
-- 进度条上的帧编号分数(最右端)--
-- 框架标题 --
-- 框架内容 --
通过 metropolis,利用 StackExchange 上的旧问题,我得到了以下信息:
\documentclass[lualatex]{beamer}
\usetheme[progressbar=head]{metropolis}
\metroset{numbering=fraction}
\makeatletter
\setlength{\metropolis@progressinheadfoot@linewidth}{1em}
\setbeamertemplate{headline}{%
\begin{beamercolorbox}[colsep=1.5pt]{upper separation line head}
\end{beamercolorbox}
\begin{beamercolorbox}{section in head/foot}
\vskip2pt\insertnavigation{\paperwidth}\vskip2pt
\end{beamercolorbox}%
\begin{beamercolorbox}[colsep=1.5pt]{lower separation line head}
\end{beamercolorbox}
}
\def\beamer@writeslidentry{\clearpage\beamer@notesactions}
\makeatother
\setbeamercolor{section in head/foot}{fg=black, bg=white}
\begin{document}
\section{section title}
\begin{frame}{frame title}
first line
second line
\end{frame}
\end{document}
此代码设法将部分和进度条放在顶部,后者元素被前者覆盖,并使用帧号分数。
答案1
主题moloch
(主题的更现代分支metropolis
)使用标题模板来显示进度条。如果您使用,\setbeamertemplate{headline}{...}
则不会覆盖进度条,而是将其完全删除。您可以改为使用\addtobeamertemplate{headline}{<before>}{<after>}
在标题中添加内容,而无需主动删除已经存在的进度条:
\documentclass{beamer}
\usetheme[progressbar=head]{moloch}% modern fork of the metropolis theme
\setbeamertemplate{page number in head/foot}[totalframenumber]
\usepackage{tikz}
\makeatletter
\setlength{\moloch@progressinheadfoot@linewidth}{1em}
\addtobeamertemplate{headline}{%
\begin{beamercolorbox}[colsep=1.5pt]{upper separation line head}
\end{beamercolorbox}
\begin{beamercolorbox}{section in head/foot}
\vskip2pt\insertnavigation{\paperwidth}\vskip2pt
\end{beamercolorbox}%
\begin{beamercolorbox}[colsep=1.5pt]{lower separation line head}
\end{beamercolorbox}
\par
}{}
\setbeamertemplate{footline}{
\begin{tikzpicture}[remember picture,overlay]
\node[anchor=north east] at ([yshift=-5.5ex]current page.north east) {\usebeamercolor[fg]{page number in head/foot}\usebeamertemplate{page number in head/foot}};
\end{tikzpicture}
}
\def\beamer@writeslidentry{\clearpage\beamer@notesactions}
\makeatother
\setbeamercolor{section in head/foot}{fg=black, bg=white}
\setbeamercolor{page number in head/foot}{fg=mLightBrown}
\begin{document}
\section{section title}
\begin{frame}
\frametitle{frame title}
first line
second line
\end{frame}
\begin{frame}
\frametitle{frame title}
first line
second line
\end{frame}
\end{document}