mirror of https://github.com/matze/mtheme.git
167 lines
5.2 KiB
TeX
167 lines
5.2 KiB
TeX
% \iffalse meta-comment -------------------------------------------------------
|
|
% Copyright 2015 Matthias Vogelgesang and the LaTeX community. A full list of
|
|
% contributors can be found at
|
|
%
|
|
% https://github.com/matze/mtheme/graphs/contributors
|
|
%
|
|
% and the original template was based on the HSRM theme by Benjamin Weiss.
|
|
%
|
|
% This work is licensed under a Creative Commons Attribution-ShareAlike 4.0
|
|
% International License (https://creativecommons.org/licenses/by-sa/4.0/).
|
|
% ------------------------------------------------------------------------- \fi
|
|
% \iffalse
|
|
%<driver> \ProvidesFile{beamerfontthememetropolis.dtx}
|
|
%<*package>
|
|
\NeedsTeXFormat{LaTeX2e}
|
|
\ProvidesPackage{beamerfontthememetropolis}[2015/12/04 Metropolis font theme]
|
|
%</package>
|
|
%<driver> \documentclass{ltxdoc}
|
|
%<driver> \usepackage{beamerfontthememetropolis}
|
|
%<driver> \begin{document}
|
|
%<driver> \DocInput{beamerfontthememetropolis.dtx}
|
|
%<driver> \end{document}
|
|
% \fi
|
|
% \CheckSum{0}
|
|
% \StopEventually{}
|
|
% \iffalse
|
|
%<*package>
|
|
% ------------------------------------------------------------------------- \fi
|
|
% \subsection{\textsc{metropolis} font theme}
|
|
%
|
|
%
|
|
% Load required packages.
|
|
% \begin{macrocode}
|
|
\RequirePackage{etoolbox}
|
|
\RequirePackage{ifxetex}
|
|
\RequirePackage{ifluatex}
|
|
% \end{macrocode}
|
|
%
|
|
% \subsubsection{Load Fira font}
|
|
% If the presentation is compiled with XeLaTeX or LuaLaTeX the fontspec package
|
|
% will be loaded.
|
|
% \begin{macrocode}
|
|
\ifboolexpr{bool {xetex} or bool {luatex}}{
|
|
\RequirePackage[no-math]{fontspec}
|
|
% \end{macrocode}
|
|
%
|
|
% To simplify the check whether the |Fira| fonts are installed, a set macros is
|
|
% defined.
|
|
%
|
|
% \begin{macro}{\checkfont}
|
|
% Checks if a font is installed and increases |fontsnotfound| counter if not.
|
|
% \begin{macrocode}
|
|
\newcounter{fontsnotfound}
|
|
\newcommand{\checkfont}[1]{%
|
|
\suppressfontnotfounderror=1%
|
|
\font\x = "#1" at 10pt
|
|
\selectfont
|
|
\ifx\x\nullfont%
|
|
\stepcounter{fontsnotfound}%
|
|
\fi%
|
|
\suppressfontnotfounderror=0%
|
|
}
|
|
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macro}{\iffontexists}
|
|
% Resets the |fontsnotfound| counter and calls |\checkfont| for each font in
|
|
% the comma separated list in the first argument.
|
|
% \begin{macrocode}
|
|
\newcommand{\iffontsexist}[3]{%
|
|
\setcounter{fontsnotfound}{0}%
|
|
\expandafter\forcsvlist\expandafter%
|
|
\checkfont\expandafter{#1}%
|
|
\ifnum\value{fontsnotfound}=0%
|
|
#2%
|
|
\else%
|
|
#3%
|
|
\fi%
|
|
}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% Using the previously defined macros it is tried to load the |Fira| fonts.
|
|
% First the default |Fira| name will be tried. Second the |Fira| fonts with
|
|
% the suffix OT -- used by some Linux distributions -- will be tried. If this
|
|
% also fails a warning will be displayed and the standard fonts will be used.
|
|
%
|
|
% \begin{macrocode}
|
|
\iffontsexist{Fira Sans Light,%
|
|
Fira Sans Light Italic,%
|
|
Fira Sans,%
|
|
Fira Sans Italic}{%
|
|
\setsansfont[BoldFont={Fira Sans}]{Fira Sans Light}%
|
|
}{%
|
|
\iffontsexist{Fira Sans Light OT,%
|
|
Fira Sans Light Italic OT,%
|
|
Fira Sans OT,%
|
|
Fira Sans Italic OT}{%
|
|
\setsansfont[BoldFont={Fira Sans OT}]{Fira Sans Light OT}%
|
|
}{%
|
|
\PackageWarning{beamerthememetropolis}{%
|
|
Could not find Fira Sans fonts%
|
|
}
|
|
}
|
|
}
|
|
\iffontsexist{Fira Mono, Fira Mono Bold}{%
|
|
\setmonofont{Fira Mono}%
|
|
}{%
|
|
\iffontsexist{Fira Mono OT, Fira Mono Bold OT}{%
|
|
\setmonofont{Fira Mono OT}%
|
|
}{%
|
|
\PackageWarning{beamerthememetropolis}{%
|
|
Could not find Fira Mono fonts%
|
|
}
|
|
}
|
|
}
|
|
\AtBeginEnvironment{tabular}{%
|
|
\addfontfeature{Numbers={Monospaced}}%
|
|
}
|
|
}{%
|
|
\PackageWarning{beamerthememetropolis}{%
|
|
You need to compile with XeLaTeX or LuaLaTeX to use the Fira fonts%
|
|
}
|
|
}
|
|
% \end{macrocode}
|
|
%
|
|
%
|
|
%
|
|
% \subsubsection{General font definitions}
|
|
%
|
|
% \begin{macrocode}
|
|
\setbeamerfont{title}{size=\Large,%
|
|
series=\bfseries}
|
|
\setbeamerfont{author}{size=\small}
|
|
\setbeamerfont{date}{size=\small}
|
|
\setbeamerfont{section title}{size=\Large,%
|
|
series=\bfseries}
|
|
\setbeamerfont{plain title}{size=\Large,%
|
|
series=\bfseries}
|
|
\setbeamerfont{block title}{size=\normalsize,%
|
|
series=\bfseries}
|
|
\setbeamerfont{block title alerted}{size=\normalsize,%
|
|
series=\bfseries}
|
|
\setbeamerfont*{subtitle}{size=\large}
|
|
\setbeamerfont{frametitle}{size=\large,%
|
|
series=\bfseries}
|
|
\setbeamerfont{caption}{size=\small}
|
|
\setbeamerfont{caption name}{series=\bfseries}
|
|
\setbeamerfont{description item}{series=\bfseries}
|
|
\setbeamerfont{page number in head/foot}{size=\scriptsize}
|
|
\setbeamerfont{bibliography entry author}{size=\normalsize,%
|
|
series=\normalfont}
|
|
\setbeamerfont{bibliography entry title}{size=\normalsize,%
|
|
series=\bfseries}
|
|
\setbeamerfont{bibliography entry location}{size=\normalsize,%
|
|
series=\normalfont}
|
|
\setbeamerfont{bibliography entry note}{size=\small,%
|
|
series=\normalfont}
|
|
% \end{macrocode}
|
|
%
|
|
% \iffalse
|
|
%</package>
|
|
% \fi
|
|
% \Finale
|
|
\endinput
|