Merge pull request #174 from rchurchley/updates

Move titleformat options to font theme (and other tidying)
This commit is contained in:
Matthias Vogelgesang 2016-02-09 07:59:46 +01:00
commit c997553cad
6 changed files with 526 additions and 447 deletions

View File

@ -37,7 +37,7 @@
\suppressfontnotfounderror=0% \suppressfontnotfounderror=0%
} }
\newcommand{\iffontsexist}[3]{% \newcommand{\iffontsavailable}[3]{%
\setcounter{fontsnotfound}{0}% \setcounter{fontsnotfound}{0}%
\expandafter\forcsvlist\expandafter% \expandafter\forcsvlist\expandafter%
\checkfont\expandafter{#1}% \checkfont\expandafter{#1}%
@ -47,13 +47,13 @@
#3% #3%
\fi% \fi%
} }
\iffontsexist{Fira Sans Light,% \iffontsavailable{Fira Sans Light,%
Fira Sans Light Italic,% Fira Sans Light Italic,%
Fira Sans,% Fira Sans,%
Fira Sans Italic}{% Fira Sans Italic}{%
\setmainfont[BoldFont={Fira Sans}]{Fira Sans Light}% \setmainfont[BoldFont={Fira Sans}]{Fira Sans Light}%
}{% }{%
\iffontsexist{Fira Sans Light OT,% \iffontsavailable{Fira Sans Light OT,%
Fira Sans Light Italic OT,% Fira Sans Light Italic OT,%
Fira Sans OT,% Fira Sans OT,%
Fira Sans Italic OT}{% Fira Sans Italic OT}{%
@ -65,10 +65,10 @@
} }
} }
} }
\iffontsexist{Fira Mono, Fira Mono Bold}{% \iffontsavailable{Fira Mono, Fira Mono Bold}{%
\setmonofont{Fira Mono}% \setmonofont{Fira Mono}%
}{% }{%
\iffontsexist{Fira Mono OT, Fira Mono Bold OT}{% \iffontsavailable{Fira Mono OT, Fira Mono Bold OT}{%
\setmonofont{Fira Mono OT}% \setmonofont{Fira Mono OT}%
}{% }{%
\typeout{% \typeout{%
@ -147,20 +147,22 @@
\GetFileInfo{beamerthememetropolis.dtx} \GetFileInfo{beamerthememetropolis.dtx}
\title{Modern Beamer Presentations with the \themename package} \title{Modern Beamer Presentations with the \themename package}
\author{Matthias Vogelgesang \\ \url{matthias.vogelgesang@gmail.com}} \author{Matthias Vogelgesang \\ \url{matthias.vogelgesang@gmail.com}}
\date{v1.0 -- 2015/12/04} \date{v1.1 --- 2016/02/06}
\begin{document} \begin{document}
\maketitle \maketitle
\tableofcontents \tableofcontents
\section{Introduction} \section{Introduction}
Beamer is an awesome way to make presentations with LaTeX, but its theme Beamer is an awesome way to make presentations with LaTeX, but its theme
selection is surprisingly sparse. The stock themes share an aesthetic that is selection is surprisingly sparse. The stock themes share an aesthetic that is
now overused and can be a little cluttered, and the few distinctive custom can be a little cluttered, and the few distinctive custom themes available are
themes available are often specialized for a particular corporate or often specialized for a particular corporate or institutional brand.
institutional brand.
The goal of \themename is to provide a simple, modern Beamer theme suitable The goal of \themename is to provide a simple, modern Beamer theme suitable
for anyone to use. It tries to minimize noise and maximize space for content; for anyone to use. It tries to minimize noise and maximize space for content;
@ -182,24 +184,29 @@ the theme even better, please get in touch there. The
{full list of contributors} already contains over a dozen names! {full list of contributors} already contains over a dozen names!
\section{Getting Started} \section{Getting Started}
\subsection{Installing from CTAN} \subsection{Installing from CTAN}
For the regular user it is recommended to install \themename from For the regular user it is recommended to install \themename from
\href{https://www.ctan.org}{CTAN}. In case you keep your \TeX\ distribution \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, up-to-date, chances are good that \themename is already installed. If it is
you need to update your packages. For \TeX\ Live (or Mac\TeX\ on OS X) the not, you need to update your packages. For \TeX\ Live (or Mac\TeX\ on OS X)
following command updates all packages. the following command updates all packages.
\begin{lstlisting} \begin{lstlisting}
sudo tlmgr update --all sudo tlmgr update --all
\end{lstlisting} \end{lstlisting}
For any other distribution please refer to its documentation on how to update your For any other distribution please refer to its documentation on how to update
packages. 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.
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} \subsection{Installing from GitHub}
@ -237,11 +244,15 @@ options for advanced users:
\item[|make ctan|] creates a package for CTAN distribution. \item[|make ctan|] creates a package for CTAN distribution.
\end{description} \end{description}
\subsection{Installing the Debian Package} \subsection{Installing the Debian Package}
As an alternative users of Debian or Ubuntu can also install this 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} \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. containing the theme files as well as the Fira Sans font files.
\subsection{A Minimal Example} \subsection{A Minimal Example}
The following code shows a minimal example of a Beamer presentation using The following code shows a minimal example of a Beamer presentation using
@ -264,19 +275,32 @@ The following code shows a minimal example of a Beamer presentation using
\end{lstlisting} \end{lstlisting}
\subsection{Dependencies} \subsection{Dependencies}
\begin{itemize} \themename depends on the |beamer| class and the following standard packages:
\item TikZ \begin{multicols}{3}
\item XeLaTeX or LuaTeX \begin{itemize}
\item \href{https://github.com/mozilla/Fira}{Fira Sans} and Mono font \item |tikz|
\end{itemize} \item |pgfopts|
\item |etoolbox|
\item |calc|
\item |ifxetex|
\item |ifluatex|
\end{itemize}
\end{multicols}
For best results, we recommend installing the fonts
\href{https://github.com/mozilla/Fira}{|Fira Sans|} and |Fira Mono|
and compiling with \themename using Xe\LaTeX{} or Lua\TeX{}.
These are optional dependencies; \themename is compatible with (e.g.)
pdf\LaTeX{} and will fall back to standard fonts if |Fira Sans| or |Fira Mono|
is not installed.
The packaged name of |Fira Sans| is |Fira Sans OT| in some Linux
distributions; this case is automatically handled by \themename.
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} \subsection{Pandoc}
@ -291,111 +315,97 @@ $ pandoc -t beamer --latex-engine=xelatex -V theme:metropolis -o output.pdf inpu
\section{Customization} \section{Customization}
\subsection{Package options} \subsection{Package options}
The theme provides a number of options. The options use a key=value interface.
So every option is controlled by a key its value. To use an option you can The theme provides a number of options, which can be set using a key=value
either provide a comma separated list of options when invoking interface. The primary way to set options is to provide a comma-separated list
\textsc{metropolis} in the preamble of the presentation. of option-value pairs when loading \themename in the preamble:
\begin{lstlisting} \begin{lstlisting}
\usetheme[<key=value list>]{metropolis} \usetheme[option1=value1, option2=value2, ...]{metropolis}
\end{lstlisting} \end{lstlisting}
Or you can set them at any time with the |\metroset| macro.
Options can be changed at any time --- even mid-presentation! --- with the
|\metroset| macro.
\begin{lstlisting} \begin{lstlisting}
\metroset{<key=value list>} \metroset{option1=newvalue1, option2=newvalue2, ...}
\end{lstlisting}
To set an option on a specific sub-package only you have to add the
corresponding prefix (inner, outer, color), e.g.
\begin{lstlisting}
\metroset{inner/block=fill}
\end{lstlisting} \end{lstlisting}
The list of options is structured as shown in the following example. The list of options is structured as shown in the following example.
\DescribeOption{key}{list of possible values}{default value}{ \DescribeOption{option key}{list of possible values}{default}{
A short description of the option. A short description of the option.
} }
Although the options are grouped into the corresponding packages every option
can and in most cases should be set on the main theme directly. If an option
is listed in multiple sub-packages, setting it on the main theme will set the
option on every sub-package accordingly.
\subsubsection{Main theme} \subsubsection{Main theme}
\DescribeOption{titleformat}% \DescribeOption{titleformat}%
{regular, smallcaps, allsmallcaps, allcaps} {regular, smallcaps, allsmallcaps, allcaps}
{regular}{ {regular}{
Shortcut option to change the titleformat of all titles together. Please Changes the format of titles, subtitles, section titles, frame titles, and
refer to section \ref{sec:titleformats} for known issues. the text on standout ``plain'' frames. The available options produce
Regular, \textsc{SmallCaps}, \textsc{\MakeLowercase{AllSmallCaps}}, or
\MakeUppercase{AllCaps} titles. Please refer to
Section~\ref{sec:titleformats} for known issues with these options.
} }
\DescribeOption{titleformat plain}% \DescribeOption{titleformat-plain}%
{regular, smallcaps, allsmallcaps, allcaps}% {regular, smallcaps, allsmallcaps, allcaps}%
{regular}{ {regular}{
Control the titleformat of the plain title. Please refer to section Changes the format of standout ``plain'' frames (see |titleformat|, above).
\ref{sec:titleformats} for known issues.
} }
\subsubsection{Inner theme} \subsubsection{Inner theme}
\DescribeOption{block}{transparent, fill}{transparent}{ \DescribeOption{block}{transparent, fill}{transparent}{
This option controls the block background. It can either be filled with a Optionally adds a light grey background to block environments like |theorem|
light grey or be transparent. and |example|.
} }
\DescribeOption{sectionpage}{none, simple, progressbar}{progressbar}{ \DescribeOption{sectionpage}{none, simple, progressbar}{progressbar}{
Disable section pages at all, typeset centered section title or add a thin Adds a slide at the start of each section (|simple|) with an optional thin
progress bar below the centered section title. progress bar below the section title (|progressbar|). The |none| option
} disables the section page.
\DescribeOption{titleformat title}%
{regular, smallcaps, allsmallcaps, allcaps}%
{regular}{
Control the titleformat of the title. Please refer to section
\ref{sec:titleformats} for known issues.
}
\DescribeOption{titleformat subtitle}%
{regular, smallcaps, allsmallcaps, allcaps}%
{regular}{
Control the titleformat of the subtitle. Please refer to section
\ref{sec:titleformats} for known issues.
}
\DescribeOption{titleformat section}%
{regular, smallcaps, allsmallcaps, allcaps}%
{regular}{
Control the titleformat of the section title. Please refer to section
\ref{sec:titleformats} for known issues.
} }
\subsubsection{Outer theme} \subsubsection{Outer theme}
\DescribeOption{numbering}{none, counter, fraction}{counter}{ \DescribeOption{numbering}{none, counter, fraction}{counter}{
In the bottom right corner of each frame the current frame number is Controls whether the frame number at the bottom right of each slide is
displayed. This can be disabled or the total framenumber can be added omitted (|none|), shown (|counter|) or displayed as a fraction of the total
additionally. number of frames (|fraction|).
} }
\DescribeOption{progressbar}{none, head, frametitle, foot}{none}{ \DescribeOption{progressbar}{none, head, frametitle, foot}{none}{
Adds a progress bar to the top of each frame (|head|), the bottom of each Optionally adds a progress bar to the top of each frame (|head|),
frame (|foot|), or directly below each frame title (|frametitle|). the bottom of each frame (|foot|), or directly below each frame title
} (|frametitle|).
\DescribeOption{titleformat frame}%
{regular, smallcaps, allsmallcaps, allcaps}%
{regular}{
Control the titleformat of the frame title. Please refer to section
\ref{sec:titleformats} for known issues.
} }
\subsubsection{Color theme} \subsubsection{Color theme}
\DescribeOption{block}{transparent, fill}{transparent}{ \DescribeOption{block}{transparent, fill}{transparent}{
This option controls the block background. It can either be filled with a Optionally adds a light grey background to block environments like |theorem|
light grey or be transparent. and |example|.
} }
\DescribeOption{background}{dark, light}{light}{ \DescribeOption{background}{dark, light}{light}{
This option defines whether the background shall be dark and the foreground Provides the option to have a dark background and light foreground instead
be light or vice versa. of the reverse.
} }
\subsubsection{Font theme}
\DescribeMacro{titleformat-title}
\DescribeMacro{titleformat-subtitle}
\DescribeMacro{titeformat-section}
\DescribeOption{titleformat-frame}%
{regular, smallcaps, allsmallcaps, allcaps}%
{regular}{
Individually controls the format of titles, subtitles, section titles, and
frame titles (see |titleformat|, above).
}
\subsection{Color Customization} \subsection{Color Customization}
The included \themename color theme is used by default, but its colors can be The included \themename color theme is used by default, but its colors can be
@ -422,12 +432,13 @@ of \themename specific colors, which can also be redefined to your liking.
\setbeamercolor{progress bar in section page}{ ... } \setbeamercolor{progress bar in section page}{ ... }
\end{lstlisting} \end{lstlisting}
\subsection{Font Customization} \subsection{Font Customization}
The default font for \themename is |Fira|. Yet this can be easily changed using The default font for \themename is |Fira|. This can be easily changed using
the standard font selection commands of the \textsf{fontspec} package. So if the standard font selection commands of the \textsf{fontspec} package. So if
you for example prefer the \href{http://font.ubuntu.com}{|Ubuntu|} font family you prefer, for example, the \href{http://font.ubuntu.com}{|Ubuntu|} font family, just add the following two commands after loading the \themename theme.
just add the following two commands after loading the \themename theme.
\begin{lstlisting} \begin{lstlisting}
\setsansfont{Ubuntu} \setsansfont{Ubuntu}
@ -438,8 +449,8 @@ just add the following two commands after loading the \themename theme.
\subsubsection{Old style figures} \subsubsection{Old style figures}
The regular \textsf{fontspec} mechanism for changing glyph appearance applies The regular \textsf{fontspec} mechanism for changing glyph appearance applies
also to this theme. In case you want to have old style figures in the text but also to this theme. If you want to have old style figures in the text but
regular lined figures for math, you have to add the following to your preamble: regular lined figures for math, you could add the following to your preamble:
\begin{lstlisting} \begin{lstlisting}
\usefonttheme{professionalfonts} % required for mathspec \usefonttheme{professionalfonts} % required for mathspec
@ -477,16 +488,21 @@ based on Tol's work. Use the |mlineplot| key to plot line data and |mbarplot|
or horizontal |mbarplot| to plot bar charts. or horizontal |mbarplot| to plot bar charts.
\section{Known Issues} \section{Known Issues}
\subsection{Titleformats} \subsection{Title formats}
\label{sec:titleformats} \label{sec:titleformats}
If you want to use either |smallcaps| or |allsmallcaps| be aware that not
every font supports small caps. So make sure the font you are using does.
|allsmallcaps| and |allcaps| are quite nice from an aesthetic point of view, Be aware that not every font supports small caps, so the |smallcaps| or
but they introduce some issues by using |\MakeLowercase| and |\MakeUppercase|, |allsmallcaps| options may not work if you use a font other than |Fira Sans|.
respectively. In particular, the Computer Modern sans-serif typeface, which is used when
\themename is compiled with pdf\LaTeX, does not have a small-caps variant.
The title format options |allsmallcaps| and |allcaps| are quite nice from an
aesthetic point of view, but their use of |\MakeLowercase| and
|\MakeUppercase| can cause unexpected problems. For example:
\begin{itemize} \begin{itemize}
\item Some commands, like |\\|, do not work inside |\MakeLowercase| and \item Some commands, like |\\|, do not work inside |\MakeLowercase| and
@ -505,18 +521,26 @@ respectively.
\href{https://github.com/matze/mtheme/issues/153}{\#153}) \href{https://github.com/matze/mtheme/issues/153}{\#153})
\end{itemize} \end{itemize}
The |allsmallcaps| and |allcaps| options are safe to use if your titles contain
only alphabetic characters and do not require the expansion of any macros.
\subsection{Plain Frame} \subsection{Plain Frame}
The |\plain| command does not work if you override the \themename color theme The |\plain| command does not work if you override the \themename color theme
with the default beamer color theme |fly|. with the default beamer color theme |fly|.
\section{License} \section{License}
The theme itself is licensed under a \themename is licensed under a
\href{http://creativecommons.org/licenses/by-sa/4.0/}{Creative Commons \href{http://creativecommons.org/licenses/by-sa/4.0/}{Creative Commons
Attribution-ShareAlike 4.0 International License}. This means that if you change Attribution-ShareAlike 4.0 International License}.
the theme and re-distribute it, you must retain the copyright notice header and This means that if you change the theme and re-distribute it, you must retain
license it under the same CC-BY-SA license. This does not affect the the copyright notice header and license it under the same CC-BY-SA license.
presentation that you create with the theme. This does not affect any presentations that you create with the theme.

View File

@ -13,7 +13,7 @@
%<driver> \ProvidesFile{beamercolorthememetropolis.dtx} %<driver> \ProvidesFile{beamercolorthememetropolis.dtx}
%<*package> %<*package>
\NeedsTeXFormat{LaTeX2e} \NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{beamercolorthememetropolis}[2015/12/04 Metropolis color theme] \ProvidesPackage{beamercolorthememetropolis}[2016/02/06 Metropolis color theme]
%</package> %</package>
%<driver> \documentclass{ltxdoc} %<driver> \documentclass{ltxdoc}
%<driver> \usepackage{beamercolorthememetropolis} %<driver> \usepackage{beamercolorthememetropolis}
@ -27,9 +27,11 @@
%<*package> %<*package>
% ------------------------------------------------------------------------- \fi % ------------------------------------------------------------------------- \fi
% %
% \subsection{\textsc{metropolis} color theme} % \subsection{\themename color theme}
% %
% Load required packages. %
%
% \subsubsection{Package dependencies}
% \begin{macrocode} % \begin{macrocode}
\RequirePackage{pgfopts} \RequirePackage{pgfopts}
% \end{macrocode} % \end{macrocode}
@ -39,34 +41,34 @@
% \subsubsection{Options} % \subsubsection{Options}
% %
% \begin{macro}{block} % \begin{macro}{block}
% This option controls whether the blocks are filled or transparent. % Controls whether block environments are filled or transparent.
% \begin{macrocode} % \begin{macrocode}
\pgfkeys{ \pgfkeys{
/metropolis/color/block/.cd, /metropolis/color/block/.cd,
.is choice, .is choice,
transparent/.code=\@metropolis@block@transparent, transparent/.code=\metropolis@block@transparent,
fill/.code=\@metropolis@block@fill, fill/.code=\metropolis@block@fill,
} }
% \end{macrocode} % \end{macrocode}
% \end{macro} % \end{macro}
% %
% \begin{macro}{colors} % \begin{macro}{colors}
% Defines whether the background shall be dark and the foreground be light or % Provides the option to have a dark background and light foreground instead
% vice versa % of the reverse.
% \begin{macrocode} % \begin{macrocode}
\pgfkeys{ \pgfkeys{
/metropolis/color/background/.cd, /metropolis/color/background/.cd,
.is choice, .is choice,
dark/.code=\@metropolis@colors@dark, dark/.code=\metropolis@colors@dark,
light/.code=\@metropolis@colors@light, light/.code=\metropolis@colors@light,
} }
% \end{macrocode} % \end{macrocode}
% \end{macro} % \end{macro}
% %
% \begin{macro}{\@metropolis@color@setdefaults} % \begin{macro}{\metropolis@color@setdefaults}
% Set default values for color theme options. % Sets default values for color theme options.
% \begin{macrocode} % \begin{macrocode}
\newcommand{\@metropolis@color@setdefaults}{ \newcommand{\metropolis@color@setdefaults}{
\pgfkeys{/metropolis/color/.cd, \pgfkeys{/metropolis/color/.cd,
background=light, background=light,
block=transparent, block=transparent,
@ -90,17 +92,17 @@
% %
% \subsubsection{Base styles} % \subsubsection{Base styles}
% %
% All colors in the \textsc{metropolis} theme are derived from the definitions % All colors in \themename are derived from the definitions of |normal text|,
% of |normal text|, |alerted text|, and |example text|. % |alerted text|, and |example text|.
% %
% \begin{macrocode} % \begin{macrocode}
\newcommand{\@metropolis@colors@dark}{ \newcommand{\metropolis@colors@dark}{
\setbeamercolor{normal text}{% \setbeamercolor{normal text}{%
fg=black!2, fg=black!2,
bg=mDarkTeal bg=mDarkTeal
} }
} }
\newcommand{\@metropolis@colors@light}{ \newcommand{\metropolis@colors@light}{
\setbeamercolor{normal text}{% \setbeamercolor{normal text}{%
fg=mDarkTeal, fg=mDarkTeal,
bg=black!2 bg=black!2
@ -133,8 +135,8 @@
% \end{macrocode} % \end{macrocode}
% %
% The “primary” palette should be used for the most important navigational % The “primary” palette should be used for the most important navigational
% elements, and possibly of other elements. The \textsc{metropolis} theme uses % elements, and possibly of other elements. \themename uses it for frame
% it for frame titles and slides. % titles and slides.
% %
% \begin{macrocode} % \begin{macrocode}
\setbeamercolor{palette primary}{% \setbeamercolor{palette primary}{%
@ -148,7 +150,7 @@
} }
% \end{macrocode} % \end{macrocode}
% %
% The \textsc{metropolis} inner or outer themes optionally display progress % The \themename inner or outer themes optionally display progress
% bars in various locations. Their color is set by |progress bar| but the two % bars in various locations. Their color is set by |progress bar| but the two
% different kinds can be customized separately. The horizontal rule on the % different kinds can be customized separately. The horizontal rule on the
% title page is also set based on the progress bar color and can be customized % title page is also set based on the progress bar color and can be customized
@ -177,10 +179,10 @@
% Blocks % Blocks
% %
% \begin{macrocode} % \begin{macrocode}
\newcommand{\@metropolis@block@transparent}{ \newcommand{\metropolis@block@transparent}{
\setbeamercolor{block title}{use=normal text, parent=normal text} \setbeamercolor{block title}{use=normal text, parent=normal text}
} }
\newcommand{\@metropolis@block@fill}{ \newcommand{\metropolis@block@fill}{
\setbeamercolor{block title}{% \setbeamercolor{block title}{%
use=normal text, use=normal text,
fg=normal text.fg, fg=normal text.fg,
@ -215,7 +217,7 @@
% Process package options % Process package options
% %
% \begin{macrocode} % \begin{macrocode}
\@metropolis@color@setdefaults \metropolis@color@setdefaults
\ProcessPgfPackageOptions{/metropolis/color} \ProcessPgfPackageOptions{/metropolis/color}
% \end{macrocode} % \end{macrocode}
% %

View File

@ -13,7 +13,7 @@
%<driver> \ProvidesFile{beamerfontthememetropolis.dtx} %<driver> \ProvidesFile{beamerfontthememetropolis.dtx}
%<*package> %<*package>
\NeedsTeXFormat{LaTeX2e} \NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{beamerfontthememetropolis}[2015/12/04 Metropolis font theme] \ProvidesPackage{beamerfontthememetropolis}[2016/02/06 Metropolis font theme]
%</package> %</package>
%<driver> \documentclass{ltxdoc} %<driver> \documentclass{ltxdoc}
%<driver> \usepackage{beamerfontthememetropolis} %<driver> \usepackage{beamerfontthememetropolis}
@ -26,29 +26,36 @@
% \iffalse % \iffalse
%<*package> %<*package>
% ------------------------------------------------------------------------- \fi % ------------------------------------------------------------------------- \fi
% \subsection{\textsc{metropolis} font theme} %
% \subsection{\themename font theme}
%
% A |beamer| font theme sets the style of the font used in the document.
% %
% %
% Load required packages. %
% \subsubsection{Package dependencies}
%
% \begin{macrocode} % \begin{macrocode}
\RequirePackage{etoolbox} \RequirePackage{etoolbox}
\RequirePackage{ifxetex} \RequirePackage{ifxetex}
\RequirePackage{ifluatex} \RequirePackage{ifluatex}
\RequirePackage{pgfopts}
% \end{macrocode} % \end{macrocode}
% %
% \subsubsection{Load Fira font} %
% If the presentation is compiled with XeLaTeX or LuaLaTeX the fontspec package %
% will be loaded. % \subsubsection{Load Fira fonts}
%
% If the presentation is compiled with Xe\LaTeX{} or Lua\LaTeX{}, the fontspec
% package is loaded and we search for the |Fira| fonts.
%
% \begin{macrocode} % \begin{macrocode}
\ifboolexpr{bool {xetex} or bool {luatex}}{ \ifboolexpr{bool {xetex} or bool {luatex}}{
\RequirePackage[no-math]{fontspec} \RequirePackage[no-math]{fontspec}
% \end{macrocode} % \end{macrocode}
% %
% To simplify the check whether the |Fira| fonts are installed, a set macros is
% defined.
%
% \begin{macro}{\checkfont} % \begin{macro}{\checkfont}
% Checks if a font is installed and increases |fontsnotfound| counter if not. % Checks if a font is installed; if not, |fontsnotfound| is increased.
% \begin{macrocode} % \begin{macrocode}
\newcounter{fontsnotfound} \newcounter{fontsnotfound}
\newcommand{\checkfont}[1]{% \newcommand{\checkfont}[1]{%
@ -64,11 +71,11 @@
% \end{macrocode} % \end{macrocode}
% \end{macro} % \end{macro}
% %
% \begin{macro}{\iffontexists} % \begin{macro}{\iffontsavailable}
% Resets the |fontsnotfound| counter and calls |\checkfont| for each font in % Resets the |fontsnotfound| counter and calls |\checkfont| for each font in
% the comma separated list in the first argument. % the comma separated list in the first argument.
% \begin{macrocode} % \begin{macrocode}
\newcommand{\iffontsexist}[3]{% \newcommand{\iffontsavailable}[3]{%
\setcounter{fontsnotfound}{0}% \setcounter{fontsnotfound}{0}%
\expandafter\forcsvlist\expandafter% \expandafter\forcsvlist\expandafter%
\checkfont\expandafter{#1}% \checkfont\expandafter{#1}%
@ -81,19 +88,19 @@
% \end{macrocode} % \end{macrocode}
% \end{macro} % \end{macro}
% %
% Using the previously defined macros it is tried to load the |Fira| fonts. % We search for regular, italic, light, light italic, mono, and mono bold
% First the default |Fira| name will be tried. Second the |Fira| fonts with % fonts under the default |Fira Sans| and |Fira Mono| names. If this fails,
% the suffix OT -- used by some Linux distributions -- will be tried. If this % 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. % also fails, a warning will be displayed and the standard fonts will be used.
% %
% \begin{macrocode} % \begin{macrocode}
\iffontsexist{Fira Sans Light,% \iffontsavailable{Fira Sans Light,%
Fira Sans Light Italic,% Fira Sans Light Italic,%
Fira Sans,% Fira Sans,%
Fira Sans Italic}{% Fira Sans Italic}{%
\setsansfont[BoldFont={Fira Sans}]{Fira Sans Light}% \setsansfont[BoldFont={Fira Sans}]{Fira Sans Light}%
}{% }{%
\iffontsexist{Fira Sans Light OT,% \iffontsavailable{Fira Sans Light OT,%
Fira Sans Light Italic OT,% Fira Sans Light Italic OT,%
Fira Sans OT,% Fira Sans OT,%
Fira Sans Italic OT}{% Fira Sans Italic OT}{%
@ -104,10 +111,10 @@
} }
} }
} }
\iffontsexist{Fira Mono, Fira Mono Bold}{% \iffontsavailable{Fira Mono, Fira Mono Bold}{%
\setmonofont{Fira Mono}% \setmonofont{Fira Mono}%
}{% }{%
\iffontsexist{Fira Mono OT, Fira Mono Bold OT}{% \iffontsavailable{Fira Mono OT, Fira Mono Bold OT}{%
\setmonofont{Fira Mono OT}% \setmonofont{Fira Mono OT}%
}{% }{%
\PackageWarning{beamerthememetropolis}{% \PackageWarning{beamerthememetropolis}{%
@ -125,6 +132,10 @@
} }
% \end{macrocode} % \end{macrocode}
% %
% This concludes the portion of the code which is only run when compiled with
% Xe\LaTeX{} or Lua\LaTeX{}. The remainder of this package applies regardless
% of the compiling engine.
%
% %
% %
% \subsubsection{General font definitions} % \subsubsection{General font definitions}
@ -159,6 +170,235 @@
series=\normalfont} series=\normalfont}
% \end{macrocode} % \end{macrocode}
% %
%
%
% \subsubsection{Title format options}
%
% \begin{macro}{titleformat title}
% Controls the format of the title.
% \begin{macrocode}
\pgfkeys{
/metropolis/font/titleformat title/.cd,
.is choice,
regular/.code={%
\let\metropolis@titleformat\@empty%
\setbeamerfont{title}{shape=\normalfont}%
},
smallcaps/.code={%
\let\metropolis@titleformat\@empty%
\setbeamerfont{title}{shape=\scshape}%
},
allsmallcaps/.code={%
\let\metropolis@titleformat\lowercase%
\setbeamerfont{title}{shape=\scshape}%
\PackageWarning{beamerthememetropolis}{%
Be aware that titleformat title=allsmallcaps can lead to problems%
}
},
allcaps/.code={%
\let\metropolis@titleformat\uppercase%
\setbeamerfont{title}{shape=\normalfont}
\PackageWarning{beamerthememetropolis}{%
Be aware that titleformat title=allcaps can lead to problems%
}
},
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{titleformat subtitle}
% Control the format of the subtitle.
% \begin{macrocode}
\pgfkeys{
/metropolis/font/titleformat subtitle/.cd,
.is choice,
regular/.code={%
\let\metropolis@subtitleformat\@empty%
\setbeamerfont{subtitle}{shape=\normalfont}%
},
smallcaps/.code={%
\let\metropolis@subtitleformat\@empty%
\setbeamerfont{subtitle}{shape=\scshape}%
},
allsmallcaps/.code={%
\let\metropolis@subtitleformat\lowercase%
\setbeamerfont{subtitle}{shape=\scshape}%
\PackageWarning{beamerthememetropolis}{%
Be aware that titleformat subtitle=allsmallcaps can lead to problems%
}
},
allcaps/.code={%
\let\metropolis@subtitleformat\uppercase%
\setbeamerfont{subtitle}{shape=\normalfont}%
\PackageWarning{beamerthememetropolis}{%
Be aware that titleformat subtitle=allcaps can lead to problems%
}
},
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{titleformat section}
% Controls the format of the section title.
% \begin{macrocode}
\pgfkeys{
/metropolis/font/titleformat section/.cd,
.is choice,
regular/.code={%
\let\metropolis@sectiontitleformat\@empty%
\setbeamerfont{section title}{shape=\normalfont}%
},
smallcaps/.code={%
\let\metropolis@sectiontitleformat\@empty%
\setbeamerfont{section title}{shape=\scshape}%
},
allsmallcaps/.code={%
\let\metropolis@sectiontitleformat\MakeLowercase%
\setbeamerfont{section title}{shape=\scshape}%
\PackageWarning{beamerthememetropolis}{%
Be aware that titleformat section=allsmallcaps can lead to problems%
}
},
allcaps/.code={%
\let\metropolis@sectiontitleformat\MakeUppercase%
\setbeamerfont{section title}{shape=\normalfont}%
\PackageWarning{beamerthememetropolis}{%
Be aware that titleformat section=allcaps can lead to problems%
}
},
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{frametitleformat}
% Control the format of the frame title.
% \begin{macrocode}
\pgfkeys{
/metropolis/font/titleformat frame/.cd,
.is choice,
regular/.code={%
\let\metropolis@frametitleformat\@empty%
\setbeamerfont{frametitle}{shape=\normalfont}%
},
smallcaps/.code={%
\let\metropolis@frametitleformat\@empty%
\setbeamerfont{frametitle}{shape=\scshape}%
},
allsmallcaps/.code={%
\let\metropolis@frametitleformat\MakeLowercase%
\setbeamerfont{frametitle}{shape=\scshape}%
\PackageWarning{beamerthememetropolis}{%
Be aware that titleformat frame=allsmallcaps can lead to problems%
}
},
allcaps/.code={%
\let\metropolis@frametitleformat\MakeUppercase%
\setbeamerfont{frametitle}{shape=\normalfont}
\PackageWarning{beamerthememetropolis}{%
Be aware that titleformat frame=allcaps can lead to problems%
}
},
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{titleformat aliases}
% Allows |titleformat title| et al. to be used in the |\usetheme|
% declaration, where \LaTeX{} automatically removes all spaces.
% \begin{macrocode}
\pgfkeys{
/metropolis/font/.cd,
titleformattitle/.code=\pgfkeysalso{titleformat title=#1},
titleformatsubtitle/.code=\pgfkeysalso{titleformat subtitle=#1},
titleformatsection/.code=\pgfkeysalso{titleformat section=#1},
titleformatframe/.code=\pgfkeysalso{titleformat frame=#1},
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\metropolis@font@setdefaults}
% Sets default values for font theme options.
% \begin{macrocode}
\newcommand{\metropolis@font@setdefaults}{
\pgfkeys{/metropolis/font/.cd,
titleformat title=regular,
titleformat subtitle=regular,
titleformat section=regular,
titleformat frame=regular,
}
}
% \end{macrocode}
% \end{macro}
%
% We first define hooks to change the case format of the titles.
%
% \begin{macrocode}
\def\metropolis@titleformat#1{#1}
\def\metropolis@subtitleformat#1{#1}
\def\metropolis@sectiontitleformat#1{#1}
\def\metropolis@frametitleformat#1{#1}
% \end{macrocode}
%
% To make the uppercase and lowercase macros work in the title, subtitle, etc.,
% we have to patch the appropriate |beamer| commands that set their values.
% This solution was suggested by Enrico Gregorio in an answer to
% \href{http://tex.stackexchange.com/questions/112526/}{this StackExchange
% question}.
%
% \begin{macrocode}
\patchcmd{\beamer@title}%
{\def\inserttitle{#2}}%
{\def\inserttitle{\metropolis@titleformat{#2}}}%
{}%
{\PackageError{beamerfontthememetropolis}{Patching title failed}}
\patchcmd{\beamer@subtitle}%
{\def\insertsubtitle{#2}}%
{\def\insertsubtitle{\metropolis@subtitleformat{#2}}}%
{}%
{\PackageError{beamerfontthememetropolis}{Patching subtitle failed}}
\patchcmd{\sectionentry}
{\def\insertsectionhead{#2}}
{\def\insertsectionhead{\metropolis@sectiontitleformat{#2}}}
{}
{\PackageError{beamerfontthememetropolis}{Patching section title failed}}
\patchcmd{\beamer@section}
{\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{#1}}}
{\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{%
\metropolis@sectiontitleformat{#1}}}}
{}
{\PackageError{beamerfontthememetropolis}{Patching section title failed}}
% \end{macrocode}
%
% Similarly, to make the |\MakeLowercase| and |\MakeUppercase| macros work in
% the frame title we have to patch |\beamer@@frametitle|.
%
% \begin{macrocode}
\patchcmd{\beamer@@frametitle}
{\beamer@ifempty{#2}{}{%
\gdef\insertframetitle{{#2\ifnum\beamer@autobreakcount>0\relax{}\space%
\usebeamertemplate*{frametitle continuation}\fi}}%
\gdef\beamer@frametitle{#2}%
\gdef\beamer@shortframetitle{#1}%
}}
{\beamer@ifempty{#2}{}{%
\gdef\insertframetitle{{\metropolis@frametitleformat{#2}\ifnum%
\beamer@autobreakcount>0\relax{}\space%
\usebeamertemplate*{frametitle continuation}\fi}}%
\gdef\beamer@frametitle{#2}%
\gdef\beamer@shortframetitle{#1}%
}}
{}
{\PackageError{beamerfontthememetropolis}{Patching frame title failed}}
% \end{macrocode}
%
%
%
% \subsubsection{Process package options}
%
% \begin{macrocode}
\metropolis@font@setdefaults
\ProcessPgfPackageOptions{/metropolis/font}
% \end{macrocode}
% \iffalse % \iffalse
%</package> %</package>
% \fi % \fi

View File

@ -13,7 +13,7 @@
%<driver> \ProvidesFile{beamerinnerthememetropolis.dtx} %<driver> \ProvidesFile{beamerinnerthememetropolis.dtx}
%<*package> %<*package>
\NeedsTeXFormat{LaTeX2e} \NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{beamerinnerthememetropolis}[2015/12/04 Metropolis inner theme] \ProvidesPackage{beamerinnerthememetropolis}[2016/02/06 Metropolis inner theme]
%</package> %</package>
%<driver> \documentclass{ltxdoc} %<driver> \documentclass{ltxdoc}
%<driver> \usepackage{beamerinnerthememetropolis} %<driver> \usepackage{beamerinnerthememetropolis}
@ -27,7 +27,7 @@
%<*package> %<*package>
% ------------------------------------------------------------------------- \fi % ------------------------------------------------------------------------- \fi
% %
% \subsection{\textsc{metropolis} inner theme} % \subsection{\themename inner theme}
% %
% A |beamer| inner theme dictates the style of the frame elements traditionally % A |beamer| inner theme dictates the style of the frame elements traditionally
% set in the ``body'' of each slide. These include: % set in the ``body'' of each slide. These include:
@ -40,7 +40,10 @@
% \item footnotes and plain text. % \item footnotes and plain text.
% \end{itemize} % \end{itemize}
% %
% Load required packages. %
%
% \subsubsection{Package dependencies}
%
% \begin{macrocode} % \begin{macrocode}
\RequirePackage{etoolbox} \RequirePackage{etoolbox}
\RequirePackage{calc} \RequirePackage{calc}
@ -58,104 +61,8 @@
\pgfkeys{ \pgfkeys{
/metropolis/inner/block/.cd, /metropolis/inner/block/.cd,
.is choice, .is choice,
transparent/.code=\setlength{\@metropolis@blockskip}{0ex}, transparent/.code=\setlength{\metropolis@blockskip}{0ex},
fill/.code=\setlength{\@metropolis@blockskip}{1ex}, fill/.code=\setlength{\metropolis@blockskip}{1ex},
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{titleformat title}
% Control the titleformat of the title
% \begin{macrocode}
\pgfkeys{
/metropolis/inner/titleformat title/.cd,
.is choice,
regular/.code={%
\let\@metropolis@titleformat\@empty%
\setbeamerfont{title}{shape=\normalfont}%
},
smallcaps/.code={%
\let\@metropolis@titleformat\@empty%
\setbeamerfont{title}{shape=\scshape}%
},
allsmallcaps/.code={%
\let\@metropolis@titleformat\MakeLowercase%
\setbeamerfont{title}{shape=\scshape}%
\PackageWarning{beamerthememetropolis}{%
Be aware that titleformat title=allsmallcaps can lead to problems%
}
},
allcaps/.code={%
\let\@metropolis@titleformat\MakeUppercase%
\setbeamerfont{title}{shape=\normalfont}
\PackageWarning{beamerthememetropolis}{%
Be aware that titleformat title=allcaps can lead to problems%
}
},
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{titleformat subtitle}
% Control the titleformat of the subtitle
% \begin{macrocode}
\pgfkeys{
/metropolis/inner/titleformat subtitle/.cd,
.is choice,
regular/.code={%
\let\@metropolis@subtitleformat\@empty%
\setbeamerfont{subtitle}{shape=\normalfont}%
},
smallcaps/.code={%
\let\@metropolis@subtitleformat\@empty%
\setbeamerfont{subtitle}{shape=\scshape}%
},
allsmallcaps/.code={%
\let\@metropolis@subtitleformat\MakeLowercase%
\setbeamerfont{subtitle}{shape=\scshape}%
\PackageWarning{beamerthememetropolis}{%
Be aware that titleformat subtitle=allsmallcaps can lead to problems%
}
},
allcaps/.code={%
\let\@metropolis@subtitleformat\MakeUppercase%
\setbeamerfont{subtitle}{shape=\normalfont}%
\PackageWarning{beamerthememetropolis}{%
Be aware that titleformat subtitle=allcaps can lead to problems%
}
},
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{titleformat section}
% Control the titleformat of the section title
% \begin{macrocode}
\pgfkeys{
/metropolis/inner/titleformat section/.cd,
.is choice,
regular/.code={%
\let\@metropolis@sectiontitleformat\@empty%
\setbeamerfont{section title}{shape=\normalfont}%
},
smallcaps/.code={%
\let\@metropolis@sectiontitleformat\@empty%
\setbeamerfont{section title}{shape=\scshape}%
},
allsmallcaps/.code={%
\let\@metropolis@sectiontitleformat\MakeLowercase%
\setbeamerfont{section title}{shape=\scshape}%
\PackageWarning{beamerthememetropolis}{%
Be aware that titleformat section=allsmallcaps can lead to problems%
}
},
allcaps/.code={%
\let\@metropolis@sectiontitleformat\MakeUppercase%
\setbeamerfont{section title}{shape=\normalfont}%
\PackageWarning{beamerthememetropolis}{%
Be aware that titleformat section=allcaps can lead to problems%
}
},
} }
% \end{macrocode} % \end{macrocode}
% \end{macro} % \end{macro}
@ -166,23 +73,20 @@
\pgfkeys{ \pgfkeys{
/metropolis/inner/sectionpage/.cd, /metropolis/inner/sectionpage/.cd,
.is choice, .is choice,
none/.code=\@metropolis@sectionpage@none, none/.code=\metropolis@sectionpage@none,
simple/.code=\@metropolis@sectionpage@simple, simple/.code=\metropolis@sectionpage@simple,
progressbar/.code=\@metropolis@sectionpage@progressbar, progressbar/.code=\metropolis@sectionpage@progressbar,
} }
% \end{macrocode} % \end{macrocode}
% \end{macro} % \end{macro}
% %
% \begin{macro}{\@metropolis@inner@setdefaults} % \begin{macro}{\metropolis@inner@setdefaults}
% Set default values for inner theme options. % Set default values for inner theme options.
% \begin{macrocode} % \begin{macrocode}
\newcommand{\@metropolis@inner@setdefaults}{ \newcommand{\metropolis@inner@setdefaults}{
\pgfkeys{/metropolis/inner/.cd, \pgfkeys{/metropolis/inner/.cd,
sectionpage=progressbar, sectionpage=progressbar,
block=transparent, block=transparent,
titleformat title=regular,
titleformat subtitle=regular,
titleformat section=regular,
} }
} }
% \end{macrocode} % \end{macrocode}
@ -192,35 +96,6 @@
% %
% \subsubsection{Title page} % \subsubsection{Title page}
% %
% \begin{macro}{\@metropolis@titleformat}
% Define hooks to change the case format of the titles.
% \begin{macrocode}
\def\@metropolis@titleformat#1{#1}
\def\@metropolis@subtitleformat#1{#1}
\def\@metropolis@sectiontitleformat#1{#1}
% \end{macrocode}
% \end{macro}
%
% To make the |\MakeLowercase| and |\MakeUppercase| macros work in the
% sectiontitle we have to patch |\sectionentry| and |\beamer@section|. This
% solution was suggested by Enrico Gregorio in an answer to
% \href{http://tex.stackexchange.com/questions/112526/}{this StackExchange
% question}.
%
% \begin{macrocode}
\patchcmd{\sectionentry}
{\def\insertsectionhead{#2}}
{\def\insertsectionhead{\@metropolis@sectiontitleformat{#2}}}
{}
{\PackageError{beamerinnerthememetropolis}{Patching section title failed}}
\patchcmd{\beamer@section}
{\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{#1}}}
{\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{%
\@metropolis@sectiontitleformat{#1}}}}
{}
{\PackageError{beamerinnerthememetropolis}{Patching section title failed}}
% \end{macrocode}
%
% \begin{macro}{title page} % \begin{macro}{title page}
% Template for the title page. Each element is only typset if it is defined % Template for the title page. Each element is only typset if it is defined
% by the user. If |\subtitle| is empty, for example, it won't leave a blank % by the user. If |\subtitle| is empty, for example, it won't leave a blank
@ -298,7 +173,7 @@
\setbeamertemplate{title}{ \setbeamertemplate{title}{
\raggedright% \raggedright%
\linespread{1.0}% \linespread{1.0}%
\@metropolis@titleformat{\inserttitle}% \inserttitle%
\par% \par%
\vspace*{0.5em} \vspace*{0.5em}
} }
@ -309,7 +184,7 @@
% Set the subtitle on the title page. % Set the subtitle on the title page.
% \begin{macrocode} % \begin{macrocode}
\setbeamertemplate{subtitle}{ \setbeamertemplate{subtitle}{
\@metropolis@subtitleformat{\insertsubtitle}% \insertsubtitle%
\par% \par%
\vspace*{0.5em} \vspace*{0.5em}
} }
@ -371,7 +246,7 @@
% Template for the section title slide at the beginning of each section. % Template for the section title slide at the beginning of each section.
% %
% \begin{macrocode} % \begin{macrocode}
\newcommand{\@metropolis@sectionpage@none}{ \newcommand{\metropolis@sectionpage@none}{
\AtBeginSection{ \AtBeginSection{
% intenionally empty % intenionally empty
} }
@ -382,7 +257,7 @@
\usebeamerfont{section title} \usebeamerfont{section title}
\insertsectionhead\\ \insertsectionhead\\
} }
\newcommand{\@metropolis@sectionpage@simple}{ \newcommand{\metropolis@sectionpage@simple}{
\setbeamertemplate{section page}[simple] \setbeamertemplate{section page}[simple]
\AtBeginSection{ \AtBeginSection{
\ifbeamer@inframe \ifbeamer@inframe
@ -402,7 +277,7 @@
\end{minipage} \end{minipage}
\par \par
} }
\newcommand{\@metropolis@sectionpage@progressbar}{ \newcommand{\metropolis@sectionpage@progressbar}{
\setbeamertemplate{section page}[progressbar] \setbeamertemplate{section page}[progressbar]
\AtBeginSection{ \AtBeginSection{
\ifbeamer@inframe \ifbeamer@inframe
@ -456,23 +331,23 @@
% Regular block environment % Regular block environment
% %
% \begin{macrocode} % \begin{macrocode}
\newlength{\@metropolis@blockskip} \newlength{\metropolis@blockskip}
\setbeamertemplate{block begin}{% \setbeamertemplate{block begin}{%
\setlength{\parskip}{\@metropolis@parskip} \setlength{\parskip}{\metropolis@parskip}
\vspace*{1ex} \vspace*{1ex}
\begin{beamercolorbox}[% \begin{beamercolorbox}[%
ht=2.4ex, ht=2.4ex,
dp=1ex, dp=1ex,
leftskip=\@metropolis@blockskip, leftskip=\metropolis@blockskip,
rightskip=\@metropolis@blockskip]{block title} rightskip=\metropolis@blockskip]{block title}
\usebeamerfont*{block title}\insertblocktitle% \usebeamerfont*{block title}\insertblocktitle%
\end{beamercolorbox}% \end{beamercolorbox}%
\vspace*{-1pt} \vspace*{-1pt}
\usebeamerfont{block body}% \usebeamerfont{block body}%
\begin{beamercolorbox}[% \begin{beamercolorbox}[%
dp=1ex, dp=1ex,
leftskip=\@metropolis@blockskip, leftskip=\metropolis@blockskip,
rightskip=\@metropolis@blockskip, rightskip=\metropolis@blockskip,
vmode]{block body}% vmode]{block body}%
} }
\setbeamertemplate{block end}{% \setbeamertemplate{block end}{%
@ -485,21 +360,21 @@
% %
% \begin{macrocode} % \begin{macrocode}
\setbeamertemplate{block alerted begin}{% \setbeamertemplate{block alerted begin}{%
\setlength{\parskip}{\@metropolis@parskip} \setlength{\parskip}{\metropolis@parskip}
\vspace*{1ex} \vspace*{1ex}
\begin{beamercolorbox}[% \begin{beamercolorbox}[%
ht=2.4ex, ht=2.4ex,
dp=1ex, dp=1ex,
leftskip=\@metropolis@blockskip, leftskip=\metropolis@blockskip,
rightskip=\@metropolis@blockskip]{block title alerted} rightskip=\metropolis@blockskip]{block title alerted}
\usebeamerfont*{block title alerted}\insertblocktitle% \usebeamerfont*{block title alerted}\insertblocktitle%
\end{beamercolorbox}% \end{beamercolorbox}%
\vspace*{-1pt} \vspace*{-1pt}
\usebeamerfont{block body alerted}% \usebeamerfont{block body alerted}%
\begin{beamercolorbox}[% \begin{beamercolorbox}[%
dp=1ex, dp=1ex,
leftskip=\@metropolis@blockskip, leftskip=\metropolis@blockskip,
rightskip=\@metropolis@blockskip, rightskip=\metropolis@blockskip,
vmode]{block body alerted}% vmode]{block body alerted}%
} }
\setbeamertemplate{block alerted end}{% \setbeamertemplate{block alerted end}{%
@ -512,21 +387,21 @@
% %
% \begin{macrocode} % \begin{macrocode}
\setbeamertemplate{block example begin}{% \setbeamertemplate{block example begin}{%
\setlength{\parskip}{\@metropolis@parskip} \setlength{\parskip}{\metropolis@parskip}
\vspace*{1ex} \vspace*{1ex}
\begin{beamercolorbox}[% \begin{beamercolorbox}[%
ht=2.4ex, ht=2.4ex,
dp=1ex, dp=1ex,
leftskip=\@metropolis@blockskip, leftskip=\metropolis@blockskip,
rightskip=\@metropolis@blockskip]{block title example} rightskip=\metropolis@blockskip]{block title example}
\usebeamerfont*{block title example}\insertblocktitle% \usebeamerfont*{block title example}\insertblocktitle%
\end{beamercolorbox}% \end{beamercolorbox}%
\vspace*{-1pt} \vspace*{-1pt}
\usebeamerfont{block body example}% \usebeamerfont{block body example}%
\begin{beamercolorbox}[% \begin{beamercolorbox}[%
dp=1ex, dp=1ex,
leftskip=\@metropolis@blockskip, leftskip=\metropolis@blockskip,
rightskip=\@metropolis@blockskip, rightskip=\metropolis@blockskip,
vmode]{block body example}% vmode]{block body example}%
} }
\setbeamertemplate{block example end}{% \setbeamertemplate{block example end}{%
@ -561,9 +436,9 @@
% \subsubsection{Text and spacing settings} % \subsubsection{Text and spacing settings}
% %
% \begin{macrocode} % \begin{macrocode}
\newlength{\@metropolis@parskip} \newlength{\metropolis@parskip}
\setlength{\@metropolis@parskip}{0.5em} \setlength{\metropolis@parskip}{0.5em}
\setlength{\parskip}{\@metropolis@parskip} \setlength{\parskip}{\metropolis@parskip}
\linespread{1.15} \linespread{1.15}
% \end{macrocode} % \end{macrocode}
% %
@ -587,7 +462,7 @@
% Process package options % Process package options
% %
% \begin{macrocode} % \begin{macrocode}
\@metropolis@inner@setdefaults \metropolis@inner@setdefaults
\ProcessPgfPackageOptions{/metropolis/inner} \ProcessPgfPackageOptions{/metropolis/inner}
% \end{macrocode} % \end{macrocode}
% %

View File

@ -13,7 +13,7 @@
%<driver> \ProvidesFile{beamerouterthememetropolis.dtx} %<driver> \ProvidesFile{beamerouterthememetropolis.dtx}
%<*package> %<*package>
\NeedsTeXFormat{LaTeX2e} \NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{beamerouterthememetropolis}[2015/12/04 Metropolis outer theme] \ProvidesPackage{beamerouterthememetropolis}[2016/02/06 Metropolis outer theme]
%</package> %</package>
%<driver> \documentclass{ltxdoc} %<driver> \documentclass{ltxdoc}
%<driver> \usepackage{beamerouterthememetropolis} %<driver> \usepackage{beamerouterthememetropolis}
@ -27,12 +27,15 @@
%<*package> %<*package>
% ------------------------------------------------------------------------- \fi % ------------------------------------------------------------------------- \fi
% %
% \subsection{\textsc{metropolis} outer theme} % \subsection{\themename outer theme}
% %
% A |beamer| outer theme dictates the style of the frame elements traditionally % A |beamer| outer theme dictates the style of the frame elements traditionally
% set outside the body of each slide: the head, footline, and frame title. % set outside the body of each slide: the head, footline, and frame title.
% %
% Load required packages. %
%
% \subsubsection{Package dependencies}
%
% \begin{macrocode} % \begin{macrocode}
\RequirePackage{etoolbox} \RequirePackage{etoolbox}
\RequirePackage{calc} \RequirePackage{calc}
@ -44,7 +47,7 @@
% \subsubsection{Options} % \subsubsection{Options}
% %
% \begin{macro}{numbering} % \begin{macro}{numbering}
% This option controls the page numbering. % Adds slide numbers to the bottom right of each slide.
% \begin{macrocode} % \begin{macrocode}
\pgfkeys{ \pgfkeys{
/metropolis/outer/numbering/.cd, /metropolis/outer/numbering/.cd,
@ -57,7 +60,7 @@
% \end{macro} % \end{macro}
% %
% \begin{macro}{progressbar} % \begin{macro}{progressbar}
% This option controls the progressbar. % Adds a progress bar to the top, bottom, or frametitle of each slide.
% \begin{macrocode} % \begin{macrocode}
\pgfkeys{ \pgfkeys{
/metropolis/outer/progressbar/.cd, /metropolis/outer/progressbar/.cd,
@ -86,58 +89,13 @@
% \end{macrocode} % \end{macrocode}
% \end{macro} % \end{macro}
% %
% \begin{macro}{frametitleformat} % \begin{macro}{\metropolis@outer@setdefaults}
% Control the titleformat of the frame title % Sets default values for outer theme options.
% \begin{macrocode} % \begin{macrocode}
\pgfkeys{ \newcommand{\metropolis@outer@setdefaults}{
/metropolis/outer/titleformat frame/.cd,
.is choice,
regular/.code={%
\let\@metropolis@frametitleformat\@empty%
\setbeamerfont{frametitle}{shape=\normalfont}%
\renewcommand{\@metropolis@frametitlestrut}{%
\vphantom{ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz}%
}
},
smallcaps/.code={%
\let\@metropolis@frametitleformat\@empty%
\setbeamerfont{frametitle}{shape=\scshape}%
\renewcommand{\@metropolis@frametitlestrut}{%
\vphantom{ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz}%
}
},
allsmallcaps/.code={%
\let\@metropolis@frametitleformat\MakeLowercase%
\setbeamerfont{frametitle}{shape=\scshape}%
\renewcommand{\@metropolis@frametitlestrut}{%
\vphantom{abcdefghijklmnopqrstuvwxyz}%
}
\PackageWarning{beamerthememetropolis}{%
Be aware that titleformat frame=allsmallcaps can lead to problems%
}
},
allcaps/.code={%
\let\@metropolis@frametitleformat\MakeUppercase%
\setbeamerfont{frametitle}{shape=\normalfont}
\renewcommand{\@metropolis@frametitlestrut}{%
\vphantom{ABCDEFGHIJKLMNOPQRSTUVWXYZ}%
}
\PackageWarning{beamerthememetropolis}{%
Be aware that titleformat frame=allcaps can lead to problems%
}
},
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@metropolis@outer@setdefaults}
% Set default values for outer theme options.
% \begin{macrocode}
\newcommand{\@metropolis@outer@setdefaults}{
\pgfkeys{/metropolis/outer/.cd, \pgfkeys{/metropolis/outer/.cd,
numbering=counter, numbering=counter,
progressbar=none, progressbar=none,
titleformat frame=regular,
} }
} }
% \end{macrocode}% % \end{macrocode}%
@ -148,15 +106,15 @@
% \subsubsection{Head and footline} % \subsubsection{Head and footline}
% %
% All good |beamer| presentations should already remove the navigation symbols, % All good |beamer| presentations should already remove the navigation symbols,
% but \textsc{metropolis} removes them automatically (just in case). % but \themename removes them automatically (just in case).
% %
% \begin{macrocode} % \begin{macrocode}
\setbeamertemplate{navigation symbols}{} \setbeamertemplate{navigation symbols}{}
% \end{macrocode} % \end{macrocode}
% %
% Templates for the frame number. Can be omitted, shown or displayed as a % \begin{macro}{frame numbering}
% fraction of the total frames. % Templates for the frame number. Can be omitted, shown or displayed as a
% % fraction of the total frames.
% \begin{macrocode} % \begin{macrocode}
\defbeamertemplate{frame numbering}{none}{} \defbeamertemplate{frame numbering}{none}{}
\defbeamertemplate{frame numbering}{counter}{\insertframenumber} \defbeamertemplate{frame numbering}{counter}{\insertframenumber}
@ -164,7 +122,11 @@
\insertframenumber/\inserttotalframenumber \insertframenumber/\inserttotalframenumber
} }
% \end{macrocode} % \end{macrocode}
% \end{macro}
% %
% \begin{macro}{headline}
% \begin{macro}{footline}
% Templates for the head- and footline at the top and bottom of each frame.
% \begin{macrocode} % \begin{macrocode}
\defbeamertemplate{headline}{plain}{} \defbeamertemplate{headline}{plain}{}
\defbeamertemplate{footline}{plain}{% \defbeamertemplate{footline}{plain}{%
@ -175,68 +137,36 @@
\end{beamercolorbox}% \end{beamercolorbox}%
} }
% \end{macrocode} % \end{macrocode}
% \end{macro}
% \end{macro}
% %
% %
% %
% \subsubsection{Frametitle} % \subsubsection{Frametitle}
% %
% \begin{macro}{\@metropolis@frametitleformat}
% Define a hook to change the case format of the frame title.
% \begin{macrocode}
\def\@metropolis@frametitleformat#1{#1}
% \end{macrocode}
% \end{macro}
%
% To make the |\MakeLowercase| and |\MakeUppercase| macros work in the
% frame title we have to patch |\beamer@@frametitle|. This solution was
% suggested by Enrico Gregorio in an answer to
% \href{http://tex.stackexchange.com/questions/112526/}{this StackExchange
% question}.
%
% \begin{macrocode}
\patchcmd{\beamer@@frametitle}
{\beamer@ifempty{#2}{}{%
\gdef\insertframetitle{{#2\ifnum\beamer@autobreakcount>0\relax{}\space%
\usebeamertemplate*{frametitle continuation}\fi}}%
\gdef\beamer@frametitle{#2}%
\gdef\beamer@shortframetitle{#1}%
}}
{\beamer@ifempty{#2}{}{%
\gdef\insertframetitle{{\@metropolis@frametitleformat{#2}\ifnum%
\beamer@autobreakcount>0\relax{}\space%
\usebeamertemplate*{frametitle continuation}\fi}}%
\gdef\beamer@frametitle{#2}%
\gdef\beamer@shortframetitle{#1}%
}}
{}
{\PackageError{beamerouterthememetropolis}{Patching frame title failed}}
% \end{macrocode}
%
% \begin{macro}{frametitle} % \begin{macro}{frametitle}
% % Templates for the frame title, which is optionally underlined with a
% Templates for the frame title, which is optionally underlined with a % progress bar.
% progress bar.
%
% \begin{macrocode} % \begin{macrocode}
\newlength{\@metropolis@frametitlestrut} \newcommand{\metropolis@frametitlestrut}{
\vphantom{ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz()}%
}
\defbeamertemplate{frametitle}{plain}{% \defbeamertemplate{frametitle}{plain}{%
\nointerlineskip% \nointerlineskip%
\begin{beamercolorbox}[% \begin{beamercolorbox}[%
wd=\paperwidth,% wd=\paperwidth,%
sep=1.5ex,% sep=1.5ex,%
]{frametitle}% ]{frametitle}%
\@metropolis@frametitlestrut\insertframetitle\@metropolis@frametitlestrut% \metropolis@frametitlestrut\insertframetitle\metropolis@frametitlestrut%
\end{beamercolorbox}% \end{beamercolorbox}%
} }
% \end{macrocode} % \end{macrocode}
% \end{macro} % \end{macro}
% %
% \begin{macro}{progress bar in head/foot} % \begin{macro}{progress bar in head/foot}
% % Template for the progress bar optionally displayed below the frame title
% Template for the progress bar optionally displayed below the frame title % on each page. Much of this code is duplicated in the inner theme's
% on each page. Much of this code is duplicated in the inner theme's template % template |progress bar in section page|.
% |progress bar in section page|.
%
% \begin{macrocode} % \begin{macrocode}
\newlength{\metropolis@progressinheadfoot} \newlength{\metropolis@progressinheadfoot}
\setbeamertemplate{progress bar in head/foot}{ \setbeamertemplate{progress bar in head/foot}{
@ -254,10 +184,12 @@
% \end{macrocode} % \end{macrocode}
% \end{macro} % \end{macro}
% %
% Process package options %
%
% \subsubsection{Process package options}
% %
% \begin{macrocode} % \begin{macrocode}
\@metropolis@outer@setdefaults \metropolis@outer@setdefaults
\ProcessPgfPackageOptions{/metropolis/outer} \ProcessPgfPackageOptions{/metropolis/outer}
% \end{macrocode} % \end{macrocode}
% %

View File

@ -13,7 +13,7 @@
%<driver> \ProvidesFile{beamerthememetropolis.dtx} %<driver> \ProvidesFile{beamerthememetropolis.dtx}
%<*package> %<*package>
\NeedsTeXFormat{LaTeX2e} \NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{beamerthememetropolis}[2015/12/04 Metropolis Beamer theme] \ProvidesPackage{beamerthememetropolis}[2016/02/06 Metropolis Beamer theme]
%</package> %</package>
%<driver> \documentclass{ltxdoc} %<driver> \documentclass{ltxdoc}
%<driver> \usepackage{beamerthememetropolis} %<driver> \usepackage{beamerthememetropolis}
@ -27,28 +27,26 @@
%<*package> %<*package>
% ------------------------------------------------------------------------- \fi % ------------------------------------------------------------------------- \fi
% %
% \subsection{\textsc{metropolis} main theme} % \subsection{\themename parent theme}
% %
% The primary job of this package is to load the component sub-packages of the % The primary job of this package is to load the component sub-packages of the
% \textsc{metropolis} theme and route the theme options accordingly. It also % \themename theme and route the theme options accordingly. It also
% provides some custom commands and environments for the user. % provides some custom commands and environments for the user.
% %
% Load the required packages. %
%
% \subsubsection{Package dependencies}
%
% \begin{macrocode} % \begin{macrocode}
\RequirePackage{etoolbox} \RequirePackage{etoolbox}
\RequirePackage{pgfopts} \RequirePackage{pgfopts}
% \end{macrocode} % \end{macrocode}
% %
%
%
% \subsubsection{Options} % \subsubsection{Options}
% %
% \begin{macro}{\metroset} % Most options are passed off to the component sub-packages.
% First of all we define a macro for the user to set options.
% \begin{macrocode}
\newcommand{\metroset}[1]{\pgfkeys{/metropolis/.cd,#1}}
% \end{macrocode}
% \end{macro}
%
% Then we need to pass the unknown options to the sub-packages.
% %
% \begin{macrocode} % \begin{macrocode}
\pgfkeys{/metropolis/.cd, \pgfkeys{/metropolis/.cd,
@ -56,10 +54,12 @@
/metropolis/inner, /metropolis/inner,
/metropolis/outer, /metropolis/outer,
/metropolis/color, /metropolis/color,
/metropolis/font,
}, },
% \end{macrocode} % \end{macrocode}
% %
% We have to forwarded keys that affect multiple sub-packages manually. % Currently, the |block| option affects two subthemes and has to be handled
% separately.
% %
% \begin{macrocode} % \begin{macrocode}
block/.code=\pgfkeysalso{ block/.code=\pgfkeysalso{
@ -70,28 +70,28 @@
% \end{macrocode} % \end{macrocode}
% %
% \begin{macro}{titleformat plain} % \begin{macro}{titleformat plain}
% Control the titleformat of the plain title % Controls the formatting of the text on standout ``plain'' frames.
% \begin{macrocode} % \begin{macrocode}
\pgfkeys{ \pgfkeys{
/metropolis/titleformat plain/.cd, /metropolis/titleformat plain/.cd,
.is choice, .is choice,
regular/.code={% regular/.code={%
\let\@metropolis@plaintitleformat\@empty% \let\metropolis@plaintitleformat\@empty%
\setbeamerfont{plain title}{shape=\normalfont}% \setbeamerfont{plain title}{shape=\normalfont}%
}, },
smallcaps/.code={% smallcaps/.code={%
\let\@metropolis@plaintitleformat\@empty% \let\metropolis@plaintitleformat\@empty%
\setbeamerfont{plain title}{shape=\scshape}% \setbeamerfont{plain title}{shape=\scshape}%
}, },
allsmallcaps/.code={% allsmallcaps/.code={%
\let\@metropolis@plaintitleformat\MakeLowercase% \let\metropolis@plaintitleformat\MakeLowercase%
\setbeamerfont{plain title}{shape=\scshape}% \setbeamerfont{plain title}{shape=\scshape}%
\PackageWarning{beamerthememetropolis}{% \PackageWarning{beamerthememetropolis}{%
Be aware that titleformat plain=allsmallcaps can lead to problems% Be aware that titleformat plain=allsmallcaps can lead to problems%
} }
}, },
allcaps/.code={% allcaps/.code={%
\let\@metropolis@plaintitleformat\MakeUppercase% \let\metropolis@plaintitleformat\MakeUppercase%
\setbeamerfont{plain title}{shape=\normalfont}% \setbeamerfont{plain title}{shape=\normalfont}%
\PackageWarning{beamerthememetropolis}{% \PackageWarning{beamerthememetropolis}{%
Be aware that titleformat plain=allcaps can lead to problems% Be aware that titleformat plain=allcaps can lead to problems%
@ -102,14 +102,15 @@
% \end{macro} % \end{macro}
% %
% \begin{macro}{titleformat} % \begin{macro}{titleformat}
% Control the titleformat of every title type together % Sets a standard format for titles, subtitles, section titles, frame
% titles, and the text on standout ``plain'' frames.
% \begin{macrocode} % \begin{macrocode}
\pgfkeys{ \pgfkeys{
/metropolis/titleformat/.code=\pgfkeysalso{ /metropolis/titleformat/.code=\pgfkeysalso{
inner/titleformat title=#1, font/titleformat title=#1,
inner/titleformat subtitle=#1, font/titleformat subtitle=#1,
inner/titleformat section=#1, font/titleformat section=#1,
outer/titleformat frame=#1, font/titleformat frame=#1,
titleformat plain=#1, titleformat plain=#1,
} }
} }
@ -133,7 +134,7 @@
% Set default values for options. % Set default values for options.
% %
% \begin{macrocode} % \begin{macrocode}
\newcommand{\@metropolis@setdefaults}{ \newcommand{\metropolis@setdefaults}{
\pgfkeys{/metropolis/.cd, \pgfkeys{/metropolis/.cd,
titleformat plain=regular, titleformat plain=regular,
} }
@ -146,6 +147,7 @@
% %
% Having processed the options, we can now load the component sub-packages of % Having processed the options, we can now load the component sub-packages of
% the theme. % the theme.
%
% \begin{macrocode} % \begin{macrocode}
\useinnertheme{metropolis} \useinnertheme{metropolis}
\useoutertheme{metropolis} \useoutertheme{metropolis}
@ -167,20 +169,22 @@
% %
% \subsubsection{Custom commands} % \subsubsection{Custom commands}
% %
% We define custom commands in this package as their proper usage may depend % The parent theme defines custom commands as their proper usage may depend
% on multiple sub-packages. % on multiple sub-packages.
% %
% \begin{macro}{\@metropolis@plaintitleformat} % \begin{macro}{\metroset}
% Define a hook to change the case format of the plain title. % Allows the user to change options midway through a presentation.
% \begin{macrocode} % \begin{macrocode}
\def\@metropolis@plaintitleformat#1{#1} \newcommand{\metroset}[1]{\pgfkeys{/metropolis/.cd,#1}}
% \end{macrocode} % \end{macrocode}
% \end{macro} % \end{macro}
% %
% \begin{macro}{\plain} % \begin{macro}{\plain}
% Creates a plain frame with dark background, suitable for displaying images % Creates a plain frame with dark background, suitable for displaying images
% or a few words. % or a few words. The format of the text can be set with the
% |titleformat plain| option.
% \begin{macrocode} % \begin{macrocode}
\def\metropolis@plaintitleformat#1{#1}
\newcommand{\plain}[2][]{% \newcommand{\plain}[2][]{%
\begingroup \begingroup
\setbeamercolor{background canvas}{ \setbeamercolor{background canvas}{
@ -191,7 +195,7 @@
\begin{center} \begin{center}
\usebeamercolor[fg]{palette primary} \usebeamercolor[fg]{palette primary}
\usebeamerfont{plain title} \usebeamerfont{plain title}
\@metropolis@plaintitleformat{#2} \metropolis@plaintitleformat{#2}
\end{center} \end{center}
\end{frame} \end{frame}
\endgroup \endgroup
@ -205,10 +209,12 @@
% \end{macrocode} % \end{macrocode}
% \end{macro} % \end{macro}
% %
% Process package options %
%
% \subsubsection{Process package options}
% %
% \begin{macrocode} % \begin{macrocode}
\@metropolis@setdefaults \metropolis@setdefaults
\ProcessPgfOptions{/metropolis} \ProcessPgfOptions{/metropolis}
% \end{macrocode} % \end{macrocode}
% %