forked from matze/mtheme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbeamerouterthememetropolis.dtx
269 lines (269 loc) · 7.36 KB
/
beamerouterthememetropolis.dtx
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
% \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{beamerouterthememetropolis.dtx}
%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{beamerouterthememetropolis}
[2015/06/12 A Modern Beamer Theme]
%</package>
%<driver> \documentclass{ltxdoc}
%<driver> \usepackage{beamerouterthememetropolis}
%<driver> \begin{document}
%<driver> \DocInput{beamerouterthememetropolis.dtx}
%<driver> \end{document}
% \fi
% \CheckSum{0}
% \StopEventually{}
% \iffalse
%<*package>
% ------------------------------------------------------------------------- \fi
%
% \subsection{\textsc{metropolis} outer theme}
%
% A |beamer| outer theme dictates the style of the frame elements traditionally
% set outside the body of each slide: the head, footline, and frame title.
%
% Load required packages.
% \begin{macrocode}
\RequirePackage{etoolbox}
\RequirePackage{calc}
\RequirePackage{pgfopts}
% \end{macrocode}
%
%
%
% \subsubsection{Options}
%
% \begin{macro}{numbering}
% This option controls the page numbering.
% \begin{macrocode}
\pgfkeys{
/metropolis/outer/numbering/.cd,
.is choice,
none/.code=\setbeamertemplate{frame numbering}[none],
counter/.code=\setbeamertemplate{frame numbering}[counter],
fraction/.code=\setbeamertemplate{frame numbering}[fraction],
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{progressbar}
% This option controls the progressbar.
% \begin{macrocode}
\pgfkeys{
/metropolis/outer/progressbar/.cd,
.is choice,
none/.code=\setbeamertemplate{frametitle}[plain],
frametitle/.code=\setbeamertemplate{frametitle}[progressbar],
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{frametitleformat}
% Control the case style of the frame title
% \begin{macrocode}
\pgfkeys{
/metropolis/outer/frametitleformat/.cd,
.is choice,
regular/.code=\renewcommand{\@metropolis@frametitleformat}{},
lowercase/.code={%
\renewcommand{\@metropolis@frametitleformat}{\MakeLowercase}
},
uppercase/.code={%
\renewcommand{\@metropolis@frametitleformat}{\MakeUppercase}
},
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{frametitleoffset}
% This option controls the frame title offset.
% \begin{macrocode}
\pgfkeys{
/metropolis/outer/.cd,
frametitleoffset/.code=\setlength{\@metropolis@voffset}{#1},
noframetitleoffset/.code=\setlength{\@metropolis@voffset}{0em},
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@metropolis@outer@setdefaults}
% Set default values for outer theme options.
% \begin{macrocode}
\newcommand{\@metropolis@outer@setdefaults}{
\pgfkeys{/metropolis/outer/.cd,
numbering=counter,
progressbar=none,
frametitleformat=lowercase,
frametitleoffset=2em,
}
}
% \end{macrocode}%
% \end{macro}
%
%
%
% \subsubsection{Head and footline}
%
% All good |beamer| presentations should already remove the navigation symbols,
% but \textsc{metropolis} removes them automatically (just in case).
%
% \begin{macrocode}
\setbeamertemplate{navigation symbols}{}
% \end{macrocode}
%
% Template for the frame number. Can be omitted, shown or displayed as a
% fraction of the total frames.
%
% \begin{macrocode}
\defbeamertemplate{frame numbering}{none}{
% intentionally empty
}
\defbeamertemplate{frame numbering}{counter}{
\insertframenumber
}
\defbeamertemplate{frame numbering}{fraction}{
\insertframenumber/\inserttotalframenumber
}
% \end{macrocode}
%
% Define additional space between frame title and content. By default 2em.
%
% \begin{macrocode}
\newlength{\@metropolis@voffset}
% \end{macrocode}
%
% The only element in the footline by default is the frame number.
%
% \begin{macrocode}
\setbeamertemplate{footline}{%
\begin{beamercolorbox}[%
wd=\textwidth,
ht=3ex,
dp=3ex,
leftskip=0.3cm,
rightskip=0.3cm
]{footline}%
\hfill\usebeamerfont{page number in head/foot}%
\usebeamertemplate*{frame numbering}
\end{beamercolorbox}%
}
% \end{macrocode}
%
%
%
% \subsubsection{Frametitle}
%
% \begin{macro}{\@metropolis@frametitleformat}
% Define a hook to change the case format of the frame title.
% \begin{macrocode}
\def\@metropolis@frametitleformat#1{#1}
% \end{macrocode}
% \end{macro}
%
% To make the |\MakeLowercase| and |\MakeUppercase| macros work in the
% frame title we have to patch |\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{\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{{\@metropolis@frametitleformat{#2}\ifnum\beamer@autobreakcount>0\relax{}\space\usebeamertemplate*{frametitle continuation}\fi}}%
\gdef\beamer@frametitle{#2}%
\gdef\beamer@shortframetitle{#1}%
}}
{}
{\PackageError{beamerouterthememetropolis}{Patching frame title failed.}}
% \end{macrocode}
%
% \begin{macro}{frametitle}
%
% Templates for the frame title, which is optionally underlined with a
% progress bar.
%
% \begin{macrocode}
\defbeamertemplate{frametitle}{plain}{%
\nointerlineskip
\begin{beamercolorbox}[%
wd=\paperwidth,
leftskip=0.3cm,
rightskip=0.3cm,
ht=2.5ex,
dp=1.5ex
]{frametitle}
\insertframetitle%
\end{beamercolorbox}%
\vspace{\@metropolis@voffset}
}
\defbeamertemplate{frametitle}{progressbar}{%
\nointerlineskip
\begin{beamercolorbox}[%
wd=\paperwidth,
leftskip=0.3cm,
rightskip=0.3cm,
ht=2.5ex,
dp=1.5ex
]{frametitle}
\insertframetitle%
\end{beamercolorbox}%
\usebeamertemplate*{progress bar in head/foot}
\vspace{\@metropolis@voffset}
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{progress bar in head/foot}
%
% Template for the progress bar optionally displayed below the frame title
% on each page. Much of this code is duplicated in the inner theme's template
% |progress bar in section page|.
%
% \begin{macrocode}
\newlength{\metropolis@progressinheadfoot}
\setbeamertemplate{progress bar in head/foot}{
\nointerlineskip
\setlength{\metropolis@progressinheadfoot}{%
\paperwidth * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}%
}%
\begin{beamercolorbox}[
wd=\paperwidth,
ht=0.4pt,
dp=0pt]{progress bar in head/foot}
\begin{tikzpicture}
\draw[bg, fill=bg] (0,0) rectangle (\paperwidth, 0.4pt);
\draw[fg, fill=fg] (0,0) rectangle (\metropolis@progressinheadfoot, 0.4pt);
\end{tikzpicture}%
\end{beamercolorbox}
}
% \end{macrocode}
% \end{macro}
%
% Process package options
%
% \begin{macrocode}
\@metropolis@outer@setdefaults
\ProcessPgfPackageOptions{/metropolis/outer}
% \end{macrocode}
%
% \iffalse
%</package>
% \fi
% \Finale
\endinput