带有 Metropolis 标题页的 Plain Beamer 演示文稿

带有 Metropolis 标题页的 Plain Beamer 演示文稿

我想创建一个演示文稿最小/简单主题,但有一个漂亮的标题页,如都会。我不知道如何只使用 metropolis 的标题设置,而不必对其余幻灯片使用完整主题(我不喜欢)。我曾尝试将 metropolis 主题的标题部分添加到演示文稿中

  \setbeamertemplate{title page}{
  \begin{minipage}[b][\paperheight]{\textwidth}
    \ifx\inserttitlegraphic\@empty\else\usebeamertemplate*{title graphic}\fi
    \vfill%
    \ifx\inserttitle\@empty\else\usebeamertemplate*{title}\fi
    \ifx\insertsubtitle\@empty\else\usebeamertemplate*{subtitle}\fi
    \usebeamertemplate*{title separator}
%    \end{macrocode}
%
% Beamer's definition of |\insertauthor| is always nonempty, so we have
% to test another macro initialized by |\author{...}| to see if the user has
% defined an author. This solution was suggested by Enrico Gregorio in an
% answer to \href{https://tex.stackexchange.com/questions/241306/}{this
% Stack Exchange question}.
%
 %    \begin{macrocode}
    \ifx\beamer@shortauthor\@empty\else\usebeamertemplate*{author}\fi
    \ifx\insertdate\@empty\else\usebeamertemplate*{date}\fi
    \ifx\insertinstitute\@empty\else\usebeamertemplate*{institute}\fi
    \vfill
    \vspace*{1mm}
  \end{minipage}
}

任何帮助都将受到赞赏。

答案1

您需要加载更多元素(并明确加载TikZ)才能metropolis在默认的 beamer 主题上重现标题框。

以下代码仅加载title frame格式,使用的颜色来自默认主题。

\documentclass{beamer}
\usepackage{tikz}

\makeatletter
\setbeamertemplate{title page}{
  \begin{minipage}[b][\paperheight]{\textwidth}
    \ifx\inserttitlegraphic\@empty\else\usebeamertemplate*{title graphic}\fi
    \vfill%
    \ifx\inserttitle\@empty\else\usebeamertemplate*{title}\fi
    \ifx\insertsubtitle\@empty\else\usebeamertemplate*{subtitle}\fi
    \usebeamertemplate*{title separator}
    \ifx\beamer@shortauthor\@empty\else\usebeamertemplate*{author}\fi
    \ifx\insertdate\@empty\else\usebeamertemplate*{date}\fi
    \ifx\insertinstitute\@empty\else\usebeamertemplate*{institute}\fi
    \vfill
    \vspace*{1mm}
  \end{minipage}
}
\def\maketitle{%
  \ifbeamer@inframe
    \titlepage
  \else
    \frame[plain,noframenumbering]{\titlepage}
  \fi
}
\def\titlepage{%
  \usebeamertemplate{title page}
}
\setbeamertemplate{title graphic}{
  \vbox to 0pt {
    \vspace*{2em}
    \inserttitlegraphic%
  }%
  \nointerlineskip%
}
\setbeamertemplate{title}{
  \raggedright%
  \linespread{1.0}%
  \inserttitle%
  \par%
  \vspace*{0.5em}
}
\setbeamertemplate{subtitle}{
  \raggedright%
  \insertsubtitle%
  \par%
  \vspace*{0.5em}
}
\newlength{\metropolis@titleseparator@linewidth}
\setlength{\metropolis@titleseparator@linewidth}{0.4pt}
\setbeamertemplate{title separator}{
  \begin{tikzpicture}
    \fill[fg] (0,0) rectangle (\textwidth, \metropolis@titleseparator@linewidth);
  \end{tikzpicture}%
  \par%
}
\setbeamertemplate{author}{
  \vspace*{2em}
  \insertauthor%
  \par%
  \vspace*{0.25em}
}
\setbeamertemplate{date}{
  \insertdate%
  \par%
}
\setbeamertemplate{institute}{
  \vspace*{3mm}
  \insertinstitute%
  \par%
}
\makeatother

\author{John Doe}
\title{Presentation with Metropolis title frame}

\begin{document}
\maketitle

\begin{frame}{example frame}
text
\end{frame}

\end{document}

在此处输入图片描述

相关内容