如何使 \defbeamertemplate* 里面的内容顶部对齐?

如何使 \defbeamertemplate* 里面的内容顶部对齐?

我为标题页指定了\defbeamertemplate*{title page}{xyz}[1][]{}。但是它似乎在底部或中心对齐。如果我添加较长的标题并且它们换行,则页眉装饰(在 内定义,title page因为标题页通常没有\frametitle)会上下移动。但我需要它固定在一个特定位置。

这是一个简单的例子:

\documentclass[presentation,english]{beamer}
\usepackage[utf8]{inputenc}

\title[Scientific LaTeX]{abc}
\title[Scientific LaTeX]{The science of using LaTeX to present the most awesome stuff in science.}
\author{Prof. Sciencemaster}
\subtitle{Chapter 47} 
\subtitle{Chapter 47: Adjusting the flux capacitor in sub-lightspeed without Fusion-knobs}
\date{\today}

\defbeamertemplate*{title page}{bla}[1][t]
{
  \begin{minipage}{\textwidth}%
    \hspace{\dimexpr0.5\textwidth-0.5\paperwidth\relax}%
    \hspace{5pt}%
      \begin{minipage}{\paperwidth}%
        \begin{minipage}{\dimexpr\paperwidth-1cm\relax}%
          \vskip1em\par%
          {\usebeamerfont{title}\color{blue}\inserttitle}%
          \ifx\insertsubtitle\empty%
          \else%
          \par%
          {\usebeamerfont{subtitle}\color{red}\insertsubtitle}%
          \fi%
          \par%
          {\usebeamerfont{author}\color{green}\insertauthor}%
        \end{minipage}%
      \end{minipage}%
  \end{minipage}%
}

\begin{document}

\setbeamertemplate{footline}[bla]
\begin{frame}
  \titlepage
\end{frame}

\end{document}

我基本上希望该框中的所有内容都顶部对齐,这样我就可以从顶部开始构建页面。

答案1

您可以为小页面提供可选参数,特别是inner position

\begin{minipage}[outer position][height][inner position]{width}
    ...
\end{minipage}

您的示例的一些简化版本:

\documentclass[presentation,english]{beamer}
\usepackage[utf8]{inputenc}

\title[Scientific LaTeX]{abc}
\author{Prof. Sciencemaster}
\subtitle{Chapter 47} 
\date{\today}

\defbeamertemplate*{title page}{bla}[1][t]{%
    \begin{minipage}[t][\paperheight][t]{\dimexpr\paperwidth-1cm\relax}%
        \vskip1em\par%
    {\usebeamerfont{title}\color{blue}\inserttitle}%
    \ifx\insertsubtitle\empty%
    \else%
    \par%
    {\usebeamerfont{subtitle}\color{red}\insertsubtitle}%
    \fi%
    \par%
    {\usebeamerfont{author}\color{green}\insertauthor}%
  \end{minipage}%
}

\begin{document}

\setbeamertemplate{footline}[bla]
\begin{frame}
  \titlepage
\end{frame}

\title[Scientific LaTeX]{The science of using LaTeX to present the most awesome stuff in science.}
\subtitle{Chapter 47: Adjusting the flux capacitor in sub-lightspeed without Fusion-knobs}
\setbeamertemplate{footline}[bla]
\begin{frame}
    \titlepage
\end{frame}


\end{document}

相关内容