mirror of
https://github.com/matze/mtheme.git
synced 2024-06-25 07:27:45 +02:00
font theme overhaul
beamer font definitions are now standard latex based implemented conditional font loading scheme added demo frame to test font features better implementation of monospaced numbers in tables
This commit is contained in:
parent
f47e1696c3
commit
d2e03dc334
BIN
demo/demo.pdf
BIN
demo/demo.pdf
Binary file not shown.
|
@ -64,6 +64,22 @@ or show \textbf{bold} results.\end{verbatim}
|
|||
The theme provides sensible defaults to \emph{emphasize} text,
|
||||
\alert{accent} parts or show \textbf{bold} results.
|
||||
\end{frame}
|
||||
|
||||
\begin{frame}{Font feature test}
|
||||
\begin{itemize}
|
||||
\item Regular
|
||||
\item \textit{Italic}
|
||||
\item \textsc{SmallCaps}
|
||||
\item \textbf{Bold}
|
||||
\item \textbf{\textit{Bold Italic}}
|
||||
\item \textbf{\textsc{Bold SmallCaps}}
|
||||
\item \texttt{Monospace}
|
||||
\item \texttt{\textit{Monospace Italic}}
|
||||
\item \texttt{\textbf{Monospace Bold}}
|
||||
\item \texttt{\textbf{\textit{Monospace Bold Italic}}}
|
||||
\end{itemize}
|
||||
\end{frame}
|
||||
|
||||
\begin{frame}{Lists}
|
||||
\begin{columns}[T,onlytextwidth]
|
||||
\column{0.33\textwidth}
|
||||
|
|
|
@ -18,12 +18,69 @@
|
|||
\usepackage{xspace}
|
||||
\onehalfspacing
|
||||
|
||||
\usepackage{fontspec}
|
||||
\setmainfont[BoldItalicFont={Fira Sans Italic},%
|
||||
ItalicFont={Fira Sans Light Italic},%
|
||||
BoldFont={Fira Sans}]{Fira Sans Light}
|
||||
\setmonofont{Fira Mono}
|
||||
\defaultfontfeatures{Ligatures=TeX}
|
||||
\usepackage{etoolbox}
|
||||
\usepackage{ifxetex}
|
||||
\usepackage{ifluatex}
|
||||
|
||||
\ifboolexpr{bool {xetex} or bool {luatex}}{
|
||||
\usepackage{fontspec}
|
||||
\defaultfontfeatures{Ligatures=TeX}
|
||||
|
||||
\newcounter{fontsnotfound}
|
||||
\newcommand{\checkfont}[1]{%
|
||||
\suppressfontnotfounderror=1%
|
||||
\font\x = "#1" at 10pt
|
||||
\ifx\x\nullfont%
|
||||
\stepcounter{fontsnotfound}%
|
||||
\fi%
|
||||
\suppressfontnotfounderror=0%
|
||||
}
|
||||
|
||||
\newcommand{\iffontsexist}[3]{%
|
||||
\setcounter{fontsnotfound}{0}%
|
||||
\expandafter\forcsvlist\expandafter%
|
||||
\checkfont\expandafter{#1}%
|
||||
\ifnum\value{fontsnotfound}=0%
|
||||
#2%
|
||||
\else%
|
||||
#3%
|
||||
\fi%
|
||||
}
|
||||
\iffontsexist{Fira Sans Light,%
|
||||
Fira Sans Light Italic,%
|
||||
Fira Sans,%
|
||||
Fira Sans Italic}{%
|
||||
\setmainfont[BoldFont={Fira Sans}]{Fira Sans Light}%
|
||||
}{%
|
||||
\iffontsexist{Fira Sans Light OT,%
|
||||
Fira Sans Light Italic OT,%
|
||||
Fira Sans OT,%
|
||||
Fira Sans Italic OT}{%
|
||||
\setmainfont[BoldFont={Fira Sans OT}]{Fira Sans Light OT}%
|
||||
}{%
|
||||
\typeout{%
|
||||
Could not find Fira Sans fonts. Creating documentation%
|
||||
with standard fonts.%
|
||||
}
|
||||
}
|
||||
}
|
||||
\iffontsexist{Fira Mono, Fira Mono Bold}{%
|
||||
\setmonofont{Fira Mono}%
|
||||
}{%
|
||||
\iffontsexist{Fira Mono OT, Fira Mono Bold OT}{%
|
||||
\setmonofont{Fira Mono OT}%
|
||||
}{%
|
||||
\typeout{%
|
||||
Could not find Fira Sans fonts. Creating documentation%
|
||||
with standard monospaced fonts.%
|
||||
}
|
||||
}
|
||||
}
|
||||
}{
|
||||
\typeout{%
|
||||
You need to compile with XeLaTeX or LuaLaTeX to use the Fira fonts.%
|
||||
}
|
||||
}
|
||||
|
||||
\usepackage{enumitem}
|
||||
\setlist[itemize]{noitemsep}
|
||||
|
@ -63,7 +120,8 @@
|
|||
xrightmargin=0em,
|
||||
aboveskip=1em,
|
||||
belowskip=1em,
|
||||
morekeywords={usetheme,institute,maketitle,@metropolis@titleformat,plain,setbeamercolor,metroset},
|
||||
morekeywords={usetheme,institute,maketitle,@metropolis@titleformat,%
|
||||
plain,setbeamercolor,metroset,setsansfont,setmonofont},
|
||||
}
|
||||
\lstMakeShortInline|
|
||||
|
||||
|
@ -83,7 +141,7 @@
|
|||
\end{minipage}
|
||||
}
|
||||
|
||||
\newcommand{\themename}{\textsc{metropolis}\xspace}
|
||||
\newcommand{\themename}{\textbf{\textsc{metropolis}}\xspace}
|
||||
|
||||
\GetFileInfo{beamerthemem.dtx}
|
||||
\title{Modern Beamer Presentations with the \themename{} package}
|
||||
|
@ -113,7 +171,7 @@ By default, \themename{} uses
|
|||
{Fira Sans}, a gorgeous typeface commissioned by Mozilla and designed by
|
||||
\href{http://www.carrois.com/fira-3-1/}{Carrois}. For best results, you will
|
||||
need the Fira typeface installed and use Xe\LaTeX{} to typeset your slides.
|
||||
However, \themename{} can also be used other typefaces and \LaTeX{} build
|
||||
However, \themename{} can also be used with other typefaces and \LaTeX{} build
|
||||
systems.
|
||||
|
||||
\themename's codebase is maintained on \href{https://github.com/matze/mtheme}
|
||||
|
@ -125,6 +183,23 @@ the theme even better, please get in touch there. The
|
|||
|
||||
\section{Getting Started}
|
||||
|
||||
% \subsection{Installing from CTAN}
|
||||
% For the regular user it is recommended to install \themename{} from
|
||||
% \href{https://www.ctan.org}{CTAN}. In case you keep your \TeX\ distribution up-to-date,
|
||||
% chances are good that \themename{} is already installed. If it is not, you need to update
|
||||
% your packages. For \TeX\ Live (or Mac\TeX\ on OS X) the following command updates all
|
||||
% packages.
|
||||
|
||||
% \begin{lstlisting}
|
||||
% sudo tlmgr update --all
|
||||
% \end{lstlisting}
|
||||
|
||||
% For any other distribution please refer to its documentation on how to update your
|
||||
% packages.
|
||||
|
||||
% To get the most out of the theme you should also install the |Fira| fonts. Yet this
|
||||
% is not mandatory. \themename{} also works with the standard fonts.
|
||||
|
||||
\subsection{Installing from GitHub}
|
||||
|
||||
Installing \themename{}, like any Beamer theme, involves four easy steps:
|
||||
|
@ -161,6 +236,10 @@ options for advanced users:
|
|||
\item[|make ctan|] creates a package for CTAN distribution.
|
||||
\end{description}
|
||||
|
||||
\subsection{Installing the Debian Package}
|
||||
As an alternative users of Debian or Ubuntu can also install this
|
||||
\href{https://launchpad.net/\%7Eedd/+archive/ubuntu/misc/+files/latex-mtheme_0.1.0vidid1_all.deb}{.deb package}
|
||||
containing the theme files as well as the Fira Sans font files.
|
||||
|
||||
\subsection{A Minimal Example}
|
||||
|
||||
|
@ -191,13 +270,10 @@ The following code shows a minimal example of a Beamer presentation using \theme
|
|||
\item TikZ
|
||||
\end{itemize}
|
||||
|
||||
Depending on the Linux distribution, the packaged name of |Fira Sans| might be
|
||||
|Fira Sans OT| instead of |Fira Sans|. In that case, you may have to edit
|
||||
|beamerfontthememetropolis.dtx|. You may also need to install Fira Sans; see
|
||||
the |contrib/| directory for more. Users of Debian or Ubuntu can also install
|
||||
this \href{https://launchpad.net/\%7Eedd/+archive/ubuntu/misc/+files/latex-mtheme_0.1.0vidid1_all.deb}{.deb package} containing the theme files as well
|
||||
as the Fira Sans font files.
|
||||
|
||||
The |Fira Sans| font is not a hard dependency. \themename will try to load the
|
||||
font and use it if it is installed, but if not it will just use the standard
|
||||
font. Depending on the Linux distribution, the packaged name of |Fira Sans| might be
|
||||
|Fira Sans OT| instead of |Fira Sans|. \themename will check for this name too.
|
||||
|
||||
\subsection{Pandoc}
|
||||
|
||||
|
@ -321,9 +397,21 @@ of \themename specific colors, which can also be redefined to your liking.
|
|||
\setbeamercolor{progress bar in section page}{ ... }
|
||||
\end{lstlisting}
|
||||
|
||||
\subsection{Font Customization}
|
||||
|
||||
The default font for \themename{} is |Fira|. Yet this can be easily changed using
|
||||
the standard font selection commands of the |fontspec| package. So if you for
|
||||
example prefer the \href{http://font.ubuntu.com}{|Ubuntu|} font family just add
|
||||
the following two commands after loading the \themename{} theme.
|
||||
|
||||
\begin{lstlisting}
|
||||
\setsansfont{Ubuntu}
|
||||
\setmonofont{Ubuntu Mono}
|
||||
\end{lstlisting}
|
||||
|
||||
\subsection{Commands}
|
||||
|
||||
The |\plain{title=[]}{<body>}| command sets a slide in plain dark colors which
|
||||
The \lstinline|\plain{title=[]}{<body>}| command sets a slide in plain dark colors which
|
||||
can be useful to focus attention on a single sentence or image.
|
||||
|
||||
\subsection{Paul Tol's colors: a \texttt{pgfplots} theme}
|
||||
|
@ -347,7 +435,7 @@ or horizontal |mbarplot| to plot bar charts.
|
|||
|
||||
\section{Known Issues}
|
||||
|
||||
The |\plain| command does not work if you override the \textsc{metropolis}
|
||||
The \lstinline|\plain| command does not work if you override the \textsc{metropolis}
|
||||
color theme with the default beamer color theme |fly|.
|
||||
|
||||
\section{License}
|
||||
|
|
Binary file not shown.
|
@ -13,7 +13,7 @@
|
|||
%<driver> \ProvidesFile{beamerfontthememetropolis.dtx}
|
||||
%<*package>
|
||||
\NeedsTeXFormat{LaTeX2e}
|
||||
\ProvidesPackage{beamerfontthememetropolis}[2015/06/12 Metropolis font theme]
|
||||
\ProvidesPackage{beamerfontthememetropolis}[2015/10/24 Metropolis font theme]
|
||||
%</package>
|
||||
%<driver> \documentclass{ltxdoc}
|
||||
%<driver> \usepackage{beamerfontthememetropolis}
|
||||
|
@ -26,53 +26,141 @@
|
|||
% \iffalse
|
||||
%<*package>
|
||||
% ------------------------------------------------------------------------- \fi
|
||||
% \subsection{Fira font theme}
|
||||
% Font Definitions
|
||||
% \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}
|
||||
\defaultfontfeatures{Mapping=tex-text}
|
||||
% \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
|
||||
\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}
|
||||
\RequirePackage[no-math]{fontspec}
|
||||
\defaultfontfeatures{Mapping=tex-text}
|
||||
\setsansfont[BoldItalicFont={Fira Sans Italic},%
|
||||
ItalicFont={Fira Sans Light Italic},%
|
||||
BoldFont={Fira Sans}]{Fira Sans Light}
|
||||
\setmonofont{Fira Mono}
|
||||
\newfontfamily\ExtraLight{Fira Sans ExtraLight}
|
||||
\newfontfamily\Light{Fira Sans Light}
|
||||
\newfontfamily\Book{Fira Sans}
|
||||
\newfontfamily\Medium{Fira Sans Medium}
|
||||
\AtBeginEnvironment{tabular}{%
|
||||
\setsansfont[BoldFont={Fira Sans},%
|
||||
Numbers={Monospaced}]{Fira Sans Light}%
|
||||
\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{beamerthemem}{%
|
||||
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{beamerthemem}{%
|
||||
Could not find Fira Mono fonts.%
|
||||
}
|
||||
}
|
||||
}
|
||||
\AtBeginEnvironment{tabular}{%
|
||||
\addfontfeature{Numbers={Monospaced}}%
|
||||
}
|
||||
}{%
|
||||
\PackageWarning{beamerthemem}{%
|
||||
You need to compile with XeLaTeX or LuaLaTeX to use the Fira fonts.%
|
||||
}
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Font Assignment
|
||||
%
|
||||
%
|
||||
% \subsubsection{General font definitions}
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\setbeamerfont{title}{family=\Book, size=\Large, shape=\scshape}
|
||||
\setbeamerfont{author}{family=\ExtraLight, size=\small}
|
||||
\setbeamerfont{date}{family=\ExtraLight, size=\small}
|
||||
\setbeamerfont{section title}{family=\Book, size=\Large, shape=\scshape}
|
||||
\setbeamerfont{block title}{family=\Book, size=\normalsize}
|
||||
\setbeamerfont{block title alerted}{family=\Book,size=\normalsize}
|
||||
\setbeamerfont{subtitle}{family=\Light, size=\fontsize{12}{14}}
|
||||
\setbeamerfont{frametitle}{family=\Book, size=\large, shape=\scshape}
|
||||
\setbeamerfont{title}{size=\Large,%
|
||||
series=\bfseries,%
|
||||
shape=\scshape}
|
||||
\setbeamerfont{author}{size=\small}
|
||||
\setbeamerfont{date}{size=\small}
|
||||
\setbeamerfont{section title}{size=\Large,%
|
||||
series=\bfseries,%
|
||||
shape=\scshape}
|
||||
\setbeamerfont{block title}{size=\normalsize,%
|
||||
series=\bfseries}
|
||||
\setbeamerfont{block title alerted}{size=\normalsize,%
|
||||
series=\bfseries}
|
||||
\setbeamerfont*{subtitle}{size=\large,%
|
||||
shape=\scshape}
|
||||
\setbeamerfont{frametitle}{size=\large,%
|
||||
series=\bfseries,%
|
||||
shape=\scshape}
|
||||
\setbeamerfont{caption}{size=\small}
|
||||
\setbeamerfont{caption name}{family=\Book}
|
||||
\setbeamerfont{description item}{family=\Book}
|
||||
\setbeamerfont{caption name}{series=\bfseries}
|
||||
\setbeamerfont{description item}{series=\bfseries}
|
||||
\setbeamerfont{page number in head/foot}{size=\scriptsize}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Bibliograpy
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\setbeamerfont{bibliography entry author}{family=\Light, size=\normalsize}
|
||||
\setbeamerfont{bibliography entry title}{family=\Book, size=\normalsize}
|
||||
\setbeamerfont{bibliography entry location}{family=\Light, size=\normalsize}
|
||||
\setbeamerfont{bibliography entry note}{family=\Light, size=\small}
|
||||
\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}
|
||||
\linespread{1.15}
|
||||
% \end{macrocode}
|
||||
|
||||
%
|
||||
% \iffalse
|
||||
%</package>
|
||||
|
|
|
@ -37,8 +37,6 @@
|
|||
% \begin{macrocode}
|
||||
\RequirePackage{etoolbox}
|
||||
\RequirePackage{pgfopts}
|
||||
\RequirePackage{ifxetex}
|
||||
\RequirePackage{ifluatex}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \subsubsection{Options}
|
||||
|
@ -136,19 +134,7 @@
|
|||
\useinnertheme{metropolis}
|
||||
\useoutertheme{metropolis}
|
||||
\usecolortheme{metropolis}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% The |fira| font theme, which depends on |fontspec|, is only loaded if the
|
||||
% document is being processed by Xe\LaTeX{} or Lua\LaTeX{}.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\ifboolexpr{bool {xetex} or bool {luatex}}{
|
||||
\usefonttheme{metropolis}
|
||||
}{
|
||||
\PackageWarning{beamerthemem}{%
|
||||
You need to compile with XeLaTeX or LuaLaTeX to use the Fira fonts.
|
||||
}
|
||||
}
|
||||
\usefonttheme{metropolis}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% The |tol| theme for |pgfplots| is only loaded if |pgfplots| is used.
|
||||
|
|
Loading…
Reference in New Issue
Block a user