From 15bcda7c371d517466aa409ccb5efbfbde4f9ece Mon Sep 17 00:00:00 2001 From: Ross Churchley Date: Sun, 21 Jun 2015 22:24:49 -0700 Subject: [PATCH] Minor rearrangements and documentation --- beamercolorthememetropolis.dtx | 70 +++++++++++++++++++++------------ beamerinnerthememetropolis.dtx | 18 ++++++--- beamerouterthememetropolis.dtx | 7 ++++ beamerthemem.dtx | 72 ++++++++++++++++------------------ demo.tex | 1 + 5 files changed, 99 insertions(+), 69 deletions(-) diff --git a/beamercolorthememetropolis.dtx b/beamercolorthememetropolis.dtx index 4f0eaad..98d6bbf 100644 --- a/beamercolorthememetropolis.dtx +++ b/beamercolorthememetropolis.dtx @@ -30,13 +30,6 @@ % \section{Implementation: \textsc{metropolis} color theme} % Options % -% \begin{macrocode} -\newif\if@beamer@metropolis@blockbg -\@beamer@metropolis@blockbgfalse -\DeclareOptionBeamer{blockbg}{ - \@beamer@metropolis@blockbgtrue -} -% \end{macrocode} % % darkcolors % @@ -57,7 +50,9 @@ \ProcessOptionsBeamer % \end{macrocode} % -% Colors +% +% +% \subsection{Base colors} % % \begin{macrocode} \definecolor{mDarkBrown}{HTML}{604c38} @@ -66,7 +61,12 @@ \definecolor{mLightGreen}{HTML}{14B03D} % \end{macrocode} % -% Base Colors +% +% +% \subsection{Base styles} +% +% All colors in the \textsc{metropolis} theme are derived from the definitions +% of |normal text|, |alerted text|, and |example text|. % % \begin{macrocode} \if@beamer@metropolis@darkcolors @@ -88,24 +88,33 @@ } % \end{macrocode} % -% Derived Colors % % \begin{macrocode} -\setbeamercolor{titlelike}{use=normal text, parent=normal text} +% \end{macrocode} +% +% +% +% \subsection{Derived colors} +% +% The titles and structural elements (e.g. |itemize| bullets) are set in the +% same color as |normal text|. This would ideally done by setting |normal text| +% as a parent style, which we do to set |titlelike|, but this doesn't work for +% |structure| as its foreground is set explicitly in +% |beamercolorthemedefault.sty|. +% +% \begin{macrocode} +\setbeamercolor{titlelike}{% + use=normal text, + parent=normal text +} \setbeamercolor{structure}{% fg=normal text.fg } % \end{macrocode} % -% Frame titles and plain slides -% -% \begin{macrocode} -\setbeamercolor{frametitle}{use=palette primary, parent=palette primary} -% \end{macrocode} -% % The “primary” palette should be used for the most important navigational -% elements, and possibly of other elements. -% The metropolis color theme uses it for frame titles and slides. +% elements, and possibly of other elements. The \textsc{metropolis} theme uses +% it for frame titles and slides. % % \begin{macrocode} \setbeamercolor{palette primary}{% @@ -113,11 +122,24 @@ fg=normal text.bg, bg=normal text.fg } +\setbeamercolor{frametitle}{% + use=palette primary, + parent=palette primary +} % \end{macrocode} % -% Progress bar and title separator +% The \textsc{metropolis} inner or outer themes optionally display progress +% bars in various locations. Their color is set by |progress bar| but the two +% different kinds can be customized separately. The horizontal rule on the title +% page is also set based on the progress bar color and can be customized with +% |title separator|. % % \begin{macrocode} +\setbeamercolor{progress bar}{% + use=alerted text, + fg=alerted text.fg, + bg=normal text.bg!50!normal text.fg +} \setbeamercolor{title separator}{ use=progress bar, parent=progress bar @@ -130,11 +152,6 @@ use=progress bar, parent=progress bar } -\setbeamercolor{progress bar}{% - use=alerted text, - fg=alerted text.fg, - bg=normal text.bg!50!normal text.fg -} % \end{macrocode} % % Blocks @@ -174,7 +191,8 @@ \setbeamercolor{footnote mark}{fg=.} \mode % \end{macrocode} - +% +% % % \iffalse % diff --git a/beamerinnerthememetropolis.dtx b/beamerinnerthememetropolis.dtx index 395427f..ed2d3dc 100644 --- a/beamerinnerthememetropolis.dtx +++ b/beamerinnerthememetropolis.dtx @@ -42,6 +42,14 @@ % % % +% This customization will be changed in a future update. +% +% \begin{macrocode} +\def\mthemetitleformat{\scshape\MakeLowercase} +% \end{macrocode} +% +% +% % \subsection{Title page} % % \begin{macro}{title page} @@ -49,9 +57,9 @@ % Template for the title page. % % \begin{macrocode} +\RequirePackage{tikz} \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 @@ -145,11 +153,11 @@ }} \fi \vfill - \vspace*{\@mtheme@voffset} + \vspace*{1mm} \end{minipage} } % \end{macrocode} -% \end{macro} +% \end{macro}% % % Normal people should use |\maketitle| or |\titlepage| instead of using the % |title page| beamer template directly. Beamer already defines these macros, @@ -215,8 +223,8 @@ % StackExchange question}. % % \begin{macrocode} -\newcommand{\insertsectionHEAD}{\expandafter\formatsectionhead\insertsectionhead} -\newcommand{\formatsectionhead}[3]{#1{#2}{\mthemetitleformat{#3}}} +\providecommand{\insertsectionHEAD}{\expandafter\formatsectionhead\insertsectionhead} +\providecommand{\formatsectionhead}[3]{#1{#2}{\mthemetitleformat{#3}}} % \end{macrocode} % \end{macro} % diff --git a/beamerouterthememetropolis.dtx b/beamerouterthememetropolis.dtx index 41da12d..452764d 100644 --- a/beamerouterthememetropolis.dtx +++ b/beamerouterthememetropolis.dtx @@ -34,6 +34,13 @@ % % % +% This customization will be removed in a future version. +% +% \begin{macrocode} +\def\mthemetitleformat{\scshape\MakeLowercase} +% \end{macrocode} +% +% % \subsection{Head and footline} % % All good |beamer| presentations should already remove the navigation symbols, diff --git a/beamerthemem.dtx b/beamerthemem.dtx index b081b59..8713094 100644 --- a/beamerthemem.dtx +++ b/beamerthemem.dtx @@ -27,7 +27,11 @@ % \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 @@ -93,8 +97,10 @@ % blockbg % % \begin{macrocode} +\newif\if@beamer@metropolis@blockbg +\@beamer@metropolis@blockbgfalse \DeclareOptionBeamer{blockbg}{ - \PassOptionsToPackage{blockbg}{beamercolorthememetropolis}% + \@beamer@metropolis@blockbgtrue } % \end{macrocode} % @@ -122,51 +128,51 @@ \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} -\mode +\useinnertheme{metropolis} +\useoutertheme{metropolis} +\usecolortheme{metropolis} % \end{macrocode} % -% Packages +% 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{tikz} -\RequirePackage{pgfplots} \RequirePackage{ifxetex,ifluatex} -\newif\ifxetexorluatex -\ifxetex - \xetexorluatextrue -\else - \ifluatex - \xetexorluatextrue - \else - \xetexorluatexfalse - \fi -\fi -\usetikzlibrary{backgrounds} -\usetikzlibrary{calc} -\usecolortheme{metropolis} -\ifxetexorluatex +\ifboolexpr{bool {xetex} or bool {luatex}}{ \usefonttheme{metropolis} -\else - \PackageWarning{beamerthemem}{You need to compile with XeLaTeX or LuaLaTeX for the Fira fonts.} -\fi - -\useinnertheme{metropolis}% -\useoutertheme{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} % -% Create a plain frame with dark background +% +% +% \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 @@ -185,16 +191,6 @@ % \end{macrocode} % \end{macro} % -% -% -% - -% -% -% -% misc -% -% % \begin{macro}{\mreducelistspacing} % \begin{macrocode} \newcommand{\mreducelistspacing}{\vspace{-\topsep}} diff --git a/demo.tex b/demo.tex index 4505302..79e7b41 100644 --- a/demo.tex +++ b/demo.tex @@ -6,6 +6,7 @@ \usepackage{booktabs} \usepackage[scale=2]{ccicons} +\usepackage{pgfplots} \usepgfplotslibrary{dateplot}