1
0
mirror of https://github.com/matze/mtheme.git synced 2024-07-01 08:10:52 +02:00
metropolis_theme/beamerthemem.dtx

233 lines
6.2 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
2015-06-16 09:00:53 +02:00
%<driver> \ProvidesFile{beamerthemem.dtx}
2015-06-14 20:11:54 +02:00
%<*package>
2015-06-16 09:00:53 +02:00
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{beamerthemem}
2015-06-16 17:14:05 +02:00
[2015/06/12 A Modern Beamer Theme]
2015-06-14 20:11:54 +02:00
%</package>
2015-06-16 09:00:53 +02:00
%<driver> \documentclass{ltxdoc}
%<driver> \usepackage{beamerthemem}
%<driver> \begin{document}
%<driver> \DocInput{beamerthemem.dtx}
%<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 07:24:49 +02:00
% \section{Implementation: \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
%
%
% Options
%
% \begin{macrocode}
\newif\if@useTitleProgressBar
\@useTitleProgressBarfalse
\DeclareOptionBeamer{usetitleprogressbar}{
\@useTitleProgressBartrue
}
2015-06-14 20:11:54 +02:00
% \end{macrocode}
%
% usetotalslideindicator
%
% \begin{macrocode}
\newif\if@useTotalSlideIndicator
\@useTotalSlideIndicatorfalse
\DeclareOptionBeamer{usetotalslideindicator}{
\@useTotalSlideIndicatortrue
}
2015-06-14 20:11:54 +02:00
% \end{macrocode}
%
% noslidenumbers
%
% \begin{macrocode}
\newif\if@noSlideNumbers
\@noSlideNumbersfalse
\DeclareOptionBeamer{noslidenumbers}{
\@noSlideNumberstrue
}
2015-06-14 20:11:54 +02:00
% \end{macrocode}
%
% nosectionslide
%
% \begin{macrocode}
\newif\if@noSectionSlide
\@noSectionSlidefalse
\DeclareOptionBeamer{nosectionslide}{
\@noSectionSlidetrue
}
2015-06-14 20:11:54 +02:00
% \end{macrocode}
%
% nooffset
%
% \begin{macrocode}
\newlength{\@mtheme@voffset}
\setlength{\@mtheme@voffset}{2em}
\DeclareOptionBeamer{nooffset}{
\setlength{\@mtheme@voffset}{0em}
}
2015-06-14 20:11:54 +02:00
% \end{macrocode}
%
% blockbg
%
% \begin{macrocode}
2015-06-22 07:24:49 +02:00
\newif\if@beamer@metropolis@blockbg
\@beamer@metropolis@blockbgfalse
\DeclareOptionBeamer{blockbg}{
2015-06-22 07:24:49 +02:00
\@beamer@metropolis@blockbgtrue
}
2015-06-14 20:11:54 +02:00
% \end{macrocode}
%
2015-06-15 13:44:06 +02:00
% darkcolors
%
% \begin{macrocode}
\DeclareOptionBeamer{darkcolors}{
\PassOptionsToPackage{darkcolors}{beamercolorthememetropolis}%
}
% \end{macrocode}
%
2015-06-14 20:11:54 +02:00
% Unknown option error handling
%
% \begin{macrocode}
\DeclareOptionBeamer*{
\PackageWarning{beamerthemem}{Unknown option `\CurrentOption'}%
}
\ProcessOptionsBeamer
2015-06-14 20:11:54 +02:00
% \end{macrocode}
%
2015-06-22 07:24:49 +02:00
% \subsection{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}
2015-06-14 20:11:54 +02:00
% \end{macrocode}
%
2015-06-22 07:24:49 +02:00
% The |fira| font theme, which depends on |fontspec|, is only loaded if the
% document is being processed by Xe\LaTeX{} or Lua\LaTeX{}.
2015-06-14 20:11:54 +02:00
%
% \begin{macrocode}
\RequirePackage{etoolbox}
\RequirePackage{ifxetex,ifluatex}
2015-06-22 07:24:49 +02:00
\ifboolexpr{bool {xetex} or bool {luatex}}{
\usefonttheme{metropolis}
2015-06-22 07:24:49 +02:00
}{
\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}
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 07:24:49 +02:00
% \subsection{Custom commands}
%
% We define custom commands in this package as their proper usage may depend
% on multiple sub-packages.
%
% \begin{macro}{\mthemetitleformat}
% \begin{macro}{\mthemesectiontitleformat}
% \begin{macro}{\mthemeframetitleformat}
% \begin{macro}{\mthemeplaintitleformat}
% Creates hooks to change the case format of the four different titles.
% \begin{macrocode}
\def\mthemetitleformat#1{\MakeLowercase{#1}}
\def\mthemesectiontitleformat#1{\mthemetitleformat{#1}}
\def\mthemeframetitleformat#1{\mthemetitleformat{#1}}
\def\mthemeplaintitleformat#1{\mthemetitleformat{#1}}
% \end{macrocode}
%
% To give users the option to |\MakeUppercase| or |\MakeLowercase| the
% section title and frame title we need to patch the commands
% |\sectionentry|, |\beamer@section| and |\beamer@@frametitle|. This
% solution was suggested by Enrico Gregorio in an answer to
% \href{http://tex.stackexchange.com/questions/112526/}{this StackExchange
% question}.
%
% \begin{macrocode}
\patchcmd{\sectionentry}
{\def\insertsectionhead{#2}}
{\def\insertsectionhead{\mthemesectiontitleformat{#2}}}
{}{}
\patchcmd{\beamer@section}
{\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{#1}}}
{\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{\mthemesectiontitleformat{#1}}}}
{}{}
\patchcmd{\beamer@@frametitle}
{\beamer@ifempty{#2}{}{%
\gdef\insertframetitle{{#2\ifnum\beamer@autobreakcount>0\relax{}\space\usebeamertemplate*{frametitle continuation}\fi}}%
\gdef\beamer@frametitle{#2}%
\gdef\beamer@shortframetitle{#1}%
}}
{\beamer@ifempty{#2}{}{%
\gdef\insertframetitle{{\mthemeframetitleformat{#2}\ifnum\beamer@autobreakcount>0\relax{}\space\usebeamertemplate*{frametitle continuation}\fi}}%
\gdef\beamer@frametitle{#2}%
\gdef\beamer@shortframetitle{#1}%
}}
{}{}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \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-10 17:32:27 +02:00
\setbeamercolor{background canvas}{use=palette primary,parent=palette primary}
\begin{frame}{#1}
\centering
\vfill
\vspace{1em}
2015-06-10 17:32:27 +02:00
\usebeamercolor[fg]{palette primary}
\usebeamerfont{section title}
\mthemeplaintitleformat{#2}
\vfill
\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}
%
% \iffalse
%</package>
% \fi
% \Finale
\endinput