latex-setup
My personal LaTeX setup 🦁️⚙️
beamerfontthememetropolis.sty (11439B)
1 %% 2 %% This is file `beamerfontthememetropolis.sty', 3 %% generated with the docstrip utility. 4 %% 5 %% The original source files were: 6 %% 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 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{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} 28 }{ 29 \RequirePackage[no-math]{fontspec} 30 } 31 \newcounter{fontsnotfound} 32 \newcommand{\checkfont}[1]{% 33 \suppressfontnotfounderror=1% 34 \font\x = "#1" at 10pt 35 \selectfont 36 \ifx\x\nullfont% 37 \stepcounter{fontsnotfound}% 38 \fi% 39 \suppressfontnotfounderror=0% 40 } 41 42 \newcommand{\iffontsavailable}[3]{% 43 \setcounter{fontsnotfound}{0}% 44 \expandafter\forcsvlist\expandafter% 45 \checkfont\expandafter{#1}% 46 \ifnum\value{fontsnotfound}=0% 47 #2% 48 \else% 49 #3% 50 \fi% 51 } 52 \iffontsavailable{Fira Sans Light,% 53 Fira Sans Light Italic,% 54 Fira Sans,% 55 Fira Sans Italic}% 56 {% 57 \setsansfont[ItalicFont={Fira Sans Light Italic},% 58 BoldFont={Fira Sans},% 59 BoldItalicFont={Fira Sans Italic}]% 60 {Fira Sans Light}% 61 }{% 62 \iffontsavailable{Fira Sans Light OT,% 63 Fira Sans Light Italic OT,% 64 Fira Sans OT,% 65 Fira Sans Italic OT}% 66 {% 67 \setsansfont[ItalicFont={Fira Sans Light Italic OT},% 68 BoldFont={Fira Sans OT},% 69 BoldItalicFont={Fira Sans Italic OT}]% 70 {Fira Sans Light OT}% 71 }{% 72 \PackageWarning{beamerthememetropolis}{% 73 Could not find Fira Sans fonts% 74 } 75 } 76 } 77 \iffontsavailable{Fira Mono, Fira Mono Bold}{% 78 \setmonofont[BoldFont={Fira Mono Medium}]{Fira Mono}% 79 }{% 80 \iffontsavailable{Fira Mono OT, Fira Mono Bold OT}{% 81 \setmonofont[BoldFont={Fira Mono Medium OT}]{Fira Mono OT}% 82 }{% 83 \PackageWarning{beamerthememetropolis}{% 84 Could not find Fira Mono fonts% 85 } 86 } 87 } 88 \AtBeginEnvironment{tabular}{% 89 \addfontfeature{Numbers={Monospaced}}% 90 } 91 }{% 92 \PackageWarning{beamerthememetropolis}{% 93 You need to compile with XeLaTeX or LuaLaTeX to use the Fira fonts% 94 } 95 } 96 \setbeamerfont{title}{size=\Large,% 97 series=\bfseries} 98 \setbeamerfont{author}{size=\small} 99 \setbeamerfont{date}{size=\small} 100 \setbeamerfont{section title}{size=\Large,% 101 series=\bfseries} 102 \setbeamerfont{block title}{size=\normalsize,% 103 series=\bfseries} 104 \setbeamerfont{block title alerted}{size=\normalsize,% 105 series=\bfseries} 106 \setbeamerfont*{subtitle}{size=\large} 107 \setbeamerfont{frametitle}{size=\large,% 108 series=\bfseries} 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,% 114 series=\normalfont} 115 \setbeamerfont{bibliography entry title}{size=\normalsize,% 116 series=\bfseries} 117 \setbeamerfont{bibliography entry location}{size=\normalsize,% 118 series=\normalfont} 119 \setbeamerfont{bibliography entry note}{size=\small,% 120 series=\normalfont} 121 \setbeamerfont{standout}{size=\Large,% 122 series=\bfseries} 123 \pgfkeys{ 124 /metropolis/font/titleformat title/.cd, 125 .is choice, 126 regular/.code={% 127 \let\metropolis@titleformat\@empty% 128 \setbeamerfont{title}{shape=\normalfont}% 129 }, 130 smallcaps/.code={% 131 \let\metropolis@titleformat\@empty% 132 \setbeamerfont{title}{shape=\scshape}% 133 }, 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% 139 } 140 }, 141 allcaps/.code={% 142 \let\metropolis@titleformat\uppercase% 143 \setbeamerfont{title}{shape=\normalfont} 144 \PackageWarning{beamerthememetropolis}{% 145 Be aware that titleformat title=allcaps can lead to problems% 146 } 147 }, 148 } 149 \pgfkeys{ 150 /metropolis/font/titleformat subtitle/.cd, 151 .is choice, 152 regular/.code={% 153 \let\metropolis@subtitleformat\@empty% 154 \setbeamerfont{subtitle}{shape=\normalfont}% 155 }, 156 smallcaps/.code={% 157 \let\metropolis@subtitleformat\@empty% 158 \setbeamerfont{subtitle}{shape=\scshape}% 159 }, 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% 165 } 166 }, 167 allcaps/.code={% 168 \let\metropolis@subtitleformat\uppercase% 169 \setbeamerfont{subtitle}{shape=\normalfont}% 170 \PackageWarning{beamerthememetropolis}{% 171 Be aware that titleformat subtitle=allcaps can lead to problems% 172 } 173 }, 174 } 175 \pgfkeys{ 176 /metropolis/font/titleformat section/.cd, 177 .is choice, 178 regular/.code={% 179 \let\metropolis@sectiontitleformat\@empty% 180 \setbeamerfont{section title}{shape=\normalfont}% 181 }, 182 smallcaps/.code={% 183 \let\metropolis@sectiontitleformat\@empty% 184 \setbeamerfont{section title}{shape=\scshape}% 185 }, 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% 191 } 192 }, 193 allcaps/.code={% 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% 198 } 199 }, 200 } 201 \pgfkeys{ 202 /metropolis/font/titleformat frame/.cd, 203 .is choice, 204 regular/.code={% 205 \let\metropolis@frametitleformat\@empty% 206 \setbeamerfont{frametitle}{shape=\normalfont}% 207 }, 208 smallcaps/.code={% 209 \let\metropolis@frametitleformat\@empty% 210 \setbeamerfont{frametitle}{shape=\scshape}% 211 }, 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% 217 } 218 }, 219 allcaps/.code={% 220 \let\metropolis@frametitleformat\MakeUppercase% 221 \setbeamerfont{frametitle}{shape=\normalfont} 222 \PackageWarning{beamerthememetropolis}{% 223 Be aware that titleformat frame=allcaps can lead to problems% 224 } 225 }, 226 } 227 \pgfkeys{ 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}, 233 } 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, 240 } 241 } 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}}}% 249 {}% 250 {\PackageError{beamerfontthememetropolis}{Patching title failed}\@ehc} 251 \patchcmd{\beamer@subtitle}% 252 {\def\insertsubtitle{#2}}% 253 {\def\insertsubtitle{\metropolis@subtitleformat{#2}}}% 254 {}% 255 {\PackageError{beamerfontthememetropolis}{Patching subtitle failed}\@ehc} 256 \patchcmd{\sectionentry} 257 {\def\insertsectionhead{#2}} 258 {\def\insertsectionhead{\metropolis@sectiontitleformat{#2}}} 259 {} 260 {\PackageError{beamerfontthememetropolis}{Patching section title failed}\@ehc} 261 \@tempswafalse 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}}}}} 266 {\@tempswatrue} 267 {} 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}}}} 272 {\@tempswatrue} 273 {} 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}}}} 278 {\@tempswatrue} 279 {} 280 \if@tempswa\else 281 \PackageError{beamerfontthememetropolis}{Patching section title failed}\@ehc 282 \fi 283 \@tempswafalse 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}}}}} 288 {\@tempswatrue} 289 {} 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}}}} 294 {\@tempswatrue} 295 {} 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}}}} 300 {\@tempswatrue} 301 {} 302 \if@tempswa\else 303 \PackageError{beamerfontthememetropolis}{Patching section title failed}\@ehc 304 \fi 305 \patchcmd{\beamer@@frametitle} 306 {{% 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}% 311 }} 312 {{% 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}% 318 }} 319 {} 320 {\PackageError{beamerfontthememetropolis}{Patching frame title failed}\@ehc} 321 \metropolis@font@setdefaults 322 \ProcessPgfPackageOptions{/metropolis/font} 323 \endinput 324 %% 325 %% End of file `beamerfontthememetropolis.sty'.