summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/beamer-contrib/themes/metropolis/source/beamerthememetropolis.dtx
blob: 6482f5211792c6d76b1818522de0d4e1ba567b47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
% \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
%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{beamerthememetropolis}
  [2017/01/23 v1.2 Metropolis Beamer theme]
%</package>
% \fi
% \CheckSum{0}
% \StopEventually{}
% \iffalse
%<*package>
% ------------------------------------------------------------------------- \fi
%
% \subsection{\themename parent theme}
%
% The primary job of this package is to load the component sub-packages of the
% \themename theme and route the theme options accordingly. It also
% provides some custom commands and environments for the user.
%
%
%
% \subsubsection{Package dependencies}
%
%    \begin{macrocode}
\RequirePackage{etoolbox}
\RequirePackage{pgfopts}
%    \end{macrocode}
%
%
%
% \subsubsection{Options}
%
% Most options are passed off to the component sub-packages.
%
%    \begin{macrocode}
\pgfkeys{/metropolis/.cd,
  .search also={
    /metropolis/inner,
    /metropolis/outer,
    /metropolis/color,
    /metropolis/font,
  }
}
%    \end{macrocode}
%
% \begin{macro}{titleformat plain}
%    Controls the formatting of the text on standout ``plain'' frames.
%    \begin{macrocode}
\pgfkeys{
  /metropolis/titleformat plain/.cd,
    .is choice,
    regular/.code={%
      \let\metropolis@plaintitleformat\@empty%
      \setbeamerfont{standout}{shape=\normalfont}%
    },
    smallcaps/.code={%
      \let\metropolis@plaintitleformat\@empty%
      \setbeamerfont{standout}{shape=\scshape}%
    },
    allsmallcaps/.code={%
      \let\metropolis@plaintitleformat\MakeLowercase%
      \setbeamerfont{standout}{shape=\scshape}%
      \PackageWarning{beamerthememetropolis}{%
        Be aware that titleformat plain=allsmallcaps can lead to problems%
      }
    },
    allcaps/.code={%
      \let\metropolis@plaintitleformat\MakeUppercase%
      \setbeamerfont{standout}{shape=\normalfont}%
      \PackageWarning{beamerthememetropolis}{%
        Be aware that titleformat plain=allcaps can lead to problems%
      }
    },
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{titleformat}
%    Sets a standard format for titles, subtitles, section titles, frame
%    titles, and the text on standout ``plain'' frames.
%    \begin{macrocode}
\pgfkeys{
  /metropolis/titleformat/.code=\pgfkeysalso{
      font/titleformat title=#1,
      font/titleformat subtitle=#1,
      font/titleformat section=#1,
      font/titleformat frame=#1,
      titleformat plain=#1,
    }
}
%    \end{macrocode}
% \end{macro}
%
% For backwards compatibility with earlier betas of the theme, we implement
% deprecated option names as aliases to the corresponding |key=value| options.
%
%    \begin{macrocode}
\pgfkeys{/metropolis/.cd,
  usetitleprogressbar/.code=\pgfkeysalso{outer/progressbar=frametitle},
  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},
}
%    \end{macrocode}
%
% Set default values for options.
%
%    \begin{macrocode}
\newcommand{\metropolis@setdefaults}{
  \pgfkeys{/metropolis/.cd,
    titleformat plain=regular,
  }
}
%    \end{macrocode}
%
%
%
% \subsubsection{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}
\usefonttheme{metropolis}
%    \end{macrocode}
%
% The |tol| theme for |pgfplots| is only loaded if |pgfplots| is used.
%
%    \begin{macrocode}
\AtEndPreamble{%
  \@ifpackageloaded{pgfplots}{%
    \RequirePackage{pgfplotsthemetol}
  }{}
}
%    \end{macrocode}
%
%
%
% \subsubsection{Custom commands}
%
% The parent theme defines custom commands as their proper usage may depend
% on multiple sub-packages.
%
% \begin{macro}{\metroset}
%    Allows the user to change options midway through a presentation.
%    \begin{macrocode}
\newcommand{\metroset}[1]{\pgfkeys{/metropolis/.cd,#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\plain}
%   Creates a plain frame with dark background, suitable for displaying images
%   or a few words. The format of the text can be set with the
%   |titleformat plain| option.
%    \begin{macrocode}
\def\metropolis@plaintitleformat#1{#1}
\newcommand{\plain}[2][]{%
  \PackageWarning{beamerthememetropolis}{%
    The syntax `\plain' may be deprecated in a future version of Metropolis.
    Please use a frame with [standout] instead.
  }
  \begin{frame}[standout]{#1}
    \metropolis@plaintitleformat{#2}
  \end{frame}
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\mreducelistspacing}
%    \begin{macrocode}
\newcommand{\mreducelistspacing}{\vspace{-\topsep}}
%    \end{macrocode}
% \end{macro}
%
%
%
% \subsubsection{Process package options}
%
%    \begin{macrocode}
\metropolis@setdefaults
\ProcessPgfOptions{/metropolis}
%    \end{macrocode}
%
% \iffalse
%</package>
% \fi
% \Finale
\endinput