我使用的是华沙主题。我的 Beamer 演示文稿的页脚中的短标题和幻灯片编号之间没有空格。
这是我的 MWE:
\documentclass{beamer}
\mode<presentation>{\usetheme{Warsaw}}
%% preamble
\title[]{\sc}
\makeatletter
\setbeamertemplate{footline}{%
\leavevmode%
\hbox{\begin{beamercolorbox}[wd=.24 \paperwidth,ht=2.5ex,dp=1.125ex,leftskip=.01cm plus1fill,rightskip=.05cm]{author in head/foot}%
\usebeamerfont{title in head/foot}\insertshortauthor
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.76\paperwidth,ht=2.5ex,dp=1.125ex,leftskip=.05cm,rightskip=.15cm plus1fil]{title in head/foot}%
\usebeamerfont{title in head/foot}\insertshorttitle
\insertframenumber{} / \inserttotalframenumber \ \hspace*{2ex}
\end{beamercolorbox}}%
\vskip0pt%
}
\makeatother
\begin{document}
\begin{frame}
Hello World!
\end{frame}
\end{document}
答案1
仅打印文本的命令通常会使以下空格消失(请参阅LaTeX 命令后的空格例如)。
为了防止这种情况,你可以使用(1) \command{}
(2) \command\
(后有空格\
)或(3)使用xspace
包(如果您创建了自己的命令)。我想这个列表并不完整。
简短解决方案
\insertshorttitle{}
完整代码
\documentclass{beamer}
\mode<presentation>{\usetheme{Warsaw}}
%% preamble
\title[Short Title]{Long Title}
\makeatletter
\setbeamertemplate{footline}{%
\leavevmode%
\hbox{\begin{beamercolorbox}[wd=.24 \paperwidth,ht=2.5ex,dp=1.125ex,leftskip=.01cm plus1fill,rightskip=.05cm]{author in head/foot}%
\usebeamerfont{title in head/foot}\insertshortauthor
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.76\paperwidth,ht=2.5ex,dp=1.125ex,leftskip=.05cm,rightskip=.15cm plus1fil]{title in head/foot}%
\usebeamerfont{title in head/foot}\insertshorttitle{}
\insertframenumber{} / \inserttotalframenumber \ \hspace*{2ex}
\end{beamercolorbox}}%
\vskip0pt%
}
\makeatother
\begin{document}
\begin{frame}
Hello World!
\end{frame}
\end{document}