metropolis_theme/source/beamerthememetropolis.dtx

220 lines
5.9 KiB
Plaintext
Raw Normal View History

2015-06-16 08:13:19 +02:00
% \iffalse meta-comment -------------------------------------------------------
% Copyright 2015 Matthias Vogelgesang and the LaTeX community. A full list of
% contributors can be found at
2014-09-19 22:52:31 +02:00
%
2015-06-16 08:13:19 +02:00
% https://github.com/matze/mtheme/graphs/contributors
2014-09-19 22:52:31 +02:00
%
2015-06-16 08:13:19 +02:00
% and the original template was based on the HSRM theme by Benjamin Weiss.
2015-06-14 20:11:54 +02:00
%
2015-06-16 08:13:19 +02:00
% This work is licensed under a Creative Commons Attribution-ShareAlike 4.0
% International License (https://creativecommons.org/licenses/by-sa/4.0/).
% ------------------------------------------------------------------------- \fi
2015-06-14 20:11:54 +02:00
% \iffalse
%<driver> \ProvidesFile{beamerthememetropolis.dtx}
2015-06-14 20:11:54 +02:00
%<*package>
2015-06-16 09:00:53 +02:00
\NeedsTeXFormat{LaTeX2e}
2015-12-04 15:42:27 +01:00
\ProvidesPackage{beamerthememetropolis}[2015/12/04 Metropolis Beamer theme]
2015-06-14 20:11:54 +02:00
%</package>
2015-06-16 09:00:53 +02:00
%<driver> \documentclass{ltxdoc}
%<driver> \usepackage{beamerthememetropolis}
2015-06-16 09:00:53 +02:00
%<driver> \begin{document}
%<driver> \DocInput{beamerthememetropolis.dtx}
2015-06-16 09:00:53 +02:00
%<driver> \end{document}
2015-06-14 20:11:54 +02:00
% \fi
% \CheckSum{0}
% \StopEventually{}
% \iffalse
%<*package>
2015-06-16 09:00:53 +02:00
% ------------------------------------------------------------------------- \fi
2015-06-22 23:43:52 +02:00
%
% \subsection{\textsc{metropolis} main theme}
2015-06-16 09:00:53 +02:00
%
2015-06-22 07:24:49 +02:00
% The primary job of this package is to load the component sub-packages of the
% \textsc{metropolis} theme and route the theme options accordingly. It also
% provides some custom commands and environments for the user.
2015-06-14 20:11:54 +02:00
%
2015-06-22 23:43:52 +02:00
% Load the required packages.
2015-06-14 20:11:54 +02:00
% \begin{macrocode}
2015-06-22 23:43:52 +02:00
\RequirePackage{etoolbox}
\RequirePackage{pgfopts}
2015-06-14 20:11:54 +02:00
% \end{macrocode}
%
% \subsubsection{Options}
2015-06-14 20:11:54 +02:00
%
% \begin{macro}{\metroset}
2015-06-22 23:43:52 +02:00
% First of all we define a macro for the user to set options.
2015-06-14 20:11:54 +02:00
% \begin{macrocode}
\newcommand{\metroset}[1]{\pgfkeys{/metropolis/.cd,#1}}
2015-06-14 20:11:54 +02:00
% \end{macrocode}
2015-06-22 23:43:52 +02:00
% \end{macro}
2015-06-14 20:11:54 +02:00
%
2015-06-22 23:43:52 +02:00
% Then we need to pass the unknown options to the sub-packages.
2015-06-14 20:11:54 +02:00
%
% \begin{macrocode}
2015-06-22 23:43:52 +02:00
\pgfkeys{/metropolis/.cd,
.search also={
/metropolis/inner,
/metropolis/outer,
/metropolis/color,
},
2015-06-14 20:11:54 +02:00
% \end{macrocode}
%
2015-06-22 23:43:52 +02:00
% We have to forwarded keys that affect multiple sub-packages manually.
2015-06-14 20:11:54 +02:00
%
% \begin{macrocode}
2015-06-22 23:43:52 +02:00
block/.code=\pgfkeysalso{
inner/block=#1,
color/block=#1,
},
}
2015-06-14 20:11:54 +02:00
% \end{macrocode}
%
2015-12-03 20:53:25 +01:00
% \begin{macro}{titleformat plain}
% Control the titleformat of the plain title
% \begin{macrocode}
\pgfkeys{
2015-12-03 20:53:25 +01:00
/metropolis/titleformat plain/.cd,
.is choice,
2015-12-03 20:53:25 +01:00
regular/.code={%
\let\@metropolis@plaintitleformat\@empty%
\setbeamerfont{plain title}{shape=\normalfont}%
},
2015-12-03 20:53:25 +01:00
smallcaps/.code={%
\let\@metropolis@plaintitleformat\@empty%
\setbeamerfont{plain title}{shape=\scshape}%
},
allsmallcaps/.code={%
\let\@metropolis@plaintitleformat\MakeLowercase%
\setbeamerfont{plain title}{shape=\scshape}%
\PackageWarning{beamerthememetropolis}{%
Be aware that titleformat plain=allsmallcaps can lead to problems%
}
},
allcaps/.code={%
\let\@metropolis@plaintitleformat\MakeUppercase%
\setbeamerfont{plain title}{shape=\normalfont}%
\PackageWarning{beamerthememetropolis}{%
Be aware that titleformat plain=allcaps can lead to problems%
}
},
}
% \end{macrocode}
% \end{macro}
%
2015-12-03 20:53:25 +01:00
% \begin{macro}{titleformat}
% Control the titleformat of every title type together
% \begin{macrocode}
\pgfkeys{
2015-12-03 20:53:25 +01:00
/metropolis/titleformat/.code=\pgfkeysalso{
inner/titleformat title=#1,
inner/titleformat subtitle=#1,
inner/titleformat section=#1,
outer/titleformat frame=#1,
titleformat plain=#1,
}
}
% \end{macrocode}
% \end{macro}
%
2015-06-22 23:43:52 +02:00
% For backwards compatibility with earlier betas of the theme, we implement
% deprecated option names as aliases to the corresponding |key=value| options.
2015-06-14 20:11:54 +02:00
%
% \begin{macrocode}
2015-06-22 23:43:52 +02:00
\pgfkeys{/metropolis/.cd,
usetitleprogressbar/.code=\pgfkeysalso{outer/progressbar=frametitle},
2015-06-22 23:43:52 +02:00
noslidenumbers/.code=\pgfkeysalso{outer/numbering=none},
usetotalslideindicator/.code=\pgfkeysalso{outer/numbering=fraction},
nosectionslide/.code=\pgfkeysalso{inner/sectionpage=none},
darkcolors/.code=\pgfkeysalso{color/background=dark},
blockbg/.code=\pgfkeysalso{color/block=fill, inner/block=fill},
}
2015-06-14 20:11:54 +02:00
% \end{macrocode}
%
2015-06-22 23:43:52 +02:00
% Set default values for options.
2015-06-15 13:44:06 +02:00
%
% \begin{macrocode}
2015-06-22 23:43:52 +02:00
\newcommand{\@metropolis@setdefaults}{
\pgfkeys{/metropolis/.cd,
2015-12-03 20:53:25 +01:00
titleformat plain=regular,
2015-06-22 23:43:52 +02:00
}
2015-06-15 13:44:06 +02:00
}
% \end{macrocode}
%
2015-06-14 20:11:54 +02:00
%
%
% \subsubsection{Component sub-packages}
2015-06-14 20:11:54 +02:00
%
2015-06-22 07:24:49 +02:00
% Having processed the options, we can now load the component sub-packages of
% the theme.
2015-06-14 20:11:54 +02:00
% \begin{macrocode}
2015-06-22 07:24:49 +02:00
\useinnertheme{metropolis}
\useoutertheme{metropolis}
\usecolortheme{metropolis}
\usefonttheme{metropolis}
2015-06-22 07:24:49 +02:00
% \end{macrocode}
%
% The |tol| theme for |pgfplots| is only loaded if |pgfplots| is used.
%
% \begin{macrocode}
2015-06-17 08:05:14 +02:00
\AtEndPreamble{%
\@ifpackageloaded{pgfplots}{%
\RequirePackage{pgfplotsthemetol}
}{}
}
2015-06-14 20:11:54 +02:00
% \end{macrocode}
%
2015-06-22 23:43:52 +02:00
%
%
% \subsubsection{Custom commands}
2015-06-22 07:24:49 +02:00
%
% We define custom commands in this package as their proper usage may depend
% on multiple sub-packages.
%
2015-06-22 23:43:52 +02:00
% \begin{macro}{\@metropolis@plaintitleformat}
% Define a hook to change the case format of the plain title.
% \begin{macrocode}
\def\@metropolis@plaintitleformat#1{#1}
% \end{macrocode}
% \end{macro}
2015-06-14 20:11:54 +02:00
%
% \begin{macro}{\plain}
2015-06-22 07:24:49 +02:00
% Creates a plain frame with dark background, suitable for displaying images
% or a few words.
2015-06-14 20:11:54 +02:00
% \begin{macrocode}
2014-10-09 15:10:47 +02:00
\newcommand{\plain}[2][]{%
\begingroup
2015-06-23 09:13:46 +02:00
\setbeamercolor{background canvas}{
use=palette primary,
parent=palette primary
}
2015-07-10 03:32:09 +02:00
\begin{frame}[c]{#1}
\begin{center}
\usebeamercolor[fg]{palette primary}
2015-12-03 20:53:25 +01:00
\usebeamerfont{plain title}
\@metropolis@plaintitleformat{#2}
\end{center}
\end{frame}
\endgroup
}
2015-06-14 20:11:54 +02:00
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\mreducelistspacing}
% \begin{macrocode}
2014-10-27 14:40:44 +01:00
\newcommand{\mreducelistspacing}{\vspace{-\topsep}}
2015-06-14 20:11:54 +02:00
% \end{macrocode}
% \end{macro}
%
2015-06-22 23:43:52 +02:00
% Process package options
%
% \begin{macrocode}
\@metropolis@setdefaults
\ProcessPgfOptions{/metropolis}
% \end{macrocode}
%
2015-06-14 20:11:54 +02:00
% \iffalse
%</package>
% \fi
% \Finale
\endinput