You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

284 lines
9.6KB

  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}[2016/02/21 Metropolis font theme]
  21. \RequirePackage{etoolbox}
  22. \RequirePackage{ifxetex}
  23. \RequirePackage{ifluatex}
  24. \RequirePackage{pgfopts}
  25. \ifboolexpr{bool {xetex} or bool {luatex}}{
  26. \RequirePackage[no-math]{fontspec}
  27. \newcounter{fontsnotfound}
  28. \newcommand{\checkfont}[1]{%
  29. \suppressfontnotfounderror=1%
  30. \font\x = "#1" at 10pt
  31. \selectfont
  32. \ifx\x\nullfont%
  33. \stepcounter{fontsnotfound}%
  34. \fi%
  35. \suppressfontnotfounderror=0%
  36. }
  37. \newcommand{\iffontsavailable}[3]{%
  38. \setcounter{fontsnotfound}{0}%
  39. \expandafter\forcsvlist\expandafter%
  40. \checkfont\expandafter{#1}%
  41. \ifnum\value{fontsnotfound}=0%
  42. #2%
  43. \else%
  44. #3%
  45. \fi%
  46. }
  47. \iffontsavailable{Fira Sans Light,%
  48. Fira Sans Light Italic,%
  49. Fira Sans,%
  50. Fira Sans Italic}%
  51. {%
  52. \setsansfont[ItalicFont={Fira Sans Light Italic},%
  53. BoldFont={Fira Sans},%
  54. BoldItalicFont={Fira Sans Italic}]%
  55. {Fira Sans Light}%
  56. }{%
  57. \iffontsavailable{Fira Sans Light OT,%
  58. Fira Sans Light Italic OT,%
  59. Fira Sans OT,%
  60. Fira Sans Italic OT}%
  61. {%
  62. \setsansfont[ItalicFont={Fira Sans Light Italic OT},%
  63. BoldFont={Fira Sans OT},%
  64. BoldItalicFont={Fira Sans Italic OT}]%
  65. {Fira Sans Light OT}%
  66. }{%
  67. \PackageWarning{beamerthememetropolis}{%
  68. Could not find Fira Sans fonts%
  69. }
  70. }
  71. }
  72. \iffontsavailable{Fira Mono, Fira Mono Bold}{%
  73. \setmonofont[BoldFont={Fira Mono Medium}]{Fira Mono}%
  74. }{%
  75. \iffontsavailable{Fira Mono OT, Fira Mono Bold OT}{%
  76. \setmonofont[BoldFont={Fira Mono Medium OT}]{Fira Mono OT}%
  77. }{%
  78. \PackageWarning{beamerthememetropolis}{%
  79. Could not find Fira Mono fonts%
  80. }
  81. }
  82. }
  83. \AtBeginEnvironment{tabular}{%
  84. \addfontfeature{Numbers={Monospaced}}%
  85. }
  86. }{%
  87. \PackageWarning{beamerthememetropolis}{%
  88. You need to compile with XeLaTeX or LuaLaTeX to use the Fira fonts%
  89. }
  90. }
  91. \setbeamerfont{title}{size=\Large,%
  92. series=\bfseries}
  93. \setbeamerfont{author}{size=\small}
  94. \setbeamerfont{date}{size=\small}
  95. \setbeamerfont{section title}{size=\Large,%
  96. series=\bfseries}
  97. \setbeamerfont{block title}{size=\normalsize,%
  98. series=\bfseries}
  99. \setbeamerfont{block title alerted}{size=\normalsize,%
  100. series=\bfseries}
  101. \setbeamerfont*{subtitle}{size=\large}
  102. \setbeamerfont{frametitle}{size=\large,%
  103. series=\bfseries}
  104. \setbeamerfont{caption}{size=\small}
  105. \setbeamerfont{caption name}{series=\bfseries}
  106. \setbeamerfont{description item}{series=\bfseries}
  107. \setbeamerfont{page number in head/foot}{size=\scriptsize}
  108. \setbeamerfont{bibliography entry author}{size=\normalsize,%
  109. series=\normalfont}
  110. \setbeamerfont{bibliography entry title}{size=\normalsize,%
  111. series=\bfseries}
  112. \setbeamerfont{bibliography entry location}{size=\normalsize,%
  113. series=\normalfont}
  114. \setbeamerfont{bibliography entry note}{size=\small,%
  115. series=\normalfont}
  116. \setbeamerfont{standout}{size=\Large,%
  117. series=\bfseries}
  118. \pgfkeys{
  119. /metropolis/font/titleformat title/.cd,
  120. .is choice,
  121. regular/.code={%
  122. \let\metropolis@titleformat\@empty%
  123. \setbeamerfont{title}{shape=\normalfont}%
  124. },
  125. smallcaps/.code={%
  126. \let\metropolis@titleformat\@empty%
  127. \setbeamerfont{title}{shape=\scshape}%
  128. },
  129. allsmallcaps/.code={%
  130. \let\metropolis@titleformat\lowercase%
  131. \setbeamerfont{title}{shape=\scshape}%
  132. \PackageWarning{beamerthememetropolis}{%
  133. Be aware that titleformat title=allsmallcaps can lead to problems%
  134. }
  135. },
  136. allcaps/.code={%
  137. \let\metropolis@titleformat\uppercase%
  138. \setbeamerfont{title}{shape=\normalfont}
  139. \PackageWarning{beamerthememetropolis}{%
  140. Be aware that titleformat title=allcaps can lead to problems%
  141. }
  142. },
  143. }
  144. \pgfkeys{
  145. /metropolis/font/titleformat subtitle/.cd,
  146. .is choice,
  147. regular/.code={%
  148. \let\metropolis@subtitleformat\@empty%
  149. \setbeamerfont{subtitle}{shape=\normalfont}%
  150. },
  151. smallcaps/.code={%
  152. \let\metropolis@subtitleformat\@empty%
  153. \setbeamerfont{subtitle}{shape=\scshape}%
  154. },
  155. allsmallcaps/.code={%
  156. \let\metropolis@subtitleformat\lowercase%
  157. \setbeamerfont{subtitle}{shape=\scshape}%
  158. \PackageWarning{beamerthememetropolis}{%
  159. Be aware that titleformat subtitle=allsmallcaps can lead to problems%
  160. }
  161. },
  162. allcaps/.code={%
  163. \let\metropolis@subtitleformat\uppercase%
  164. \setbeamerfont{subtitle}{shape=\normalfont}%
  165. \PackageWarning{beamerthememetropolis}{%
  166. Be aware that titleformat subtitle=allcaps can lead to problems%
  167. }
  168. },
  169. }
  170. \pgfkeys{
  171. /metropolis/font/titleformat section/.cd,
  172. .is choice,
  173. regular/.code={%
  174. \let\metropolis@sectiontitleformat\@empty%
  175. \setbeamerfont{section title}{shape=\normalfont}%
  176. },
  177. smallcaps/.code={%
  178. \let\metropolis@sectiontitleformat\@empty%
  179. \setbeamerfont{section title}{shape=\scshape}%
  180. },
  181. allsmallcaps/.code={%
  182. \let\metropolis@sectiontitleformat\MakeLowercase%
  183. \setbeamerfont{section title}{shape=\scshape}%
  184. \PackageWarning{beamerthememetropolis}{%
  185. Be aware that titleformat section=allsmallcaps can lead to problems%
  186. }
  187. },
  188. allcaps/.code={%
  189. \let\metropolis@sectiontitleformat\MakeUppercase%
  190. \setbeamerfont{section title}{shape=\normalfont}%
  191. \PackageWarning{beamerthememetropolis}{%
  192. Be aware that titleformat section=allcaps can lead to problems%
  193. }
  194. },
  195. }
  196. \pgfkeys{
  197. /metropolis/font/titleformat frame/.cd,
  198. .is choice,
  199. regular/.code={%
  200. \let\metropolis@frametitleformat\@empty%
  201. \setbeamerfont{frametitle}{shape=\normalfont}%
  202. },
  203. smallcaps/.code={%
  204. \let\metropolis@frametitleformat\@empty%
  205. \setbeamerfont{frametitle}{shape=\scshape}%
  206. },
  207. allsmallcaps/.code={%
  208. \let\metropolis@frametitleformat\MakeLowercase%
  209. \setbeamerfont{frametitle}{shape=\scshape}%
  210. \PackageWarning{beamerthememetropolis}{%
  211. Be aware that titleformat frame=allsmallcaps can lead to problems%
  212. }
  213. },
  214. allcaps/.code={%
  215. \let\metropolis@frametitleformat\MakeUppercase%
  216. \setbeamerfont{frametitle}{shape=\normalfont}
  217. \PackageWarning{beamerthememetropolis}{%
  218. Be aware that titleformat frame=allcaps can lead to problems%
  219. }
  220. },
  221. }
  222. \pgfkeys{
  223. /metropolis/font/.cd,
  224. titleformattitle/.code=\pgfkeysalso{titleformat title=#1},
  225. titleformatsubtitle/.code=\pgfkeysalso{titleformat subtitle=#1},
  226. titleformatsection/.code=\pgfkeysalso{titleformat section=#1},
  227. titleformatframe/.code=\pgfkeysalso{titleformat frame=#1},
  228. }
  229. \newcommand{\metropolis@font@setdefaults}{
  230. \pgfkeys{/metropolis/font/.cd,
  231. titleformat title=regular,
  232. titleformat subtitle=regular,
  233. titleformat section=regular,
  234. titleformat frame=regular,
  235. }
  236. }
  237. \def\metropolis@titleformat#1{#1}
  238. \def\metropolis@subtitleformat#1{#1}
  239. \def\metropolis@sectiontitleformat#1{#1}
  240. \def\metropolis@frametitleformat#1{#1}
  241. \patchcmd{\beamer@title}%
  242. {\def\inserttitle{#2}}%
  243. {\def\inserttitle{\metropolis@titleformat{#2}}}%
  244. {}%
  245. {\PackageError{beamerfontthememetropolis}{Patching title failed}}
  246. \patchcmd{\beamer@subtitle}%
  247. {\def\insertsubtitle{#2}}%
  248. {\def\insertsubtitle{\metropolis@subtitleformat{#2}}}%
  249. {}%
  250. {\PackageError{beamerfontthememetropolis}{Patching subtitle failed}}
  251. \patchcmd{\sectionentry}
  252. {\def\insertsectionhead{#2}}
  253. {\def\insertsectionhead{\metropolis@sectiontitleformat{#2}}}
  254. {}
  255. {\PackageError{beamerfontthememetropolis}{Patching section title failed}}
  256. \patchcmd{\beamer@section}
  257. {\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{#1}}}
  258. {\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{%
  259. \metropolis@sectiontitleformat{#1}}}}
  260. {}
  261. {\PackageError{beamerfontthememetropolis}{Patching section title failed}}
  262. \patchcmd{\beamer@@frametitle}
  263. {\beamer@ifempty{#2}{}{%
  264. \gdef\insertframetitle{{#2\ifnum\beamer@autobreakcount>0\relax{}\space%
  265. \usebeamertemplate*{frametitle continuation}\fi}}%
  266. \gdef\beamer@frametitle{#2}%
  267. \gdef\beamer@shortframetitle{#1}%
  268. }}
  269. {\beamer@ifempty{#2}{}{%
  270. \gdef\insertframetitle{{\metropolis@frametitleformat{#2}\ifnum%
  271. \beamer@autobreakcount>0\relax{}\space%
  272. \usebeamertemplate*{frametitle continuation}\fi}}%
  273. \gdef\beamer@frametitle{#2}%
  274. \gdef\beamer@shortframetitle{#1}%
  275. }}
  276. {}
  277. {\PackageError{beamerfontthememetropolis}{Patching frame title failed}}
  278. \metropolis@font@setdefaults
  279. \ProcessPgfPackageOptions{/metropolis/font}
  280. \endinput
  281. %%
  282. %% End of file `beamerfontthememetropolis.sty'.