mirror of https://github.com/matze/mtheme.git
373 lines
10 KiB
TeX
373 lines
10 KiB
TeX
% \iffalse meta-comment -------------------------------------------------------
|
|
% Copyright 2015 Matthias Vogelgesang and the LaTeX community. A full list of
|
|
% contributors can be found at
|
|
%
|
|
% https://github.com/matze/mtheme/graphs/contributors
|
|
%
|
|
% and the original template was based on the HSRM theme by Benjamin Weiss.
|
|
%
|
|
% This work is licensed under a Creative Commons Attribution-ShareAlike 4.0
|
|
% International License (https://creativecommons.org/licenses/by-sa/4.0/).
|
|
% ------------------------------------------------------------------------- \fi
|
|
% \iffalse
|
|
%<driver> \ProvidesFile{beamerinnerthememetropolis.dtx}
|
|
%<*package>
|
|
\NeedsTeXFormat{LaTeX2e}
|
|
\ProvidesPackage{beamerinnerthememetropolis}
|
|
[2015/06/12 A Modern Beamer Theme]
|
|
%</package>
|
|
%<driver> \documentclass{ltxdoc}
|
|
%<driver> \usepackage{beamerinnerthememetropolis}
|
|
%<driver> \begin{document}
|
|
%<driver> \DocInput{beamerinnerthememetropolis.dtx}
|
|
%<driver> \end{document}
|
|
% \fi
|
|
% \CheckSum{0}
|
|
% \StopEventually{}
|
|
% \iffalse
|
|
%<*package>
|
|
% ------------------------------------------------------------------------- \fi
|
|
% \section{Implementation: \textsc{metropolis} inner theme}
|
|
%
|
|
% A |beamer| inner theme dictates the style of the frame elements traditionally
|
|
% set in the ``body'' of each slide. These include:
|
|
% \begin{itemize}
|
|
% \item title, part, and section pages;
|
|
% \item itemize, enumerate, and description environments;
|
|
% \item block environments including theorems and proofs;
|
|
% \item figures and tables; and
|
|
% \item footnotes and plain text.
|
|
% \end{itemize}
|
|
%
|
|
%
|
|
%
|
|
% \subsection{Title page}
|
|
%
|
|
% \begin{macro}{title page}
|
|
% Template for the title page.
|
|
%
|
|
% \begin{macrocode}
|
|
\setbeamertemplate{title page}{
|
|
\begin{minipage}[b][\paperheight]{\textwidth}
|
|
\vspace*{\@mtheme@voffset}
|
|
% \end{macrocode}
|
|
%
|
|
% 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%
|
|
% \end{macrocode}
|
|
%
|
|
% We set the title and subtitle, but only if they are defined by the user.
|
|
% 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}%
|
|
\mthemetitleformat{\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
|
|
% 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{{%
|
|
\usebeamerfont{author}%
|
|
\usebeamercolor[fg]{author}%
|
|
\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
|
|
\vspace*{\@mtheme@voffset}
|
|
\end{minipage}
|
|
}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% Normal people should use |\maketitle| or |\titlepage| instead of using the
|
|
% |title page| beamer template directly. Beamer already defines these macros,
|
|
% but we patch them here to make the title page |[plain]| by default, remove
|
|
% |\@thanks|, and ensure the title frame number doesn't count.
|
|
%
|
|
% \begin{macro}{\maketitle}
|
|
% \begin{macro}{\titlepage}
|
|
% Inserts the title frame, or causes the current frame to use the
|
|
% |title page| template.
|
|
% \begin{macrocode}
|
|
\def\maketitle{%
|
|
\ifbeamer@inframe
|
|
\titlepage
|
|
\else
|
|
\frame[plain]{\titlepage}
|
|
\fi
|
|
}
|
|
\def\titlepage{%
|
|
\usebeamertemplate{title page}
|
|
}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
% \end{macro}
|
|
%
|
|
%
|
|
%
|
|
% \subsection{Section page}
|
|
%
|
|
% \begin{macro}{section page}
|
|
% Template for the section title slide at the beginning of each section.
|
|
% \begin{macrocode}
|
|
\setbeamertemplate{section page}{
|
|
\vspace{2em}
|
|
\centering
|
|
\begin{minipage}{22em}
|
|
\usebeamercolor[fg]{section title}
|
|
\usebeamerfont{section title}
|
|
\insertsectionHEAD\\[-1ex]
|
|
\usebeamertemplate*{progress bar in section page}
|
|
\end{minipage}
|
|
\par
|
|
}
|
|
\if@noSectionSlide\else%
|
|
\AtBeginSection{
|
|
\ifbeamer@inframe
|
|
\sectionpage
|
|
\else
|
|
\frame[plain,c]{\sectionpage}
|
|
\fi
|
|
}
|
|
\fi
|
|
% \end{macrocode}
|
|
%
|
|
% To give users the option to \MakeUppercase or \MakeLowercase the section
|
|
% title, we need to expand |\insertsectionhead| before applying the relevant
|
|
% formatting command. This solution was suggested by Enrico Gregorio in an
|
|
% answer to \href{http://tex.stackexchange.com/questions/112526/}{this
|
|
% StackExchange question}.
|
|
%
|
|
% \begin{macrocode}
|
|
\newcommand{\insertsectionHEAD}{\expandafter\formatsectionhead\insertsectionhead}
|
|
\newcommand{\formatsectionhead}[3]{#1{#2}{\mthemetitleformat{#3}}}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macro}{progress bar in section page}
|
|
% Template for the progress bar displayed by default on the section page.
|
|
% \begin{macrocode}
|
|
\RequirePackage{calc}
|
|
\newlength{\metropolis@progressonsectionpage}
|
|
\setbeamertemplate{progress bar in section page}{
|
|
\setlength{\metropolis@progressonsectionpage}{%
|
|
\textwidth * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}%
|
|
}%
|
|
\begin{tikzpicture}[tight background]
|
|
\usebeamercolor{progress bar}
|
|
\draw[bg, fill=bg] (0,0) rectangle (\textwidth, 0.4pt);
|
|
\draw[fg, fill=fg] (0,0) rectangle (\metropolis@progressonsectionpage, 0.4pt);
|
|
\end{tikzpicture}%
|
|
}
|
|
% \end{macrocode}
|
|
%
|
|
% The above code assumes that |\insertframenumber| is less than or equal to
|
|
% |\inserttotalframenumber|. However, this is not true on the first compile;
|
|
% in the absence of an |.aux| file, |\inserttotalframenumber| defaults to 1.
|
|
% This behaviour could cause fatal errors for long presentations, as
|
|
% |\metropolis@progressonsectionpage| would exceed \TeX's maximum length
|
|
% (16383.99999pt, roughly 5.75 metres or 18.9 feet).
|
|
% To avoid this, we increase the default value for |\inserttotalframenumber|;
|
|
% presentations with over 4000 slides will still break on first compile, but
|
|
% users in that situation likely have deeper problems to solve.
|
|
%
|
|
% \begin{macrocode}
|
|
\def\inserttotalframenumber{100}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
%
|
|
%
|
|
% \subsection{Block environments}
|
|
%
|
|
% \begin{macrocode}
|
|
\newlength{\leftrightskip}
|
|
\if@beamer@metropolis@blockbg
|
|
\setlength{\leftrightskip}{1ex}
|
|
\else
|
|
\setlength{\leftrightskip}{0ex}
|
|
\fi
|
|
\setbeamertemplate{block begin}{%
|
|
\vspace*{1ex}
|
|
\begin{beamercolorbox}[%
|
|
ht=2.4ex,
|
|
dp=1ex,
|
|
leftskip=\leftrightskip,
|
|
rightskip=\leftrightskip]{block title}
|
|
\usebeamerfont*{block title}\insertblocktitle%
|
|
\end{beamercolorbox}%
|
|
\vspace*{-1pt}
|
|
\usebeamerfont{block body}%
|
|
\begin{beamercolorbox}[%
|
|
dp=1ex,
|
|
leftskip=\leftrightskip,
|
|
rightskip=\leftrightskip,
|
|
vmode]{block body}%
|
|
}
|
|
\setbeamertemplate{block end}{%
|
|
\end{beamercolorbox}
|
|
\vspace*{0.2ex}
|
|
}
|
|
% \end{macrocode}
|
|
%
|
|
% Alerted block environment
|
|
%
|
|
% \begin{macrocode}
|
|
\setbeamertemplate{block alerted begin}{%
|
|
\vspace*{1ex}
|
|
\begin{beamercolorbox}[%
|
|
ht=2.4ex,
|
|
dp=1ex,
|
|
leftskip=\leftrightskip,
|
|
rightskip=\leftrightskip]{block title alerted}
|
|
\usebeamerfont*{block title alerted}\insertblocktitle%
|
|
\end{beamercolorbox}%
|
|
\vspace*{-1pt}
|
|
\usebeamerfont{block body alerted}%
|
|
\begin{beamercolorbox}[%
|
|
dp=1ex,
|
|
leftskip=\leftrightskip,
|
|
rightskip=\leftrightskip,
|
|
vmode]{block body}%
|
|
}
|
|
\setbeamertemplate{block alerted end}{%
|
|
\end{beamercolorbox}
|
|
\vspace*{0.2ex}
|
|
}
|
|
% \end{macrocode}
|
|
%
|
|
% Example block environment
|
|
%
|
|
% \begin{macrocode}
|
|
\setbeamertemplate{block example begin}{%
|
|
\vspace*{1ex}
|
|
\begin{beamercolorbox}[%
|
|
ht=2.4ex,
|
|
dp=1ex,
|
|
leftskip=\leftrightskip,
|
|
rightskip=\leftrightskip]{block title example}
|
|
\usebeamerfont*{block title example}\insertblocktitle%
|
|
\end{beamercolorbox}%
|
|
\vspace*{-1pt}
|
|
\usebeamerfont{block body example}%
|
|
\begin{beamercolorbox}[%
|
|
dp=1ex,
|
|
leftskip=\leftrightskip,
|
|
rightskip=\leftrightskip,
|
|
vmode]{block body}%
|
|
}
|
|
\setbeamertemplate{block example end}{%
|
|
\end{beamercolorbox}
|
|
\vspace*{0.2ex}
|
|
}
|
|
% \end{macrocode}
|
|
%
|
|
%
|
|
%
|
|
% \subsection{Itemize/enumerate environments}
|
|
% \begin{macrocode}
|
|
\setlength{\leftmargini}{1em}
|
|
\setlength{\leftmarginii}{1em}
|
|
\setlength{\leftmarginiii}{1em}
|
|
\setbeamertemplate{itemize item}{\textbullet}
|
|
\setbeamertemplate{itemize subitem}{\textbullet}
|
|
\setbeamertemplate{itemize subsubitem}{\textbullet}
|
|
% \end{macrocode}
|
|
%
|
|
% \subsection{Figures and tables}
|
|
% \begin{macrocode}
|
|
\setbeamertemplate{caption label separator}{: }
|
|
\setbeamertemplate{caption}[numbered]
|
|
% \end{macrocode}
|
|
%
|
|
% \subsection{Footnotes}
|
|
% \begin{macrocode}
|
|
\setbeamertemplate{footnote}{%
|
|
\parindent 0em\noindent%
|
|
\raggedright
|
|
\usebeamercolor{footnote}\hbox to 0.8em{\hfil\insertfootnotemark}\insertfootnotetext\par%
|
|
}
|
|
% \end{macrocode}
|
|
%
|
|
% \subsection{General text}
|
|
% \begin{macrocode}
|
|
\mode<all>
|
|
\setlength{\parskip}{0.5em}
|
|
\linespread{1.15}
|
|
% \end{macrocode}
|
|
% \iffalse
|
|
%</package>
|
|
% \fi
|
|
% \Finale
|
|
\endinput
|