对齐多个 beamercolorbox 之前的边距

对齐多个 beamercolorbox 之前的边距

以下代码:

\documentclass{beamer}

% DEFINE COLORS. ---------------------------------------------------------------
\definecolor{bgo}{HTML}{111111}
\definecolor{bgt}{HTML}{555555}
\definecolor{fgo}{HTML}{EEEEEE}


% SET COLORS. ------------------------------------------------------------------
\setbeamercolor{author in head/foot}{fg=fgo, bg=bgo}
\setbeamercolor{title in head/foot}{fg=fgo, bg=bgt}
\setbeamercolor{section in head/foot}{fg=fgo, bg=bgo}


\defbeamertemplate*{frametitle}{ocp}{%
  \nointerlineskip%
  \leavevmode%
  \begin{beamercolorbox}[wd=\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
    \usebeamerfont{title in head/foot}\insertframetitle{}
  \end{beamercolorbox}\\
  \hbox{%
    \begin{beamercolorbox}[wd=.1\paperwidth,ht=2.25ex,dp=1ex,left]{author in head/foot}%
      \usebeamerfont{author in head/foot}Author
    \end{beamercolorbox}%
    \begin{beamercolorbox}[wd=.45\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
      \usebeamerfont{title in head/foot}\insertframetitle{}
    \end{beamercolorbox}%
    \begin{beamercolorbox}[wd=.45\paperwidth,ht=2.25ex,dp=1ex,right]{section in head/foot}%
      \usebeamercolor{section in head/foot}Section
    \end{beamercolorbox}%
  }%
  \vskip0pt%  \fi%
}

\begin{document}

\begin{frame}
\frametitle{Frame Title}
\end{frame}

\end{document}

给出:

在此处输入图片描述

为什么水平框前有边距?如何删除它?


[临时解决方案]

不要使用hbox,而要使用beamercolorbox

\defbeamertemplate*{frametitle}{ocp}{%
  \nointerlineskip%
  \leavevmode%
  \begin{beamercolorbox}[wd=\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
    \usebeamerfont{title in head/foot}\insertframetitle{}
  \end{beamercolorbox}\\
  \begin{beamercolorbox}[wd=\paperwidth]{}
    \begin{beamercolorbox}[wd=.1\paperwidth,ht=2.25ex,dp=1ex,left]{author in head/foot}%
      \usebeamerfont{author in head/foot}Author
    \end{beamercolorbox}%
    \begin{beamercolorbox}[wd=.45\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
      \usebeamerfont{title in head/foot}\insertframetitle{}
    \end{beamercolorbox}%
    \begin{beamercolorbox}[wd=.45\paperwidth,ht=2.25ex,dp=1ex,right]{section in head/foot}%
      \usebeamercolor{section in head/foot}Section
    \end{beamercolorbox}%
  \end{beamercolorbox}
  \vskip0pt%  \fi%
}

在此处输入图片描述

这个解决方案有效,我认为这与第一个宽度是最大宽度有关beamercolorbox,但这很奇怪,因为如果我将我的第一个实现用于脚注,例如,它可以完美地运行。

相关内容