我正在尝试做一些不太难的事情,但出于某种原因,我无法理解。基本上,在我的 Beamer 演示文稿的底部,我想显示两个徽标(在页面的左下角和右下角)和帧号(在中间)。这是我的尝试:
\documentclass{beamer}
\usetheme{Madrid}
\title{\textbf{My awesome presentation}}
\author{Name Surname}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{footline}{%
\hspace*{0.3cm}\raisebox{0.2cm}{\includegraphics[height=0.8cm]{first_image.png}}%
\hfill%
\raisebox{0.5cm}{\insertframenumber{} / \inserttotalframenumber}%
\hfill%
\raisebox{0.3cm}{\includegraphics[height=0.8cm]{second_image.png}}%
\hspace*{0.3cm}
}
\begin{document}
{
\setbeamertemplate{footline}{}
\begin{frame}
\titlepage
\end{frame}
}
\begin{frame}{Title}
Blah blah
\end{frame}
\begin{frame}{Another frame}
Blah blah
\end{frame}
\end{document}
图像显示正确,但帧编号不在页面中间。当然我可以想象为什么,因为两个图像的宽度不同,但我该如何解决?
答案1
快速解决方法:将图像放置在已知宽度的环境中,例如\parbox
,minipage
或类似环境。
离题:如果您希望标题加粗,请使用\setbeamerfont{title}{series=\bfseries}
,不要在诸如的字段中放置格式说明\author
。
\documentclass{beamer}
\usetheme{Madrid}
\setbeamerfont{title}{series=\bfseries}
\title{My awesome presentation}
\author{Name Surname}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{footline}{%
\hspace*{0.3cm}\parbox{3cm}{\includegraphics[height=0.8cm]{example-image-golden-upright}}%
\hfill%
{\insertframenumber{} / \inserttotalframenumber}%
\hfill%
\parbox{3cm}{\hfill\includegraphics[height=0.8cm]{example-image-golden}}%
\hspace*{0.3cm}
\vskip0.3cm
}
\begin{document}
\begin{frame}{Title}
Blah blah
\end{frame}
\end{document}
答案2
使用\llap
和\rlap
:
\documentclass{beamer}
\usetheme{Madrid}
\setbeamerfont{title}{series=\bfseries}
\title{My awesome presentation}
\author{Name Surname}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{footline}{%
\hspace*{0.3cm}\rlap{\includegraphics[height=0.8cm]{example-image-golden-upright}}%
\hfill%
{\insertframenumber{} / \inserttotalframenumber}%
\hfill%
\llap{\includegraphics[height=0.8cm]{example-image-golden}}%
\hspace*{0.3cm}
\vskip0.3cm}
}
\begin{document}
\begin{frame}{Title}
Blah blah
\end{frame}
\end{document}