2 %% This is file `beamerfontthememetropolis.sty',
3 %% generated with the docstrip utility.
5 %% The original source files were:
7 %% beamerfontthememetropolis.dtx (with options: `package')
8 %% ---------------------------------------------------------------------------
9 %% Copyright 2015 Matthias Vogelgesang and the LaTeX community. A full list of
10 %% contributors can be found at
12 %% https://github.com/matze/mtheme/graphs/contributors
14 %% and the original template was based on the HSRM theme by Benjamin Weiss.
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{beamerfontthememetropolis}[2017/01/23 Metropolis font theme]
21 \RequirePackage{etoolbox}
22 \RequirePackage{ifxetex}
23 \RequirePackage{ifluatex}
24 \RequirePackage{pgfopts}
25 \ifboolexpr{bool {xetex} or bool {luatex}}{
26 \@ifpackageloaded{fontspec}{
27 \PassOptionsToPackage{no-math}{fontspec}
29 \RequirePackage[no-math]{fontspec}
31 \newcounter{fontsnotfound}
32 \newcommand{\checkfont}[1]{%
33 \suppressfontnotfounderror=1%
34 \font\x = "#1" at 10pt
37 \stepcounter{fontsnotfound}%
39 \suppressfontnotfounderror=0%
42 \newcommand{\iffontsavailable}[3]{%
43 \setcounter{fontsnotfound}{0}%
44 \expandafter\forcsvlist\expandafter%
45 \checkfont\expandafter{#1}%
46 \ifnum\value{fontsnotfound}=0%
52 \iffontsavailable{Fira Sans Light,%
53 Fira Sans Light Italic,%
57 \setsansfont[ItalicFont={Fira Sans Light Italic},%
58 BoldFont={Fira Sans},%
59 BoldItalicFont={Fira Sans Italic}]%
62 \iffontsavailable{Fira Sans Light OT,%
63 Fira Sans Light Italic OT,%
67 \setsansfont[ItalicFont={Fira Sans Light Italic OT},%
68 BoldFont={Fira Sans OT},%
69 BoldItalicFont={Fira Sans Italic OT}]%
72 \PackageWarning{beamerthememetropolis}{%
73 Could not find Fira Sans fonts%
77 \iffontsavailable{Fira Mono, Fira Mono Bold}{%
78 \setmonofont[BoldFont={Fira Mono Medium}]{Fira Mono}%
80 \iffontsavailable{Fira Mono OT, Fira Mono Bold OT}{%
81 \setmonofont[BoldFont={Fira Mono Medium OT}]{Fira Mono OT}%
83 \PackageWarning{beamerthememetropolis}{%
84 Could not find Fira Mono fonts%
88 \AtBeginEnvironment{tabular}{%
89 \addfontfeature{Numbers={Monospaced}}%
92 \PackageWarning{beamerthememetropolis}{%
93 You need to compile with XeLaTeX or LuaLaTeX to use the Fira fonts%
96 \setbeamerfont{title}{size=\Large,%
98 \setbeamerfont{author}{size=\small}
99 \setbeamerfont{date}{size=\small}
100 \setbeamerfont{section title}{size=\Large,%
102 \setbeamerfont{block title}{size=\normalsize,%
104 \setbeamerfont{block title alerted}{size=\normalsize,%
106 \setbeamerfont*{subtitle}{size=\large}
107 \setbeamerfont{frametitle}{size=\large,%
109 \setbeamerfont{caption}{size=\small}
110 \setbeamerfont{caption name}{series=\bfseries}
111 \setbeamerfont{description item}{series=\bfseries}
112 \setbeamerfont{page number in head/foot}{size=\scriptsize}
113 \setbeamerfont{bibliography entry author}{size=\normalsize,%
115 \setbeamerfont{bibliography entry title}{size=\normalsize,%
117 \setbeamerfont{bibliography entry location}{size=\normalsize,%
119 \setbeamerfont{bibliography entry note}{size=\small,%
121 \setbeamerfont{standout}{size=\Large,%
124 /metropolis/font/titleformat title/.cd,
127 \let\metropolis@titleformat\@empty%
128 \setbeamerfont{title}{shape=\normalfont}%
131 \let\metropolis@titleformat\@empty%
132 \setbeamerfont{title}{shape=\scshape}%
134 allsmallcaps/.code={%
135 \let\metropolis@titleformat\lowercase%
136 \setbeamerfont{title}{shape=\scshape}%
137 \PackageWarning{beamerthememetropolis}{%
138 Be aware that titleformat title=allsmallcaps can lead to problems%
142 \let\metropolis@titleformat\uppercase%
143 \setbeamerfont{title}{shape=\normalfont}
144 \PackageWarning{beamerthememetropolis}{%
145 Be aware that titleformat title=allcaps can lead to problems%
150 /metropolis/font/titleformat subtitle/.cd,
153 \let\metropolis@subtitleformat\@empty%
154 \setbeamerfont{subtitle}{shape=\normalfont}%
157 \let\metropolis@subtitleformat\@empty%
158 \setbeamerfont{subtitle}{shape=\scshape}%
160 allsmallcaps/.code={%
161 \let\metropolis@subtitleformat\lowercase%
162 \setbeamerfont{subtitle}{shape=\scshape}%
163 \PackageWarning{beamerthememetropolis}{%
164 Be aware that titleformat subtitle=allsmallcaps can lead to problems%
168 \let\metropolis@subtitleformat\uppercase%
169 \setbeamerfont{subtitle}{shape=\normalfont}%
170 \PackageWarning{beamerthememetropolis}{%
171 Be aware that titleformat subtitle=allcaps can lead to problems%
176 /metropolis/font/titleformat section/.cd,
179 \let\metropolis@sectiontitleformat\@empty%
180 \setbeamerfont{section title}{shape=\normalfont}%
183 \let\metropolis@sectiontitleformat\@empty%
184 \setbeamerfont{section title}{shape=\scshape}%
186 allsmallcaps/.code={%
187 \let\metropolis@sectiontitleformat\MakeLowercase%
188 \setbeamerfont{section title}{shape=\scshape}%
189 \PackageWarning{beamerthememetropolis}{%
190 Be aware that titleformat section=allsmallcaps can lead to problems%
194 \let\metropolis@sectiontitleformat\MakeUppercase%
195 \setbeamerfont{section title}{shape=\normalfont}%
196 \PackageWarning{beamerthememetropolis}{%
197 Be aware that titleformat section=allcaps can lead to problems%
202 /metropolis/font/titleformat frame/.cd,
205 \let\metropolis@frametitleformat\@empty%
206 \setbeamerfont{frametitle}{shape=\normalfont}%
209 \let\metropolis@frametitleformat\@empty%
210 \setbeamerfont{frametitle}{shape=\scshape}%
212 allsmallcaps/.code={%
213 \let\metropolis@frametitleformat\MakeLowercase%
214 \setbeamerfont{frametitle}{shape=\scshape}%
215 \PackageWarning{beamerthememetropolis}{%
216 Be aware that titleformat frame=allsmallcaps can lead to problems%
220 \let\metropolis@frametitleformat\MakeUppercase%
221 \setbeamerfont{frametitle}{shape=\normalfont}
222 \PackageWarning{beamerthememetropolis}{%
223 Be aware that titleformat frame=allcaps can lead to problems%
228 /metropolis/font/.cd,
229 titleformattitle/.code=\pgfkeysalso{titleformat title=#1},
230 titleformatsubtitle/.code=\pgfkeysalso{titleformat subtitle=#1},
231 titleformatsection/.code=\pgfkeysalso{titleformat section=#1},
232 titleformatframe/.code=\pgfkeysalso{titleformat frame=#1},
234 \newcommand{\metropolis@font@setdefaults}{
235 \pgfkeys{/metropolis/font/.cd,
236 titleformat title=regular,
237 titleformat subtitle=regular,
238 titleformat section=regular,
239 titleformat frame=regular,
242 \def\metropolis@titleformat#1{#1}
243 \def\metropolis@subtitleformat#1{#1}
244 \def\metropolis@sectiontitleformat#1{#1}
245 \def\metropolis@frametitleformat#1{#1}
246 \patchcmd{\beamer@title}%
247 {\def\inserttitle{#2}}%
248 {\def\inserttitle{\metropolis@titleformat{#2}}}%
250 {\PackageError{beamerfontthememetropolis}{Patching title failed}\@ehc}
251 \patchcmd{\beamer@subtitle}%
252 {\def\insertsubtitle{#2}}%
253 {\def\insertsubtitle{\metropolis@subtitleformat{#2}}}%
255 {\PackageError{beamerfontthememetropolis}{Patching subtitle failed}\@ehc}
256 \patchcmd{\sectionentry}
257 {\def\insertsectionhead{#2}}
258 {\def\insertsectionhead{\metropolis@sectiontitleformat{#2}}}
260 {\PackageError{beamerfontthememetropolis}{Patching section title failed}\@ehc}
262 \patchcmd{\beamer@section}
263 {\edef\insertsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{\unexpanded{#1}}}}
264 {\edef\insertsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{%
265 \noexpand\metropolis@sectiontitleformat{\unexpanded{#1}}}}}
268 \patchcmd{\beamer@section}
269 {\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{#1}}}
270 {\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{%
271 \metropolis@sectiontitleformat{#1}}}}
274 \patchcmd{\beamer@section}
275 {\protected@edef\insertsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{#1}}}
276 {\protected@edef\insertsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{%
277 \noexpand\metropolis@sectiontitleformat{#1}}}}
281 \PackageError{beamerfontthememetropolis}{Patching section title failed}\@ehc
284 \patchcmd{\beamer@subsection}
285 {\edef\insertsubsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{\unexpanded{#1}}}}
286 {\edef\insertsubsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{%
287 \noexpand\metropolis@sectiontitleformat{\unexpanded{#1}}}}}
290 \patchcmd{\beamer@subsection}
291 {\def\insertsubsectionhead{\hyperlink{Navigation\the\c@page}{#1}}}
292 {\def\insertsubsectionhead{\hyperlink{Navigation\the\c@page}{%
293 \metropolis@sectiontitleformat{#1}}}}
296 \patchcmd{\beamer@subsection}
297 {\protected@edef\insertsubsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{#1}}}
298 {\protected@edef\insertsubsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{%
299 \noexpand\metropolis@sectiontitleformat{#1}}}}
303 \PackageError{beamerfontthememetropolis}{Patching section title failed}\@ehc
305 \patchcmd{\beamer@@frametitle}
307 \gdef\insertframetitle{{#2\ifnum\beamer@autobreakcount>0\relax{}\space%
308 \usebeamertemplate*{frametitle continuation}\fi}}%
309 \gdef\beamer@frametitle{#2}%
310 \gdef\beamer@shortframetitle{#1}%
313 \gdef\insertframetitle{{\metropolis@frametitleformat{#2}\ifnum%
314 \beamer@autobreakcount>0\relax{}\space%
315 \usebeamertemplate*{frametitle continuation}\fi}}%
316 \gdef\beamer@frametitle{#2}%
317 \gdef\beamer@shortframetitle{#1}%
320 {\PackageError{beamerfontthememetropolis}{Patching frame title failed}\@ehc}
321 \metropolis@font@setdefaults
322 \ProcessPgfPackageOptions{/metropolis/font}
325 %% End of file `beamerfontthememetropolis.sty'.