Split title page template into sub-templates
This commit is contained in:
parent
57240b2614
commit
63e5302433
BIN
demo/demo.pdf
BIN
demo/demo.pdf
Binary file not shown.
Binary file not shown.
|
@ -156,102 +156,29 @@
|
||||||
% \end{macrocode}
|
% \end{macrocode}
|
||||||
%
|
%
|
||||||
% \begin{macro}{title page}
|
% \begin{macro}{title page}
|
||||||
% Template for the title page.
|
% Template for the title page. Each element is only typset if it is defined
|
||||||
|
% by the user. If |\subtitle| is empty, for example, it won't leave a blank
|
||||||
|
% space on the title slide.
|
||||||
% \begin{macrocode}
|
% \begin{macrocode}
|
||||||
\setbeamertemplate{title page}{
|
\setbeamertemplate{title page}{
|
||||||
\begin{minipage}[b][\paperheight]{\textwidth}
|
\begin{minipage}[b][\paperheight]{\textwidth}
|
||||||
% \end{macrocode}
|
\ifx\inserttitlegraphic\@empty\else\usebeamertemplate*{title graphic}\fi
|
||||||
%
|
|
||||||
% If the user has set a |titlegraphic|, we set it in a zero-height box so
|
|
||||||
% it doesn't change the position of other elements.
|
|
||||||
%
|
|
||||||
% \begin{macrocode}
|
|
||||||
\ifx\inserttitlegraphic\@empty\else{%
|
|
||||||
\vbox to 0pt {
|
|
||||||
\vspace*{2em}
|
|
||||||
\usebeamercolor[fg]{titlegraphic}%
|
|
||||||
\inserttitlegraphic%
|
|
||||||
}%
|
|
||||||
\nointerlineskip%
|
|
||||||
}
|
|
||||||
\fi
|
|
||||||
\vfill%
|
\vfill%
|
||||||
|
\ifx\inserttitle\@empty\else\usebeamertemplate*{title}\fi
|
||||||
|
\ifx\insertsubtitle\@empty\else\usebeamertemplate*{subtitle}\fi
|
||||||
|
\usebeamertemplate*{title separator}
|
||||||
% \end{macrocode}
|
% \end{macrocode}
|
||||||
%
|
%
|
||||||
% We set the title and subtitle, but only if they are defined by the user.
|
% Beamer's definition of |\insertauthor| is always nonempty, so we have
|
||||||
% If |\subtitle| is empty, for example, it won't leave a blank space on the
|
|
||||||
% title slide.
|
|
||||||
%
|
|
||||||
% \begin{macrocode}
|
|
||||||
\ifx\inserttitle\@empty\else{{%
|
|
||||||
\raggedright%
|
|
||||||
\linespread{1.0}%
|
|
||||||
\usebeamerfont{title}%
|
|
||||||
\usebeamercolor[fg]{title}%
|
|
||||||
\@metropolis@titleformat{\inserttitle}%
|
|
||||||
\par%
|
|
||||||
\vspace*{0.5em}
|
|
||||||
}}
|
|
||||||
\fi
|
|
||||||
\ifx\insertsubtitle\@empty\else{{%
|
|
||||||
\usebeamerfont{subtitle}%
|
|
||||||
\usebeamercolor[fg]{subtitle}%
|
|
||||||
\insertsubtitle%
|
|
||||||
\par%
|
|
||||||
\vspace*{0.5em}
|
|
||||||
}}
|
|
||||||
\fi
|
|
||||||
% \end{macrocode}
|
|
||||||
%
|
|
||||||
% A horizontal rule (drawn in TikZ) separates the title and subtitle from
|
|
||||||
% the author, date, and institution.
|
|
||||||
%
|
|
||||||
% \begin{macrocode}
|
|
||||||
\begin{tikzpicture}
|
|
||||||
\usebeamercolor{title separator}
|
|
||||||
\draw[fg] (0, 0) -- (\textwidth, 0);
|
|
||||||
\end{tikzpicture}%
|
|
||||||
\par%
|
|
||||||
\vspace*{1em}%
|
|
||||||
% \end{macrocode}
|
|
||||||
%
|
|
||||||
% Like the title and subtitle, we display the author only when it is defined.
|
|
||||||
% But beamer's definition of |\insertauthor| is always nonempty, so we have
|
|
||||||
% to test another macro initialized by |\author{...}| to see if the user has
|
% 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
|
% defined an author. This solution was suggested by Enrico Gregorio in an
|
||||||
% answer to \href{https://tex.stackexchange.com/questions/241306/}{this
|
% answer to \href{https://tex.stackexchange.com/questions/241306/}{this
|
||||||
% Stack Exchange question}.
|
% Stack Exchange question}.
|
||||||
%
|
%
|
||||||
% \begin{macrocode}
|
% \begin{macrocode}
|
||||||
\ifx\beamer@shortauthor\@empty\else{{%
|
\ifx\beamer@shortauthor\@empty\else\usebeamertemplate*{author}\fi
|
||||||
\usebeamerfont{author}%
|
\ifx\insertdate\@empty\else\usebeamertemplate*{date}\fi
|
||||||
\usebeamercolor[fg]{author}%
|
\ifx\insertinstitute\@empty\else\usebeamertemplate*{institute}\fi
|
||||||
\insertauthor%
|
|
||||||
\par%
|
|
||||||
\vspace*{0.25em}
|
|
||||||
}}
|
|
||||||
\fi
|
|
||||||
% \end{macrocode}
|
|
||||||
%
|
|
||||||
% The date and institute are set after the author, again provided they are
|
|
||||||
% nonempty. Note that the default date in \LaTeX{} is |\today|, not |\empty|.
|
|
||||||
%
|
|
||||||
% \begin{macrocode}
|
|
||||||
\ifx\insertdate\@empty\else{{%
|
|
||||||
\usebeamerfont{date}%
|
|
||||||
\usebeamercolor[fg]{date}%
|
|
||||||
\insertdate%
|
|
||||||
\par%
|
|
||||||
}}
|
|
||||||
\fi
|
|
||||||
\ifx\insertinstitute\@empty\else{{%
|
|
||||||
\vspace*{3mm}
|
|
||||||
\usebeamerfont{institute}%
|
|
||||||
\usebeamercolor[fg]{institute}%
|
|
||||||
\insertinstitute%
|
|
||||||
\par%
|
|
||||||
}}
|
|
||||||
\fi
|
|
||||||
\vfill
|
\vfill
|
||||||
\vspace*{1mm}
|
\vspace*{1mm}
|
||||||
\end{minipage}
|
\end{minipage}
|
||||||
|
@ -285,6 +212,90 @@
|
||||||
% \end{macro}
|
% \end{macro}
|
||||||
% \end{macro}
|
% \end{macro}
|
||||||
%
|
%
|
||||||
|
% \begin{macro}{title graphic}
|
||||||
|
% Set the title graphic in a zero-height box, so it doesn't change the
|
||||||
|
% position of other elements.
|
||||||
|
% \begin{macrocode}
|
||||||
|
\setbeamertemplate{title graphic}{
|
||||||
|
\vbox to 0pt {
|
||||||
|
\vspace*{2em}
|
||||||
|
\inserttitlegraphic%
|
||||||
|
}%
|
||||||
|
\nointerlineskip%
|
||||||
|
}
|
||||||
|
% \end{macrocode}
|
||||||
|
% \end{macro}
|
||||||
|
%
|
||||||
|
% \begin{macro}{title}
|
||||||
|
% Set the title on the title page.
|
||||||
|
% \begin{macrocode}
|
||||||
|
\setbeamertemplate{title}{
|
||||||
|
\raggedright%
|
||||||
|
\linespread{1.0}%
|
||||||
|
\@metropolis@titleformat{\inserttitle}%
|
||||||
|
\par%
|
||||||
|
\vspace*{0.5em}
|
||||||
|
}
|
||||||
|
% \end{macrocode}
|
||||||
|
% \end{macro}
|
||||||
|
%
|
||||||
|
% \begin{macro}{subtitle}
|
||||||
|
% Set the subtitle on the title page.
|
||||||
|
% \begin{macrocode}
|
||||||
|
\setbeamertemplate{subtitle}{
|
||||||
|
\insertsubtitle%
|
||||||
|
\par%
|
||||||
|
\vspace*{0.5em}
|
||||||
|
}
|
||||||
|
% \end{macrocode}
|
||||||
|
% \end{macro}
|
||||||
|
%
|
||||||
|
% \begin{macro}{title separator}
|
||||||
|
% Template to set the title graphic in a zero-height box. (It won't
|
||||||
|
% change the position of other elements.)
|
||||||
|
% \begin{macrocode}
|
||||||
|
\setbeamertemplate{title separator}{
|
||||||
|
\begin{tikzpicture}
|
||||||
|
\draw[fg] (0, 0) -- (\textwidth, 0);
|
||||||
|
\end{tikzpicture}%
|
||||||
|
\par%
|
||||||
|
}
|
||||||
|
% \end{macrocode}
|
||||||
|
% \end{macro}
|
||||||
|
%
|
||||||
|
% \begin{macro}{author}
|
||||||
|
% Set the author on the title page.
|
||||||
|
% \begin{macrocode}
|
||||||
|
\setbeamertemplate{author}{
|
||||||
|
\vspace*{2em}
|
||||||
|
\insertauthor%
|
||||||
|
\par%
|
||||||
|
\vspace*{0.25em}
|
||||||
|
}
|
||||||
|
% \end{macrocode}
|
||||||
|
% \end{macro}
|
||||||
|
%
|
||||||
|
% \begin{macro}{date}
|
||||||
|
% Set the date on the title page.
|
||||||
|
% \begin{macrocode}
|
||||||
|
\setbeamertemplate{date}{
|
||||||
|
\insertdate%
|
||||||
|
\par%
|
||||||
|
}
|
||||||
|
% \end{macrocode}
|
||||||
|
% \end{macro}
|
||||||
|
%
|
||||||
|
% \begin{macro}{institute}
|
||||||
|
% Set the institute on the title page.
|
||||||
|
% \begin{macrocode}
|
||||||
|
\setbeamertemplate{institute}{
|
||||||
|
\vspace*{3mm}
|
||||||
|
\insertinstitute%
|
||||||
|
\par%
|
||||||
|
}
|
||||||
|
% \end{macrocode}
|
||||||
|
% \end{macro}
|
||||||
|
%
|
||||||
%
|
%
|
||||||
%
|
%
|
||||||
% \subsubsection{Section page}
|
% \subsubsection{Section page}
|
||||||
|
|
Loading…
Reference in New Issue