我想創建一個演示文稿最小/簡單主題,但有一個漂亮的標題頁,例如都會。我無法弄清楚如何僅使用大都會的標題設置,而不必使用其餘投影片的完整主題(我不喜歡)。我嘗試將大都市主題的標題部分添加到演示文稿中
\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
在預設投影機主題上重現標題框架。
以下程式碼僅載入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}