metropolis_theme/beamerthemem.dtx

205 lines
4.8 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{beamerthemem.dtx}
%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{beamerthemem}
[2015/06/12 A Modern Beamer Theme]
%</package>
%<driver> \documentclass{ltxdoc}
%<driver> \usepackage{beamerthemem}
%<driver> \begin{document}
%<driver> \DocInput{beamerthemem.dtx}
%<driver> \end{document}
% \fi
% \CheckSum{0}
% \StopEventually{}
% \iffalse
%<*package>
% ------------------------------------------------------------------------- \fi
% \section{Implementation: \textsc{metropolis} main theme}
%
% 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.
%
%
% Options
%
% \begin{macrocode}
\newif\if@useTitleProgressBar
\@useTitleProgressBarfalse
\DeclareOptionBeamer{usetitleprogressbar}{
\@useTitleProgressBartrue
}
% \end{macrocode}
%
% usetotalslideindicator
%
% \begin{macrocode}
\newif\if@useTotalSlideIndicator
\@useTotalSlideIndicatorfalse
\DeclareOptionBeamer{usetotalslideindicator}{
\@useTotalSlideIndicatortrue
}
% \end{macrocode}
%
% noslidenumbers
%
% \begin{macrocode}
\newif\if@noSlideNumbers
\@noSlideNumbersfalse
\DeclareOptionBeamer{noslidenumbers}{
\@noSlideNumberstrue
}
% \end{macrocode}
%
% nosectionslide
%
% \begin{macrocode}
\newif\if@noSectionSlide
\@noSectionSlidefalse
\DeclareOptionBeamer{nosectionslide}{
\@noSectionSlidetrue
}
% \end{macrocode}
%
% protectframetitle
%
% \begin{macrocode}
\newif\if@protectFrameTitle
\@protectFrameTitlefalse
\DeclareOptionBeamer{protectframetitle}{
\@protectFrameTitletrue
}
% \end{macrocode}
%
% nooffset
%
% \begin{macrocode}
\newlength{\@mtheme@voffset}
\setlength{\@mtheme@voffset}{2em}
\DeclareOptionBeamer{nooffset}{
\setlength{\@mtheme@voffset}{0em}
}
% \end{macrocode}
%
% blockbg
%
% \begin{macrocode}
\newif\if@beamer@metropolis@blockbg
\@beamer@metropolis@blockbgfalse
\DeclareOptionBeamer{blockbg}{
\@beamer@metropolis@blockbgtrue
}
% \end{macrocode}
%
% darkcolors
%
% \begin{macrocode}
\DeclareOptionBeamer{darkcolors}{
\PassOptionsToPackage{darkcolors}{beamercolorthememetropolis}%
}
% \end{macrocode}
%
% Unknown option error handling
%
% \begin{macrocode}
\DeclareOptionBeamer*{
\PackageWarning{beamerthemem}{Unknown option `\CurrentOption'}%
}
\ProcessOptionsBeamer
% \end{macrocode}
%
% mthemetitleformat
%
% \begin{macro}{\mthemetitleformat}
% \begin{macrocode}
\def\mthemetitleformat#1{\scshape #1}
% \end{macrocode}
% \end{macro}
% \subsection{Component sub-packages}
%
% Having processed the options, we can now load the component sub-packages of
% the theme.
% \begin{macrocode}
\useinnertheme{metropolis}
\useoutertheme{metropolis}
\usecolortheme{metropolis}
% \end{macrocode}
%
% The |fira| font theme, which depends on |fontspec|, is only loaded if the
% document is being processed by Xe\LaTeX{} or Lua\LaTeX{}.
%
% \begin{macrocode}
\RequirePackage{etoolbox}
\RequirePackage{ifxetex,ifluatex}
\ifboolexpr{bool {xetex} or bool {luatex}}{
\usefonttheme{metropolis}
}{
\PackageWarning{beamerthemem}{%
You need to compile with XeLaTeX or LuaLaTeX to use the Fira fonts.
}
}
% \end{macrocode}
%
% The |tol| theme for |pgfplots| is only loaded if |pgfplots| is used.
%
% \begin{macrocode}
\AtEndPreamble{%
\@ifpackageloaded{pgfplots}{%
\RequirePackage{pgfplotsthemetol}
}{}
}
% \end{macrocode}
%
%
%
% \subsection{Custom commands}
%
% We define custom commands in this package as their proper usage may depend
% depend on multiple sub-packages.
%
% \begin{macro}{\plain}
% Creates a plain frame with dark background, suitable for displaying images
% or a few words.
% \begin{macrocode}
\newcommand{\plain}[2][]{%
\begingroup
\setbeamercolor{background canvas}{use=palette primary,parent=palette primary}
\begin{frame}{#1}
\centering
\vfill
\vspace{1em}
\usebeamercolor[fg]{palette primary}
\usebeamerfont{section title}
\mthemetitleformat{#2}
\vfill
\end{frame}
\endgroup
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\mreducelistspacing}
% \begin{macrocode}
\newcommand{\mreducelistspacing}{\vspace{-\topsep}}
% \end{macrocode}
% \end{macro}
%
% \iffalse
%</package>
% \fi
% \Finale
\endinput