]> projects.mako.cc - beamer-mako/blob - template/beamerinnerthememetropolis.sty
examples of how to use section pages
[beamer-mako] / template / beamerinnerthememetropolis.sty
1 %%
2 %% This is file `beamerinnerthememetropolis.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% beamerinnerthememetropolis.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{beamerinnerthememetropolis}[2017/01/23 Metropolis inner theme]
21 \RequirePackage{etoolbox}
22 \RequirePackage{keyval}
23 \RequirePackage{calc}
24 \RequirePackage{pgfopts}
25 \RequirePackage{tikz}
26 \pgfkeys{
27   /metropolis/inner/sectionpage/.cd,
28     .is choice,
29     none/.code=\metropolis@disablesectionpage,
30     simple/.code={\metropolis@enablesectionpage
31                   \setbeamertemplate{section page}[simple]},
32     progressbar/.code={\metropolis@enablesectionpage
33                        \setbeamertemplate{section page}[progressbar]},
34 }
35 \pgfkeys{
36   /metropolis/inner/subsectionpage/.cd,
37     .is choice,
38     none/.code=\metropolis@disablesubsectionpage,
39     simple/.code={\metropolis@enablesubsectionpage
40                   \setbeamertemplate{section page}[simple]},
41     progressbar/.code={\metropolis@enablesubsectionpage
42                        \setbeamertemplate{section page}[progressbar]},
43 }
44 \newcommand{\metropolis@inner@setdefaults}{
45   \pgfkeys{/metropolis/inner/.cd,
46     sectionpage=progressbar,
47     subsectionpage=none
48   }
49 }
50 \setbeamertemplate{title page}{
51   \begin{minipage}[b][\paperheight]{\textwidth}
52     \ifx\inserttitlegraphic\@empty\else\usebeamertemplate*{title graphic}\fi
53     \vfill%
54     \ifx\inserttitle\@empty\else\usebeamertemplate*{title}\fi
55     \ifx\insertsubtitle\@empty\else\usebeamertemplate*{subtitle}\fi
56     \usebeamertemplate*{title separator}
57     \ifx\beamer@shortauthor\@empty\else\usebeamertemplate*{author}\fi
58     \ifx\insertdate\@empty\else\usebeamertemplate*{date}\fi
59     \ifx\insertinstitute\@empty\else\usebeamertemplate*{institute}\fi
60     \vfill
61     \vspace*{1mm}
62   \end{minipage}
63 }
64 \def\maketitle{%
65   \ifbeamer@inframe
66     \titlepage
67   \else
68     \frame[plain,noframenumbering]{\titlepage}
69   \fi
70 }
71 \def\titlepage{%
72   \usebeamertemplate{title page}
73 }
74 \setbeamertemplate{title graphic}{
75   \vbox to 0pt {
76     \vspace*{2em}
77     \inserttitlegraphic%
78   }%
79   \nointerlineskip%
80 }
81 \setbeamertemplate{title}{
82   \raggedright%
83   \linespread{1.0}%
84   \inserttitle%
85   \par%
86   \vspace*{0.5em}
87 }
88 \setbeamertemplate{subtitle}{
89   \raggedright%
90   \insertsubtitle%
91   \par%
92   \vspace*{0.5em}
93 }
94 \newlength{\metropolis@titleseparator@linewidth}
95 \setlength{\metropolis@titleseparator@linewidth}{0.4pt}
96 \setbeamertemplate{title separator}{
97   \tikzexternaldisable%
98   \begin{tikzpicture}
99     \fill[fg] (0,0) rectangle (\textwidth, \metropolis@titleseparator@linewidth);
100   \end{tikzpicture}%
101   \tikzexternalenable%
102   \par%
103 }
104 \setbeamertemplate{author}{
105   \vspace*{2em}
106   \insertauthor%
107   \par%
108   \vspace*{0.25em}
109 }
110 \setbeamertemplate{date}{
111   \insertdate%
112   \par%
113 }
114 \setbeamertemplate{institute}{
115   \vspace*{3mm}
116   \insertinstitute%
117   \par%
118 }
119 \defbeamertemplate{section page}{simple}{
120   \begin{center}
121     \usebeamercolor[fg]{section title}
122     \usebeamerfont{section title}
123     \insertsectionhead\par
124     \ifx\insertsubsectionhead\@empty\else
125       \usebeamercolor[fg]{subsection title}
126       \usebeamerfont{subsection title}
127       \insertsubsectionhead
128     \fi
129   \end{center}
130 }
131 \defbeamertemplate{section page}{progressbar}{
132   \centering
133   \begin{minipage}{22em}
134     \raggedright
135     \usebeamercolor[fg]{section title}
136     \usebeamerfont{section title}
137     \insertsectionhead\\[-1ex]
138     \usebeamertemplate*{progress bar in section page}
139     \par
140     \ifx\insertsubsectionhead\@empty\else%
141       \usebeamercolor[fg]{subsection title}%
142       \usebeamerfont{subsection title}%
143       \insertsubsectionhead
144     \fi
145   \end{minipage}
146   \par
147   \vspace{\baselineskip}
148 }
149 \newcommand{\metropolis@disablesectionpage}{
150   \AtBeginSection{
151     % intentionally empty
152   }
153 }
154 \newcommand{\metropolis@enablesectionpage}{
155   \AtBeginSection{
156     \ifbeamer@inframe
157       \sectionpage
158     \else
159       \frame[plain,c,noframenumbering]{\sectionpage}
160     \fi
161   }
162 }
163 \setbeamertemplate{subsection page}{%
164   \usebeamertemplate*{section page}
165 }
166 \newcommand{\metropolis@disablesubsectionpage}{
167   \AtBeginSubsection{
168     % intentionally empty
169   }
170 }
171 \newcommand{\metropolis@enablesubsectionpage}{
172   \AtBeginSubsection{
173     \ifbeamer@inframe
174       \subsectionpage
175     \else
176       \frame[plain,c,noframenumbering]{\subsectionpage}
177     \fi
178   }
179 }
180 \newlength{\metropolis@progressonsectionpage}
181 \newlength{\metropolis@progressonsectionpage@linewidth}
182 \setlength{\metropolis@progressonsectionpage@linewidth}{0.4pt}
183 \setbeamertemplate{progress bar in section page}{
184   \setlength{\metropolis@progressonsectionpage}{%
185     \textwidth * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}%
186   }%
187   \tikzexternaldisable%
188   \begin{tikzpicture}
189     \fill[bg] (0,0) rectangle (\textwidth, \metropolis@progressonsectionpage@linewidth);
190     \fill[fg] (0,0) rectangle (\metropolis@progressonsectionpage, \metropolis@progressonsectionpage@linewidth);
191   \end{tikzpicture}%
192   \tikzexternalenable%
193 }
194 \def\inserttotalframenumber{100}
195 \newlength{\metropolis@blocksep}
196 \newlength{\metropolis@blockadjust}
197 \setlength{\metropolis@blocksep}{0.75ex}
198 \setlength{\metropolis@blockadjust}{0.25ex}
199 \providecommand{\metropolis@strut}{%
200   \vphantom{ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz()}%
201 }
202 \newcommand{\metropolis@block}[1]{
203   \par\vskip\medskipamount%
204   \setlength{\parskip}{0pt}
205   \ifbeamercolorempty[bg]{block title#1}{%
206     \begin{beamercolorbox}[rightskip=0pt plus 4em]{block title#1}}{%
207   \ifbeamercolorempty[bg]{block title}{%
208     \begin{beamercolorbox}[rightskip=0pt plus 4em]{block title#1}%
209   }%
210   {%
211     \begin{beamercolorbox}[
212       sep=\dimexpr\metropolis@blocksep-\metropolis@blockadjust\relax,
213       leftskip=\metropolis@blockadjust,
214       rightskip=\dimexpr\metropolis@blockadjust plus 4em\relax
215     ]{block title#1}%
216   }}%
217       \usebeamerfont*{block title#1}%
218       \metropolis@strut%
219       \insertblocktitle%
220       \metropolis@strut%
221   \end{beamercolorbox}%
222   \nointerlineskip%
223   \ifbeamercolorempty[bg]{block body#1}{%
224     \begin{beamercolorbox}[vmode]{block body#1}}{
225   \ifbeamercolorempty[bg]{block body}{%
226     \begin{beamercolorbox}[vmode]{block body#1}%
227   }{%
228     \begin{beamercolorbox}[sep=\metropolis@blocksep, vmode]{block body#1}%
229     \vspace{-\metropolis@parskip}
230   }}%
231       \usebeamerfont{block body#1}%
232       \setlength{\parskip}{\metropolis@parskip}%
233 }
234 \setbeamertemplate{block begin}{\metropolis@block{}}
235 \setbeamertemplate{block alerted begin}{\metropolis@block{ alerted}}
236 \setbeamertemplate{block example begin}{\metropolis@block{ example}}
237 \setbeamertemplate{block end}{\end{beamercolorbox}\vspace*{0.2ex}}
238 \setbeamertemplate{block alerted end}{\end{beamercolorbox}\vspace*{0.2ex}}
239 \setbeamertemplate{block example end}{\end{beamercolorbox}\vspace*{0.2ex}}
240 \setbeamertemplate{itemize items}{\textbullet}
241 \setbeamertemplate{caption label separator}{: }
242 \setbeamertemplate{caption}[numbered]
243 \setbeamertemplate{footnote}{%
244   \parindent 0em\noindent%
245   \raggedright
246   \usebeamercolor{footnote}\hbox to 0.8em{\hfil\insertfootnotemark}\insertfootnotetext\par%
247 }
248 \newlength{\metropolis@parskip}
249 \setlength{\metropolis@parskip}{0.5em}
250 \setlength{\parskip}{\metropolis@parskip}
251 \linespread{1.15}
252 \define@key{beamerframe}{c}[true]{% centered
253   \beamer@frametopskip=0pt plus 1fill\relax%
254   \beamer@framebottomskip=0pt plus 1fill\relax%
255   \beamer@frametopskipautobreak=0pt plus .4\paperheight\relax%
256   \beamer@framebottomskipautobreak=0pt plus .6\paperheight\relax%
257   \def\beamer@initfirstlineunskip{}%
258 }
259 \providebool{metropolis@standout}
260 \define@key{beamerframe}{standout}[true]{%
261   \booltrue{metropolis@standout}
262   \begingroup
263     \setkeys{beamerframe}{c}
264     \setkeys{beamerframe}{noframenumbering}
265     \ifbeamercolorempty[bg]{palette primary}{
266       \setbeamercolor{background canvas}{
267         use=palette primary,
268         bg=-palette primary.fg
269       }
270     }{
271       \setbeamercolor{background canvas}{
272         use=palette primary,
273         bg=palette primary.bg
274       }
275     }
276     \setbeamercolor{local structure}{
277       fg=palette primary.fg
278     }
279     \centering
280     \usebeamercolor[fg]{palette primary}
281     \usebeamerfont{standout}
282 }
283   \apptocmd{\beamer@reseteecodes}{%
284     \ifbool{metropolis@standout}{
285       \endgroup
286       \boolfalse{metropolis@standout}
287     }{}
288   }{}{}
289 \metropolis@inner@setdefaults
290 \ProcessPgfPackageOptions{/metropolis/inner}
291 \endinput
292 %%
293 %% End of file `beamerinnerthememetropolis.sty'.

Benjamin Mako Hill || Want to submit a patch?