]> projects.mako.cc - beamer-mako/blob - template/beamerouterthememetropolis.sty
examples of how to use section pages
[beamer-mako] / template / beamerouterthememetropolis.sty
1 %%
2 %% This is file `beamerouterthememetropolis.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% beamerouterthememetropolis.dtx  (with options: `package')
8 %% ---------------------------------------------------------------------------
9 %% Copyright 2015 Matthias Vogelgesang and the LaTeX community. A full list of
10 %% contributors can be found at
11 %% 
12 %%     https://github.com/matze/mtheme/graphs/contributors
13 %% 
14 %% and the original template was based on the HSRM theme by Benjamin Weiss.
15 %% 
16 %% This work is licensed under a Creative Commons Attribution-ShareAlike 4.0
17 %% International License (https://creativecommons.org/licenses/by-sa/4.0/).
18 %% ---------------------------------------------------------------------------
19 \NeedsTeXFormat{LaTeX2e}
20 \ProvidesPackage{beamerouterthememetropolis}[2017/01/23 Metropolis outer theme]
21 \RequirePackage{etoolbox}
22 \RequirePackage{calc}
23 \RequirePackage{pgfopts}
24 \pgfkeys{
25   /metropolis/outer/numbering/.cd,
26     .is choice,
27     none/.code=\setbeamertemplate{frame numbering}[none],
28     counter/.code=\setbeamertemplate{frame numbering}[counter],
29     fraction/.code=\setbeamertemplate{frame numbering}[fraction],
30 }
31 \pgfkeys{
32   /metropolis/outer/progressbar/.cd,
33     .is choice,
34     none/.code={%
35       \setbeamertemplate{headline}[plain]
36       \setbeamertemplate{frametitle}[plain]
37       \setbeamertemplate{footline}[plain]
38     },
39     head/.code={\pgfkeys{/metropolis/outer/progressbar=none}
40       \addtobeamertemplate{headline}{}{%
41         \usebeamertemplate*{progress bar in head/foot}
42       }
43     },
44     frametitle/.code={\pgfkeys{/metropolis/outer/progressbar=none}
45       \addtobeamertemplate{frametitle}{}{%
46         \usebeamertemplate*{progress bar in head/foot}
47       }
48     },
49     foot/.code={\pgfkeys{/metropolis/outer/progressbar=none}
50       \addtobeamertemplate{footline}{}{%
51         \usebeamertemplate*{progress bar in head/foot}%
52       }
53     },
54 }
55 \newcommand{\metropolis@outer@setdefaults}{
56   \pgfkeys{/metropolis/outer/.cd,
57     numbering=counter,
58     progressbar=none,
59   }
60 }
61 \setbeamertemplate{navigation symbols}{}
62 \defbeamertemplate{frame footer}{none}{}
63 \defbeamertemplate{frame footer}{custom}[1]{ #1 }
64 \defbeamertemplate{frame numbering}{none}{}
65 \defbeamertemplate{frame numbering}{counter}{\insertframenumber}
66 \defbeamertemplate{frame numbering}{fraction}{
67   \insertframenumber/\inserttotalframenumber
68 }
69 \defbeamertemplate{headline}{plain}{}
70 \defbeamertemplate{footline}{plain}{%
71   \begin{beamercolorbox}[wd=\textwidth, sep=3ex]{footline}%
72     \usebeamerfont{page number in head/foot}%
73     \usebeamertemplate*{frame footer}
74     \hfill%
75     \usebeamertemplate*{frame numbering}
76   \end{beamercolorbox}%
77 }
78 \newlength{\metropolis@frametitle@padding}
79 \setlength{\metropolis@frametitle@padding}{2.2ex}
80 \newcommand{\metropolis@frametitlestrut@start}{
81   \rule{0pt}{\metropolis@frametitle@padding +%
82     \totalheightof{%
83       \ifcsdef{metropolis@frametitleformat}{\metropolis@frametitleformat X}{X}%
84     }%
85   }%
86 }
87 \newcommand{\metropolis@frametitlestrut@end}{
88   \rule[-\metropolis@frametitle@padding]{0pt}{\metropolis@frametitle@padding}
89 }
90 \defbeamertemplate{frametitle}{plain}{%
91   \nointerlineskip%
92   \begin{beamercolorbox}[%
93       wd=\paperwidth,%
94       sep=0pt,%
95       leftskip=\metropolis@frametitle@padding,%
96       rightskip=\metropolis@frametitle@padding,%
97     ]{frametitle}%
98   \metropolis@frametitlestrut@start%
99   \insertframetitle%
100   \nolinebreak%
101   \metropolis@frametitlestrut@end%
102   \end{beamercolorbox}%
103 }
104 \setbeamertemplate{frametitle continuation}{%
105   \usebeamerfont{frametitle}
106   \romannumeral \insertcontinuationcount
107 }
108 \newlength{\metropolis@progressinheadfoot}
109 \newlength{\metropolis@progressinheadfoot@linewidth}
110 \setlength{\metropolis@progressinheadfoot@linewidth}{0.4pt}
111 \setbeamertemplate{progress bar in head/foot}{
112   \nointerlineskip
113   \setlength{\metropolis@progressinheadfoot}{%
114     \paperwidth * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}%
115   }%
116   \begin{beamercolorbox}[wd=\paperwidth]{progress bar in head/foot}
117     \tikzexternaldisable%
118     \begin{tikzpicture}
119       \fill[bg] (0,0) rectangle (\paperwidth, \metropolis@progressinheadfoot@linewidth);
120       \fill[fg] (0,0) rectangle (\metropolis@progressinheadfoot, \metropolis@progressinheadfoot@linewidth);
121     \end{tikzpicture}%
122     \tikzexternalenable%
123   \end{beamercolorbox}
124 }
125 \AtBeginDocument{%
126   \apptocmd{\appendix}{%
127     \pgfkeys{%
128       /metropolis/outer/.cd,
129       numbering=none,
130       progressbar=none}
131     }{}{}
132 }
133 \metropolis@outer@setdefaults
134 \ProcessPgfPackageOptions{/metropolis/outer}
135 \endinput
136 %%
137 %% End of file `beamerouterthememetropolis.sty'.

Benjamin Mako Hill || Want to submit a patch?