![如何在包含 miniframe 的投影仪标题末尾添加页码(总计)](https://linux22.com/image/468358/%E5%A6%82%E4%BD%95%E5%9C%A8%E5%8C%85%E5%90%AB%20miniframe%20%E7%9A%84%E6%8A%95%E5%BD%B1%E4%BB%AA%E6%A0%87%E9%A2%98%E6%9C%AB%E5%B0%BE%E6%B7%BB%E5%8A%A0%E9%A1%B5%E7%A0%81%EF%BC%88%E6%80%BB%E8%AE%A1%EF%BC%89.png)
我使用带有包含微型框架导航内容的标题的 beamer:
\documentclass[compress]{beamer}
\useoutertheme[subsection=false]{miniframes}
\setbeamercolor{section in head/foot}{fg=white, bg=black}
\begin{document}
\section{First}
\frame{First-first}
\frame{First-second}
\section{Second}
\frame{Second-first}
\frame{Second-second}
\end{document}
这给出了一个充满小框架的标题:
我想在标题末尾(右边缘)添加页码(总计,即 x/y)。我希望能够控制小框架部分(最后一节)和页码部分之间的间距。
可以在那里添加页码吗?如果可以,如何添加?
答案1
由于我们正在重新定义您上一个问题的标题,您可以page number in head/foot
像这样将模板添加到标题中(根据需要更改导航的宽度):
\documentclass[compress]{beamer}
\useoutertheme[subsection=false]{miniframes}
\setbeamercolor{section in head/foot}{fg=white, bg=black}
%\setbeamercolor{page number in head/foot}{fg=white}
\setbeamertemplate{page number in head/foot}[totalframenumber]
\makeatletter
\setbeamertemplate{headline}
{%
\begin{beamercolorbox}[colsep=1.5pt]{upper separation line head}
\end{beamercolorbox}
\begin{beamercolorbox}{section in head/foot}
\vskip2pt
\begin{minipage}[c]{.8\paperwidth}
\insertnavigation{\linewidth}
\end{minipage}%
\begin{minipage}[c]{.2\paperwidth}
\hfill\usebeamercolor[fg]{page number in head/foot}\usebeamertemplate{page number in head/foot}\quad\mbox{}
\end{minipage}%
\vskip4pt % <- change here
\end{beamercolorbox}%
\ifbeamer@theme@subsection%
\begin{beamercolorbox}[colsep=1.5pt]{middle separation line head}
\end{beamercolorbox}
\begin{beamercolorbox}[ht=2.5ex,dp=1.125ex,%
leftskip=.3cm,rightskip=.3cm plus1fil]{subsection in head/foot}
\usebeamerfont{subsection in head/foot}\insertsubsectionhead
\end{beamercolorbox}%
\fi%
\begin{beamercolorbox}[colsep=1.5pt]{lower separation line head}
\end{beamercolorbox}
}
\makeatother
\begin{document}
\section{First}
\frame{First-first}
\frame{First-second}
\section{Second}
\frame{Second-first}
\frame{Second-second}
\end{document}