Beamer:为什么带逗号的标题会上移?

Beamer:为什么带逗号的标题会上移?

我的标题有问题。我不明白为什么包含逗号的标题会向上移动?!我试图调整框的大小,但没有成功!

您可以看到,与其他三帧相比,第二帧的标题向上移动了。而且右上角有一个徽标,看起来很丑。有什么想法吗?

\documentclass[compress]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\setbeamertemplate{frametitle}{
\begin{beamercolorbox}[wd=\paperwidth,leftskip=2mm,rightskip=2mm,ht=15mm,dp=0ex]{frametitle}
%\hfill\includegraphics[width=25mm,keepaspectratio=true]{thismaimage} \par
\usebeamerfont{frametitle}\textbf{\MakeUppercase{\insertframetitle}}%
\vspace{2mm}\hrule
\end{beamercolorbox}
}
\newcommand{\frameee}{
\begin{frame}{TEST}
This is a TEST
\end{frame}
}
\begin{document}
\frameee
\frame{\frametitle{T,EST}This title has a comma}
\frameee
\frameee
\end{document}

答案1

您正在使用\hrule,但 TeX 不会在其前插入行间粘连。

因此你有两种策略。

插入线间胶

\begin{beamercolorbox}[
  wd=\paperwidth,
  leftskip=2mm,
  rightskip=2mm,
  ht=15mm,dp=0pt
]{frametitle}
\usebeamerfont{frametitle}
%\hspace*{\fill}\includegraphics[width=25mm,keepaspectratio=true]{thismaimage}\par
\textbf{\MakeUppercase{\insertframetitle}}\par
\vspace{-\baselineskip}\vspace{2mm}
\hspace*{-\leftskip}\rule{\paperwidth}{.4pt}\hspace*{-\rightskip}
\end{beamercolorbox}

使用支撑架

\begin{beamercolorbox}[
  wd=\paperwidth,
  leftskip=2mm,
  rightskip=2mm,
  ht=15mm,dp=0pt
]{frametitle}
\usebeamerfont{frametitle}
%\hspace*{\fill}\includegraphics[width=25mm,keepaspectratio=true]{thismaimage}\par
\textbf{\strut\MakeUppercase{\insertframetitle}}\par
\vspace{2mm}
\hrule
\end{beamercolorbox}

相关内容