La Te X Metropolis Beamer Theme Manual

LaTeX%20Metropolis%20Beamer%20Theme%20Manual

User Manual: Pdf

Open the PDF directly: View PDF PDF.
Page Count: 48

DownloadLa Te X Metropolis Beamer Theme Manual
Open PDF In BrowserView PDF
Modern Beamer Presentations with the
metropolis package
Matthias Vogelgesang
matthias.vogelgesang@gmail.com
v1.1 — 2016/03/14

Contents
1

Introduction

3

2

Getting Started
2.1 Installing from CTAN . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.2 Installing from GitHub . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4
4
4

2.3
2.4

A Minimal Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5
5

2.5

Pandoc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6

3

Customization

6

3.1

Package options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.1.1
Main theme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6
7

3.1.2
3.1.3
3.1.4

Inner theme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Outer theme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Color theme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7
8
8

3.2
3.3

3.1.5
Font theme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Color Customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Font Customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8
8
9

3.4

3.3.1
Old style figures . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.4.1

Standout frames . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

1

4 pgfplots integration
4.1
4.2

10

Styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Paul Tol colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

5 Tips & Tricks
11
5.1 Backup Slides . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
6 Known Issues
11
6.1 Title formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
6.2
6.3
7

Interactions with other color themes . . . . . . . . . . . . . . . . . . . 12
Notes on second screen . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

License

13

8 Implementation
8.1

8.1.2
8.1.3
8.1.4
8.2

14

metropolis parent theme . . . . . . . . . . . . . . . . . . . . . . . . . . 14
8.1.1
Package dependencies . . . . . . . . . . . . . . . . . . . . . . . 14
Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Component sub-packages . . . . . . . . . . . . . . . . . . . . . 16
Custom commands . . . . . . . . . . . . . . . . . . . . . . . . . . 16

8.1.5 Process package options . . . . . . . . . . . . . . . . . . . . . . 17
metropolis inner theme . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
8.2.1
8.2.2
8.2.3

Package dependencies . . . . . . . . . . . . . . . . . . . . . . . 17
Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Title page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

8.2.4
8.2.5

Section page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Block environments . . . . . . . . . . . . . . . . . . . . . . . . . 24

8.2.6
8.2.7
8.2.8

Lists and floats . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Footnotes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Text and spacing settings . . . . . . . . . . . . . . . . . . . . . . 26

8.2.9 Standout frames . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
8.2.10 Process package options . . . . . . . . . . . . . . . . . . . . . . 28
8.3

metropolis outer theme . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
8.3.1 Package dependencies . . . . . . . . . . . . . . . . . . . . . . . 28
8.3.2 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
8.3.3
8.3.4

Head and footline . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Frametitle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

8.3.5

Process package options . . . . . . . . . . . . . . . . . . . . . . 32
2

8.4

8.5

8.6

1

metropolis font theme . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
8.4.1
8.4.2

Package dependencies . . . . . . . . . . . . . . . . . . . . . . . 32
Load Fira fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

8.4.3
8.4.4
8.4.5

General font definitions . . . . . . . . . . . . . . . . . . . . . . . 35
Title format options . . . . . . . . . . . . . . . . . . . . . . . . . 36
Process package options . . . . . . . . . . . . . . . . . . . . . . 41

metropolis color theme . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
8.5.1 Package dependencies . . . . . . . . . . . . . . . . . . . . . . . 41
8.5.2
8.5.3
8.5.4

Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Base colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Base styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

8.5.5
8.5.6

Derived colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Process package options . . . . . . . . . . . . . . . . . . . . . . 45

Tol pgfplots theme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

Introduction

Beamer is an awesome way to make presentations with LaTeX, but its theme
selection is surprisingly sparse. The stock themes share an aesthetic that can
be a little cluttered, while the few distinctive custom themes available are often
specialized for a particular corporate or institutional brand.
The goal of metropolis is to provide a simple, modern Beamer theme suitable
for anyone to use. It tries to minimize noise and maximize space for content; the
only visual flourish it offers is an (optional) progress bar added to each slide or
to the section slides.
By default, metropolis uses Fira Sans, a gorgeous typeface commissioned by
Mozilla and designed by Carrois. For best results, you will need the Fira typeface
installed and use XELATEX to typeset your slides. However, metropolis can also be
used with other typefaces and LATEX build systems.
metropolis’s codebase is maintained on GitHub. If you have issues, find mistakes in the manual or want to help make the theme even better, please get in
touch there. The full list of contributors already contains over a dozen names!

3

2

Getting Started

2.1 Installing from CTAN
For most users, we recommend installing metropolis from CTAN. If you keep
your TEX distribution up-to-date, chances are good that metropolis is already
installed. If it is not, you need to update your packages. If your distribution is
TEX Live (or MacTEX on OS X), the following command updates all packages.
tlmgr update --all
If this results in an error, you may need to run it with administrative privileges:
sudo tlmgr update --all
MacTEX on OS X also provides a graphical interface for tlmgr called TEX Live Utility.
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. However,
this is not mandatory; metropolis also works with the standard fonts.

2.2

Installing from GitHub

If you want to use the cutting-edge development version of metropolis, you can
install it manually. Like any LATEX package, this involves four easy steps:
Download the source with a git clone of the metropolis repository or as a
zip archive of the latest development version.
Compile the style files by running make sty inside the downloaded directory.
(Or run LATEX directly on source/metropolistheme.ins.)
Move the resulting *.sty files to the folder containing your presentation. To
use metropolis with many presentations, run make install or move
the *.sty files to a folder in your TEX path instead.
Use the theme for your presentation by declaring \usetheme{metropolis}
in the preamble of your Beamer document.
4

metropolis uses the Make build system to offer the following installation options
for advanced users:
make sty builds the theme style files.
make doc builds this documentation manual.
make demo builds a demo presentation to test the features of metropolis.
make all builds the theme and manual.
make clean removes the files generated by make all.
make install installs the theme into your local texmf folder.
make uninstall removes the theme from your local texmf folder.

2.3

A Minimal Example

The following code shows a minimal example of a Beamer presentation using
metropolis.
\documentclass{beamer}
\usetheme{metropolis}
\title{A minimal example}

% Use metropolis theme

\date{\today}
\author{Matthias Vogelgesang}
\institute{Centre for Modern Beamer Themes}
\begin{document}
\maketitle
\section{First Section}
\begin{frame}{First Frame}
Hello, world!
\end{frame}
\end{document}

2.4

Dependencies

metropolis depends on the beamer class and the following standard packages:

5

• tikz

• etoolbox

• ifxetex

• pgfopts

• calc

• ifluatex

For best results, we recommend installing the fonts Fira Sans and Fira Mono
and compiling with metropolis using XELATEX or LuaTEX. These are optional dependencies; metropolis is compatible with (e.g.) pdfLATEX 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 metropolis.

2.5

Pandoc

To use this theme with Pandoc-based presentations, you can run the following
command
$ pandoc -t beamer --latex-engine=xelatex -V theme:
metropolis -o output.pdf input.md

3

Customization

3.1 Package options
The theme provides a number of options, which can be set using a key=value
interface. The primary way to set options is to provide a comma-separated list
of option-value pairs when loading metropolis in the preamble:
\usetheme[option1=value1, option2=value2, ...]{metropolis}
Options can be changed at any time — even mid-presentation! — with the
\metroset macro.
\metroset{option1=newvalue1, option2=newvalue2, ...}
The list of options is structured as shown in the following example.

6

option key

list of possible values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . default
A short description of the option.

3.1.1 Main theme
titleformat

regular, smallcaps, allsmallcaps, allcaps . . . . . . . . . . . . . . . . . . . . . . regular
Changes the format of titles, subtitles, section titles, frame titles, and the text on
“standout” frames. The available options produce Regular, SmallCaps, allsmallcaps, or ALLCAPS titles. Please refer to Section 6.1 for known issues with these
options.

titleformat plain

regular, smallcaps, allsmallcaps, allcaps . . . . . . . . . . . . . . . . . . . . . . regular
Changes the format of “standout” frames (see titleformat, above).

3.1.2 Inner theme
sectionpage

none, simple, progressbar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . progressbar
Adds a slide at the start of each section (simple) with an optional thin progress
bar below the section title (progressbar). The none option disables the section page.

subsectionpage

none, simple, progressbar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . none
Optionally adds a slide at the start of each subsection. If enabled with the
simple or progressbar options, the style of the section page will be updated to match the style of the subsection page. Note that section slides and
subsection slides can appear consecutively if both are enabled; you may want
to use this option together with sectionpage=none depending on the section
structure of your presentation.

7

3.1.3 Outer theme
numbering

none, counter, fraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . counter
Controls whether the frame number at the bottom right of each slide is omitted (none), shown (counter) or displayed as a fraction of the total number of
frames (fraction).

progressbar

none, head, frametitle, foot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . none
Optionally adds a progress bar to the top of each frame (head), the bottom of
each frame (foot), or directly below each frame title (frametitle).

3.1.4 Color theme
block

transparent, fill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . transparent
Optionally adds a light grey background to block environments like theorem
and example.

background

dark, light . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . light
Provides the option to have a dark background and light foreground instead of
the reverse.

3.1.5 Font theme
titleformat title

regular, smallcaps, allsmallcaps, allcaps . . . . . . . . . . . . . . . . . . . . . . regular

titleformat subtitle

Individually controls the format of titles, subtitles, section titles, and frame titles
(see titleformat, above).

titeformat section
titleformat frame

3.2

Color Customization

The included metropolis color theme is used by default, but its colors can be
easily changed to suit your tastes. All of the theme’s styles are defined in terms
of three beamer colors:
• normal text (dark fg, light bg)

8

• alerted text (colored fg, should be visible against dark or light)
• example text (colored fg, should be visible against dark or light)
An easy way to customize the theme is to redefine these colors using
\setbeamercolor{ ... }{ fg= ... , bg= ... }
in your preamble. For greater customization, you can redefine any of the other
stock beamer colors. In addition to the stock colors the theme defines a number
of metropolis specific colors, which can also be redefined to your liking.
\setbeamercolor{progress bar}{ ... }
\setbeamercolor{title separator}{ ... }
\setbeamercolor{progress bar in head/foot}{ ... }
\setbeamercolor{progress bar in section page}{ ... }

3.3

Font Customization

The default font for metropolis is Fira. This can be easily changed using the
standard font selection commands of the fontspec package. So if you prefer, for
example, the Ubuntu font family, just add the following two commands after
loading the metropolis theme.
\setsansfont{Ubuntu}
\setmonofont{Ubuntu Mono}
If you are expecting to present in a large room or with an underpowered projector, you may want to change the font to a heavier weight of Fira to maximize
readability.
\setsansfont[BoldFont={Fira Sans SemiBold}]{Fira Sans Book}

3.3.1 Old style figures
The regular fontspec mechanism for changing glyph appearance applies also to
this theme. If you want to have old style figures in the text but regular lined

9

figures for math, you could add the following to your preamble:
\usefonttheme{professionalfonts}

% required for mathspec

\usepackage{mathspec}
\setsansfont[BoldFont={Fira Sans},
Numbers={OldStyle}]{Fira Sans Light}
\setmathsfont(Digits)[Numbers={Lining, Proportional}]{Fira
Sans Light}

3.4

Commands

3.4.1 Standout frames
The metropolis inner theme offers a custom frame format with large, centered
text and an inverted background — perfect for focusing attention on single sentence or image. To use it, add the key standout to the frame:
\begin{frame}[standout]
Thank you!
\end{frame}

4

pgfplots integration

metropolis comes with a set of pre-defined pgfplots styles and a color theme
based on Paul Tol’s color scheme.

4.1 Styles
Pass the following style keys to the axis environment to get the appropriate effect:
mlineplot

mbarplot

Plot regular line charts with reduced axis frames, less intrusive legend and subdued grid.
Plot vertical bar charts in a similar way as mlineplot but reduce grid usage.
10

horizontal mbarplot

disable thousands separator

Plot horizontal bar charts.
Helper style to remove thousands separator.

4.2

Paul Tol colors

A good presentation uses colors that are distinct from each other as much as
possible as well as from black and white, can be discerned item under different
lighting and display environments and by color-blind viewers, while matching
well together.
In a technical note for SRON, Paul Tol proposed a palette of colors satisfying
these constraints. The sub-package pgfplotsthemetol defines palettes for
pgfplots charts based on Tol’s work.

5

Tips & Tricks

5.1 Backup Slides
Speakers will often include extra slides at the end of their presentation to refer to during audience questions. One easy way to do this is to include the
appendixnumberbeamer package in your preamble and call \appendix before your backup slides.
metropolis will automatically turn off slide numbering and progress bars for
slides in the appendix.

6 Known Issues
6.1 Title formats
Be aware that not every font supports small caps, so the smallcaps or
allsmallcaps options may not work if you use a font other than Fira Sans.
In particular, the Computer Modern sans-serif typeface, which is used when
metropolis is compiled with pdfLATEX, does not have a small-caps variant.
11

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:
• Some commands, like \\, do not work inside \MakeLowercase and
\MakeUppercase. (See #125)
• Only alphabetic characters are affected by \MakeLowercase, so numerals
and punctuation remain at full height. This can spoil some of the aesthetic
benefits of allsmallcaps. (See #33)
• \MakeLowercase and \MakeUppercase apply to math mode and \scshape
does not. This can easily introduce mathematical errors that are hard to
catch.
• It is impossible to typeset symbols which are encoded as uppercase letters
in a different font. In particular, \mathbb and \mathcal letters will be
replaced by other math glyphs. (See #153)
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.

6.2

Interactions with other color themes

metropolis can be used along with any other Beamer color theme, such as
crane or seahorse. If you wish to do this, it is usually best to include the
metropolis subpackages individually so the metropolis color theme is never
loaded. This will prevent conflicts between the metropolis color theme and
your preferred theme.
For example, overriding the color theme as follows may not work as expected because \usetheme{metropolis} loads the metropolis color theme, which defines a relationship between the frametitle background and the primary palette
of the theme. Since seahorse assumes a different relationship between its
palettes, the result is a grey, rather than periwinkle, frametitle background.
\usetheme{metropolis}
\usecolortheme{seahorse}
The correct colors are chosen if the metropolis outer, inner, and font themes
are loaded seperately:

12

\useoutertheme{metropolis}
\useinnertheme{metropolis}
\usefonttheme{metropolis}
\usecolortheme{seahorse}
% or your preferred color theme
Please note that metropolis may not use all the colors defined in your favourite
Beamer color theme. In particular, metropolis does not set a background color
for the title; this will cause issues when using color themes like whale which set
a white foreground for the title.

6.3

Notes on second screen

If you use the [show notes on second screen] option built in to Beamer
and compile with XELATEX, text on slides following the first section slide may be
rendered in white instead of the regular colour. This is due to a bug in Beamer
or XELATEX itself. You can work around it either by compiling with LuaTEX or by
adding the following code to your preamble to reset the text color on each slide.
\makeatletter
\def\beamer@framenotesbegin{% at beginning of slide
\usebeamercolor[fg]{normal text}
\gdef\beamer@noteitems{}%
\gdef\beamer@notes{}%
}
\makeatother

7

License

metropolis is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. This means that if you change the theme and re-distribute
it, you must retain the copyright notice header and license it under the same
CC-BY-SA license. This does not affect any presentations that you create with the
theme.

13

8

Implementation

8.1 metropolis parent theme
The primary job of this package is to load the component sub-packages of the
metropolis theme and route the theme options accordingly. It also provides
some custom commands and environments for the user.

8.1.1 Package dependencies
1 \RequirePackage{etoolbox}
2 \RequirePackage{pgfopts}

8.1.2 Options
Most options are passed off to the component sub-packages.
3 \pgfkeys{/metropolis/.cd,
4

.search also={

5

/metropolis/inner,

6

/metropolis/outer,

7

/metropolis/color,

8

/metropolis/font,

9

}

10 }

titleformat plain

Controls the formatting of the text on standout “plain” frames.
11 \pgfkeys{
12

/metropolis/titleformat plain/.cd,

13

.is choice,

14

regular/.code={%
\let\metropolis@plaintitleformat\@empty%

15

\setbeamerfont{standout}{shape=\normalfont}%

16
17

},

18

smallcaps/.code={%
\let\metropolis@plaintitleformat\@empty%

19

\setbeamerfont{standout}{shape=\scshape}%

20
21

},

14

allsmallcaps/.code={%

22
23

\let\metropolis@plaintitleformat\MakeLowercase%

24

\setbeamerfont{standout}{shape=\scshape}%

25

\PackageWarning{beamerthememetropolis}{%
Be aware that titleformat plain=allsmallcaps can lead to prob-

26

lems%
}

27
28

},

29

allcaps/.code={%

30

\let\metropolis@plaintitleformat\MakeUppercase%

31

\setbeamerfont{standout}{shape=\normalfont}%
\PackageWarning{beamerthememetropolis}{%

32

Be aware that titleformat plain=allcaps can lead to problems%

33

}

34
35

},

36 }

titleformat

Sets a standard format for titles, subtitles, section titles, frame titles, and the
text on standout “plain” frames.
37 \pgfkeys{
38

/metropolis/titleformat/.code=\pgfkeysalso{

39

font/titleformat title=#1,

40

font/titleformat subtitle=#1,

41

font/titleformat section=#1,

42

font/titleformat frame=#1,
titleformat plain=#1,

43
44

}

45 }

For backwards compatibility with earlier betas of the theme, we implement deprecated option names as aliases to the corresponding key=value options.
46 \pgfkeys{/metropolis/.cd,
47
48
49
50
51
52

usetitleprogressbar/.code=\pgfkeysalso{outer/progressbar=frametitle},
noslidenumbers/.code=\pgfkeysalso{outer/numbering=none},
usetotalslideindicator/.code=\pgfkeysalso{outer/numbering=fraction},
nosectionslide/.code=\pgfkeysalso{inner/sectionpage=none},
darkcolors/.code=\pgfkeysalso{color/background=dark},
blockbg/.code=\pgfkeysalso{color/block=fill, inner/block=fill},

53 }

15

Set default values for options.
54 \newcommand{\metropolis@setdefaults}{
55

\pgfkeys{/metropolis/.cd,
titleformat plain=regular,

56
57

}

58 }

8.1.3 Component sub-packages
Having processed the options, we can now load the component sub-packages of
the theme.
59 \useinnertheme{metropolis}
60 \useoutertheme{metropolis}
61 \usecolortheme{metropolis}
62 \usefonttheme{metropolis}

The tol theme for pgfplots is only loaded if pgfplots is used.
63 \AtEndPreamble{%
64
65
66

\@ifpackageloaded{pgfplots}{%
\RequirePackage{pgfplotsthemetol}
}{}

67 }

8.1.4 Custom commands
The parent theme defines custom commands as their proper usage may depend
on multiple sub-packages.
\metroset

Allows the user to change options midway through a presentation.
68 \newcommand{\metroset}[1]{\pgfkeys{/metropolis/.cd,#1}}

\plain

Creates a plain frame with dark background, suitable for displaying images or
a few words. The format of the text can be set with the titleformat plain
option.
69 \def\metropolis@plaintitleformat#1{#1}

16

70 \newcommand{\plain}[2][]{%

\PackageWarning{beamerthememetropolis}{%

71

The syntax ‘\plain’ may be deprecated in a future ver-

72

sion of Metropolis.
Please use a frame with [standout] instead.

73
74

}

75

\begin{frame}[standout]{#1}

76
77

\metropolis@plaintitleformat{#2}
\end{frame}

78 }

\mreducelistspacing
79 \newcommand{\mreducelistspacing}{\vspace{-\topsep}}

8.1.5 Process package options
80 \metropolis@setdefaults
81 \ProcessPgfOptions{/metropolis}

8.2

metropolis inner theme

A beamer inner theme dictates the style of the frame elements traditionally set
in the “body” of each slide. These include:
• title, part, and section pages;
• itemize, enumerate, and description environments;
• block environments including theorems and proofs;
• figures and tables; and
• footnotes and plain text.

8.2.1 Package dependencies
82 \RequirePackage{etoolbox}
83 \RequirePackage{keyval}
84 \RequirePackage{calc}
85 \RequirePackage{pgfopts}
86 \RequirePackage{tikz}

17

8.2.2
sectionpage

Options

Optionally add a slide marking the beginning of each section.
87 \pgfkeys{
88

/metropolis/inner/sectionpage/.cd,

89

.is choice,

90

none/.code=\metropolis@disablesectionpage,

91

simple/.code={\metropolis@enablesectionpage
\setbeamertemplate{section page}[simple]},

92

progressbar/.code={\metropolis@enablesectionpage

93

\setbeamertemplate{section page}[progressbar]},

94
95 }

sectionpage

Optionally add a slide marking the beginning of each subsection.
96 \pgfkeys{
97

/metropolis/inner/subsectionpage/.cd,

98

.is choice,

99

none/.code=\metropolis@disablesubsectionpage,
simple/.code={\metropolis@enablesubsectionpage

100

\setbeamertemplate{section page}[simple]},

101

progressbar/.code={\metropolis@enablesubsectionpage

102

\setbeamertemplate{section page}[progressbar]},

103
104 }

etropolis@inner@setdefaults

Set default values for inner theme options.
105 \newcommand{\metropolis@inner@setdefaults}{
106

\pgfkeys{/metropolis/inner/.cd,
sectionpage=progressbar,

107

subsectionpage=none

108
109

}

110 }

8.2.3
title page

Title page

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 space on the
title slide.

18

111 \setbeamertemplate{title
112
113
114
115
116
117

page}{

\begin{minipage}[b][\paperheight]{\textwidth}
\ifx\inserttitlegraphic\@empty\else\usebeamertemplate*{title graphic}\fi
\vfill%
\ifx\inserttitle\@empty\else\usebeamertemplate*{title}\fi
\ifx\insertsubtitle\@empty\else\usebeamertemplate*{subtitle}\fi
\usebeamertemplate*{title separator}

Beamer’s definition of \insertauthor is always nonempty, so we have to test
another macro initialized by \author{...} to see if the user has defined an
author. This solution was suggested by Enrico Gregorio in an answer to this Stack
Exchange question.
118
119
120

\ifx\beamer@shortauthor\@empty\else\usebeamertemplate*{author}\fi
\ifx\insertdate\@empty\else\usebeamertemplate*{date}\fi
\ifx\insertinstitute\@empty\else\usebeamertemplate*{institute}\fi

121

\vfill

122

\vspace*{1mm}

123

\end{minipage}

124 }

Normal people should use \maketitle or \titlepage instead of using the
title page beamer template directly. Beamer already defines these macros,
but we patch them here to make the title page [plain] by default, remove
\@thanks, and ensure the title frame number doesn’t count.
\maketitle
\titlepage

Inserts the title frame, or causes the current frame to use the title page
template.
125 \def\maketitle{%
126
127
128
129
130

\ifbeamer@inframe
\titlepage
\else
\frame[plain,noframenumbering]{\titlepage}
\fi

131 }
132 \def\titlepage{%
133

\usebeamertemplate{title page}

134 }

19

title graphic

Set the title graphic in a zero-height box, so it doesn’t change the position of
other elements.
135 \setbeamertemplate{title
136

graphic}{

\vbox to 0pt {
\vspace*{2em}

137

\inserttitlegraphic%

138
139

}%

140

\nointerlineskip%

141 }

title

Set the title on the title page.
142 \setbeamertemplate{title}{
143

\raggedright%

144

\linespread{1.0}%

145

\inserttitle%

146

\par%

147

\vspace*{0.5em}

148 }

subtitle

Set the subtitle on the title page.
149 \setbeamertemplate{subtitle}{
150

\insertsubtitle%

151

\par%

152

\vspace*{0.5em}

153 }

title separator

Template to set the title graphic in a zero-height box. (It won’t change the position of other elements.)
154 \setbeamertemplate{title
155
156

separator}{

\begin{tikzpicture}
\draw[fg, fill=fg] (0,0) rectangle (\textwidth, 0.4pt);

157

\end{tikzpicture}%

158

\par%

159 }

author

Set the author on the title page.

20

160 \setbeamertemplate{author}{
161

\vspace*{2em}

162

\insertauthor%

163

\par%

164

\vspace*{0.25em}

165 }

date

Set the date on the title page.
166 \setbeamertemplate{date}{
167

\insertdate%

168

\par%

169 }

institute

Set the institute on the title page.
170 \setbeamertemplate{institute}{
171

\vspace*{3mm}

172

\insertinstitute%

173

\par%

174 }

8.2.4
section page

Section page

Template for the section title slide at the beginning of each section.
175 \defbeamertemplate{section
176

page}{simple}{

\begin{center}

177

\usebeamercolor[fg]{section title}

178

\usebeamerfont{section title}

179

\insertsectionhead\par

180

\ifx\insertsubsection\@empty\else

181

\usebeamercolor[fg]{subsection title}

182

\usebeamerfont{subsection title}

183

\insertsubsection

184
185

\fi
\end{center}

186 }
187 \defbeamertemplate{section
188

page}{progressbar}{

\centering

21

189

\begin{minipage}{22em}

190

\raggedright

191

\usebeamercolor[fg]{section title}

192

\usebeamerfont{section title}

193

\insertsectionhead\\[-1ex]

194

\usebeamertemplate*{progress bar in section page}

195

\par

196

\ifx\insertsubsection\@empty\else%

197

\usebeamercolor[fg]{subsection title}%

198

\usebeamerfont{subsection title}%

199

\insertsubsection
\fi

200
201

\end{minipage}

202

\par

203

\vspace{\baselineskip}

204 }
205 \newcommand{\metropolis@disablesectionpage}{
206

\AtBeginSection{
% intentionally empty

207
208

}

209 }
210 \newcommand{\metropolis@enablesectionpage}{
211

\AtBeginSection{
\ifbeamer@inframe

212

\sectionpage

213

\else

214

\frame[plain,c,noframenumbering]{\sectionpage}

215

\fi

216
217

}

218 }

subsection page

Template for the subsection title slide that can optionally be added to at the
beginning of each subsection.
219 \setbeamertemplate{subsection
220

page}{%

\usebeamertemplate*{section page}

221 }
222 \newcommand{\metropolis@disablesubsectionpage}{
223
224

\AtBeginSubsection{
% intentionally empty

22

rogress bar in section page

225

}

226 }
227 \newcommand{\metropolis@enablesubsectionpage}{
228

\AtBeginSubsection{

229

\ifbeamer@inframe

230

\subsectionpage
\else

231

\frame[plain,c,noframenumbering]{\subsectionpage}

232

\fi

233
234

}

235 }

Template for the progress bar displayed by default on the section page. This code
is duplicated in large part in the outer theme’s template progress bar in head/foot.
236 \newlength{\metropolis@progressonsectionpage}
237 \setbeamertemplate{progress
238
239

\textwidth * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}%

240

}%

241

\begin{tikzpicture}

242
243
244

bar in section page}{

\setlength{\metropolis@progressonsectionpage}{%

\draw[bg, fill=bg] (0,0) rectangle (\textwidth, 0.4pt);
\draw[fg, fill=fg] (0,0) rectangle (\metropolis@progressonsectionpage, 0.4pt);
\end{tikzpicture}%

245 }

The above code assumes that \insertframenumber is less than or equal to
\inserttotalframenumber. However, this is not true on the first compile; in

the absence of an .aux file, \inserttotalframenumber defaults to 1. This
behaviour could cause fatal errors for long presentations, as \metropolis@progressonsectionpage
would exceed TEX’s maximum length (16383.99999pt, roughly 5.75 metres or 18.9
feet). To avoid this, we increase the default value for \inserttotalframenumber;
presentations with over 4000 slides will still break on first compile, but users in
that situation likely have deeper problems to solve.
246 \def\inserttotalframenumber{100}

23

8.2.5

Block environments

block

The three different block environments differ only in their colours. Rather than

block alerted

repeat the essentially the same template three times, we use the auxiliary macro
\metropolis@block to define all three templates.

block example

247 \newlength{\metropolis@blocksep}
248 \newlength{\metropolis@blockadjust}
249 \setlength{\metropolis@blocksep}{0.75ex}
250 \setlength{\metropolis@blockadjust}{0.25ex}
251 \providecommand{\metropolis@strut}{%

\vphantom{ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz()}%

252
253 }

254 \newcommand{\metropolis@block}[1]{
255

\par\vskip\medskipamount%

256

\setlength{\parskip}{0pt}

If a background color is defined for the block title or body, we need to add a little
bit of padding to the corresponding box. Ideally, this would be accomplished by
setting colsep=0.75ex, which is intended to add “color separation space” only
when the box has a colored background. Unfortunately, colsep also adds this
separation if the background color is inherited, even if the inherited color is
actually empty. (The technical reason for this boils down to the fact that the
\ifx directive does not expand macros.)
To achieve the correct spacing for alertblocks and exampleblocks as well
as for normal blocks, we have to begin the beamercolorbox differently based
on whether block title has an empty background.
If the block title background is empty, or the user has explicitly removed the
background from (e.g.) block title alerted, we just need to set a rightskip
for a nice ragged-right block title.
\ifbeamercolorempty[bg]{block title#1}{%

257

\begin{beamercolorbox}[rightskip=0pt plus 4em]{block ti-

258

tle#1}}{%
259
260
261
262 %

\ifbeamercolorempty[bg]{block title}{%
\begin{beamercolorbox}[rightskip=0pt plus 4em]{block title#1}%
}%
\end{macrocode}

263 %

24

264 %
265 %

Otherwise, if the |block title| has a background, we set the padding based
on |\metropolis@blockskip|. However, we have to visually com-

pensate for
266 %

the |\metropolis@strut| added to the block title (see below) by

267 %

subtracting |\metropolis@blockadjust| from the top and bot-

tom padding.
268 %
269 %

\begin{macrocode}
{%

270
271

\begin{beamercolorbox}[

272

sep=\dimexpr\metropolis@blocksep-\metropolis@blockadjust\relax,

273

leftskip=\metropolis@blockadjust,

274

rightskip=\dimexpr\metropolis@blockadjust plus 4em\relax
]{block title#1}%

275

}}%

276
277 %

\end{macrocode}

278 %
279 %

We can now set the contents of the |block title|. The zero-

width but
280 %

positive-height box |\metropolis@strut| ensures that the block ti-

tle box
281 %

has a consistent height, even if it lacks punctuation, ascen-

ders, or
282 %

descenders.

283 %
284 %

\begin{macrocode}

285

\usebeamerfont*{block title#1}%

286

\metropolis@strut%

287

\insertblocktitle%
\metropolis@strut%

288

\end{beamercolorbox}%

289
290 %

\end{macrocode}

291 %
292 %

Next, we typeset the |block body|. This the code is simi-

lar to, but simpler
293 %

than, the |block title| code since we don’t need to ad-

just for any struts.
294 %
295 %
296

\begin{macrocode}
\nointerlineskip%

25

\ifbeamercolorempty[bg]{block body#1}{%

297

\begin{beamercolorbox}[vmode]{block body#1}}{

298

\ifbeamercolorempty[bg]{block body}{%

299

\begin{beamercolorbox}[vmode]{block body#1}%

300

}{%

301

\begin{beamercolorbox}[sep=\metropolis@blocksep, vmode]{block body#1}%

302

\vspace{-\metropolis@parskip}

303

}}%

304
305

\usebeamerfont{block body#1}%

306

\setlength{\parskip}{\metropolis@parskip}%

307 }

This concludes the auxiliary macro \metropolis@block. Finally, we define the
block beamer templates using this macro.
308 \setbeamertemplate{block

begin}{\metropolis@block{}}

309 \setbeamertemplate{block

alerted begin}{\metropolis@block{ alerted}}

310 \setbeamertemplate{block

example begin}{\metropolis@block{ exam-

ple}}
311 \setbeamertemplate{block

end}{\end{beamercolorbox}\vspace*{0.2ex}}

312 \setbeamertemplate{block

alerted end}{\end{beamercolorbox}\vspace*{0.2ex}}

313 \setbeamertemplate{block

example end}{\end{beamercolorbox}\vspace*{0.2ex}}

8.2.6

Lists and floats

314 \setbeamertemplate{itemize

items}{\textbullet}

315 \setbeamertemplate{caption

label separator}{: }

316 \setbeamertemplate{caption}[numbered]

8.2.7

Footnotes

317 \setbeamertemplate{footnote}{%
318

\parindent 0em\noindent%

319

\raggedright

320

\usebeamercolor{footnote}\hbox to 0.8em{\hfil\insertfootnotemark}\insertfootnotetex

321 }

8.2.8

Text and spacing settings

322 \newlength{\metropolis@parskip}
323 \setlength{\metropolis@parskip}{0.5em}

26

324 \setlength{\parskip}{\metropolis@parskip}
325 \linespread{1.15}

By default, Beamer frames offer the c option to almost vertically center the
text, but the placement is a little too high. To fix this, we redefine the c option
to equalize \beamer@frametopskip and \beamer@framebottomskip. This
solution was suggested by Enrico Gregorio in an answer to this Stack Exchange
question.
326 \define@key{beamerframe}{c}[true]{%

centered

327

\beamer@frametopskip=0pt plus 1fill\relax%

328

\beamer@framebottomskip=0pt plus 1fill\relax%
\beamer@frametopskipautobreak=0pt plus .4\paperheight\relax%

329
330

\beamer@framebottomskipautobreak=0pt plus .6\paperheight\relax%

331

\def\beamer@initfirstlineunskip{}%

332 }

8.2.9

Standout frames

metropolis offers a custom frame format with large, centered text and an inverted background. To use it, add the key standout to the frame: \begin{frame}[standout] ... \e
standout

Optional arguments to Beamer’s frames are implemented using \define@key
from the keyval package, which will execute code when the defined option is
called. For the standout option, we begin a group, change the colors and
fonts, and set a alignment.
333 \providebool{metropolis@standout}
334 \define@key{beamerframe}{standout}[true]{%
335

\booltrue{metropolis@standout}

336

\begingroup

337

\setkeys{beamerframe}{c}

338

\setkeys{beamerframe}{noframenumbering}

339

\ifbeamercolorempty[bg]{palette primary}{
\setbeamercolor{background canvas}{

340

use=palette primary,

341

bg=-palette primary.fg

342

}

343
344
345
346

}{
\setbeamercolor{background canvas}{
use=palette primary,

27

bg=palette primary.bg

347

}

348

}

349
350

\centering

351

\usebeamercolor[fg]{palette primary}

352

\usebeamerfont{standout}

353 }

Then we just have to close the group after the standout slide is finished in
order to restore the colours and fonts for the rest of the presentation.
Unfortunately, we cannot use or this (see
http://tex.stackexchange.com/questions/226319/). Instead, we add
the \endgroup to \beamer@reseteecodes, which is run exactly once at the
end of each slide.
354

\apptocmd{\beamer@reseteecodes}{%

355

\ifbool{metropolis@standout}{

356

\endgroup

357

\boolfalse{metropolis@standout}

358

}{}

359

}{}{}

8.2.10 Process package options
360 \metropolis@inner@setdefaults
361 \ProcessPgfPackageOptions{/metropolis/inner}

8.3

metropolis outer theme

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.

8.3.1 Package dependencies
362 \RequirePackage{etoolbox}
363 \RequirePackage{calc}
364 \RequirePackage{pgfopts}

28

8.3.2
numbering

Options

Adds slide numbers to the bottom right of each slide.
365 \pgfkeys{
366

/metropolis/outer/numbering/.cd,

367

.is choice,

368

none/.code=\setbeamertemplate{frame numbering}[none],

369

counter/.code=\setbeamertemplate{frame numbering}[counter],

370

fraction/.code=\setbeamertemplate{frame numbering}[fraction],

371 }

progressbar

etropolis@outer@setdefaults

Adds a progress bar to the top, bottom, or frametitle of each slide.
372 \pgfkeys{
373

/metropolis/outer/progressbar/.cd,

374

.is choice,

375

none/.code={%

376

\setbeamertemplate{headline}[plain]

377

\setbeamertemplate{frametitle}[plain]

378

\setbeamertemplate{footline}[plain]

379

},

380

head/.code={\pgfkeys{/metropolis/outer/progressbar=none}
\addtobeamertemplate{headline}{}{%

381

\usebeamertemplate*{progress bar in head/foot}

382

}

383
384
385

},
frametitle/.code={\pgfkeys{/metropolis/outer/progressbar=none}
\addtobeamertemplate{frametitle}{}{%

386

\usebeamertemplate*{progress bar in head/foot}

387

}

388
389

},

390

foot/.code={\pgfkeys{/metropolis/outer/progressbar=none}
\addtobeamertemplate{footline}{}{%

391

\usebeamertemplate*{progress bar in head/foot}%

392

}

393
394

},

395 }

Sets default values for outer theme options.

29

396 \newcommand{\metropolis@outer@setdefaults}{
397

\pgfkeys{/metropolis/outer/.cd,

398

numbering=counter,

399

progressbar=none,

400

}

401 }

8.3.3

Head and footline

All good beamer presentations should already remove the navigation symbols,
but metropolis removes them automatically (just in case).
402 \setbeamertemplate{navigation

frame numbering

symbols}{}

Templates for the frame number. Can be omitted, shown or displayed as a fraction of the total frames.
403 \defbeamertemplate{frame

footer}{none}{}

404 \defbeamertemplate{frame

footer}{custom}[1]{ #1 }

405 \defbeamertemplate{frame

numbering}{none}{}

406 \defbeamertemplate{frame

numbering}{counter}{\insertframenumber}

407 \defbeamertemplate{frame

numbering}{fraction}{

408

\insertframenumber/\inserttotalframenumber

409 }

headline
footline

Templates for the head- and footline at the top and bottom of each frame.
410 \defbeamertemplate{headline}{plain}{}
411 \defbeamertemplate{footline}{plain}{%
412

\begin{beamercolorbox}[wd=\textwidth, sep=3ex]{footline}%

413

\usebeamerfont{page number in head/foot}%

414

\usebeamertemplate*{frame footer}

415

\hfill%

416
417

\usebeamertemplate*{frame numbering}
\end{beamercolorbox}%

418 }

30

8.3.4
frametitle

Frametitle

Templates for the frame title, which is optionally underlined with a progress bar.
419 \newlength{\metropolis@frametitle@padding}
420 \setlength{\metropolis@frametitle@padding}{2.2ex}
421 \newcommand{\metropolis@frametitlestrut@start}{

\rule{0pt}{\metropolis@frametitle@padding +%

422
423

\totalheightof{%

424

\ifcsdef{metropolis@frametitleformat}{\metropolis@frametitleformat X}{X}%
}%

425

}%

426
427 }

428 \newcommand{\metropolis@frametitlestrut@end}{

\rule[-\metropolis@frametitle@padding]{0pt}{\metropolis@frametitle@padding}

429
430 }

431 \defbeamertemplate{frametitle}{plain}{%
432

\nointerlineskip%

433

\begin{beamercolorbox}[%

434

wd=\paperwidth,%

435

sep=0pt,%

436

leftskip=\metropolis@frametitle@padding,%
rightskip=\metropolis@frametitle@padding,%

437

]{frametitle}%

438

\metropolis@frametitlestrut@start\insertframetitle\metropolis@frametitlestrut@end%

439

\end{beamercolorbox}%

440
441 }

progress bar in head/foot

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 template
progress bar in section page.
442 \newlength{\metropolis@progressinheadfoot}
443 \setbeamertemplate{progress

bar in head/foot}{

444

\nointerlineskip

445

\setlength{\metropolis@progressinheadfoot}{%

446
447
448

\paperwidth * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}%
}%
\begin{beamercolorbox}[wd=\paperwidth]{progress bar in head/foot}

31

449
450

\begin{tikzpicture}
\draw[bg, fill=bg] (0,0) rectangle (\paperwidth, 0.4pt);

451

\draw[fg, fill=fg] (0,0) rectangle (\metropolis@progressinheadfoot, 0.4pt);

452

\end{tikzpicture}%

453

\end{beamercolorbox}

454 }

appendix

Removes page numbering and per-slide progress bars when \appendix is
called. This makes it easier to include additional “backup slides” at the end of the
presentation, especially in conjunction with the package appendixnumberbeamer.
455 \AtBeginDocument{%
456
457

\apptocmd{\appendix}{%
\pgfkeys{%

458

/metropolis/outer/.cd,

459

numbering=none,

460
461

progressbar=none}
}{}{}

462 }

8.3.5

Process package options

463 \metropolis@outer@setdefaults
464 \ProcessPgfPackageOptions{/metropolis/outer}

8.4

metropolis font theme

A beamer font theme sets the style of the font used in the document.

8.4.1 Package dependencies
465 \RequirePackage{etoolbox}
466 \RequirePackage{ifxetex}
467 \RequirePackage{ifluatex}
468 \RequirePackage{pgfopts}

32

8.4.2

Load Fira fonts

If the presentation is compiled with XeLATEX or LuaLATEX, the fontspec package is
loaded and we search for the Fira fonts.
469 \ifboolexpr{bool
470

\checkfont

{xetex} or bool {luatex}}{

\RequirePackage[no-math]{fontspec}

Checks if a font is installed; if not, fontsnotfound is increased.
471

\newcounter{fontsnotfound}

472

\newcommand{\checkfont}[1]{%

473

\suppressfontnotfounderror=1%

474

\font\x = ”#1” at 10pt

475

\selectfont

476

\ifx\x\nullfont%
\stepcounter{fontsnotfound}%

477

\fi%

478

\suppressfontnotfounderror=0%

479
480

}

481

\iffontsavailable

Resets the fontsnotfound counter and calls \checkfont for each font in the
comma separated list in the first argument.
482

\newcommand{\iffontsavailable}[3]{%

483

\setcounter{fontsnotfound}{0}%

484

\expandafter\forcsvlist\expandafter%

485

\checkfont\expandafter{#1}%

486

\ifnum\value{fontsnotfound}=0%
#2%

487

\else%

488

#3%

489

\fi%

490
491

}

We search for regular, italic, light, light italic, mono, and mono bold 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 also fails, a warning will be
displayed and the standard fonts will be used.

33

492

\iffontsavailable{Fira Sans Light,%

493

Fira Sans Light Italic,%

494

Fira Sans,%

495

Fira Sans Italic}%

496

{%
\setsansfont[ItalicFont={Fira Sans Light Italic},%

497
498

BoldFont={Fira Sans},%

499

BoldItalicFont={Fira Sans Italic}]%
{Fira Sans Light}%

500
501

}{%
\iffontsavailable{Fira Sans Light OT,%

502
503

Fira Sans Light Italic OT,%

504

Fira Sans OT,%
Fira Sans Italic OT}%

505

{%

506

\setsansfont[ItalicFont={Fira Sans Light Italic OT},%

507
508

BoldFont={Fira Sans OT},%

509

BoldItalicFont={Fira Sans Italic OT}]%
{Fira Sans Light OT}%

510

}{%

511

\PackageWarning{beamerthememetropolis}{%

512

Could not find Fira Sans fonts%

513

}

514

}

515
516

}

517

\iffontsavailable{Fira Mono, Fira Mono Bold}{%
\setmonofont[BoldFont={Fira Mono Medium}]{Fira Mono}%

518
519

}{%
\iffontsavailable{Fira Mono OT, Fira Mono Bold OT}{%

520

\setmonofont[BoldFont={Fira Mono Medium OT}]{Fira Mono OT}%

521

}{%

522

\PackageWarning{beamerthememetropolis}{%

523

Could not find Fira Mono fonts%

524

}

525

}

526
527

}

528

\AtBeginEnvironment{tabular}{%
\addfontfeature{Numbers={Monospaced}}%

529
530

}

531 }{%

34

532
533
534

\PackageWarning{beamerthememetropolis}{%
You need to compile with XeLaTeX or LuaLaTeX to use the Fira fonts%
}

535 }

This concludes the portion of the code which is only run when compiled with
XeLATEX or LuaLATEX. The remainder of this package applies regardless of the compiling engine.

8.4.3

General font definitions

536 \setbeamerfont{title}{size=\Large,%

series=\bfseries}

537

538 \setbeamerfont{author}{size=\small}
539 \setbeamerfont{date}{size=\small}
540 \setbeamerfont{section

title}{size=\Large,%
series=\bfseries}

541
542 \setbeamerfont{block

title}{size=\normalsize,%
series=\bfseries}

543
544 \setbeamerfont{block

title alerted}{size=\normalsize,%
series=\bfseries}

545

546 \setbeamerfont*{subtitle}{size=\large}
547 \setbeamerfont{frametitle}{size=\large,%

series=\bfseries}

548

549 \setbeamerfont{caption}{size=\small}
550 \setbeamerfont{caption

name}{series=\bfseries}

551 \setbeamerfont{description
552 \setbeamerfont{page

item}{series=\bfseries}

number in head/foot}{size=\scriptsize}

553 \setbeamerfont{bibliography

entry author}{size=\normalsize,%
series=\normalfont}

554
555 \setbeamerfont{bibliography

entry title}{size=\normalsize,%
series=\bfseries}

556
557 \setbeamerfont{bibliography

entry location}{size=\normalsize,%
series=\normalfont}

558
559 \setbeamerfont{bibliography

entry note}{size=\small,%
series=\normalfont}

560
561 \setbeamerfont{standout}{size=\Large,%
562

series=\bfseries}

35

8.4.4
titleformat title

Title format options

Controls the format of the title.
563 \pgfkeys{

/metropolis/font/titleformat title/.cd,

564
565

.is choice,

566

regular/.code={%
\let\metropolis@titleformat\@empty%

567

\setbeamerfont{title}{shape=\normalfont}%

568
569

},

570

smallcaps/.code={%
\let\metropolis@titleformat\@empty%

571

\setbeamerfont{title}{shape=\scshape}%

572
573

},

574

allsmallcaps/.code={%

575

\let\metropolis@titleformat\lowercase%

576

\setbeamerfont{title}{shape=\scshape}%
\PackageWarning{beamerthememetropolis}{%

577

Be aware that titleformat title=allsmallcaps can lead to prob-

578

lems%
}

579
580

},

581

allcaps/.code={%

582

\let\metropolis@titleformat\uppercase%

583

\setbeamerfont{title}{shape=\normalfont}

584

\PackageWarning{beamerthememetropolis}{%

585

Be aware that titleformat title=allcaps can lead to problems%
}

586
587

},

588 }

titleformat subtitle

Control the format of the subtitle.
589 \pgfkeys{
590

/metropolis/font/titleformat subtitle/.cd,

591

.is choice,

592

regular/.code={%

593

\let\metropolis@subtitleformat\@empty%

594

\setbeamerfont{subtitle}{shape=\normalfont}%

595

},

36

smallcaps/.code={%

596

\let\metropolis@subtitleformat\@empty%

597

\setbeamerfont{subtitle}{shape=\scshape}%

598
599

},

600

allsmallcaps/.code={%

601

\let\metropolis@subtitleformat\lowercase%

602

\setbeamerfont{subtitle}{shape=\scshape}%

603

\PackageWarning{beamerthememetropolis}{%
Be aware that titleformat subtitle=allsmallcaps can lead to prob-

604

lems%
}

605
606

},

607

allcaps/.code={%

608

\let\metropolis@subtitleformat\uppercase%

609

\setbeamerfont{subtitle}{shape=\normalfont}%

610

\PackageWarning{beamerthememetropolis}{%

611

Be aware that titleformat subtitle=allcaps can lead to problems%
}

612
613

},

614 }

titleformat section

Controls the format of the section title.
615 \pgfkeys{
616

/metropolis/font/titleformat section/.cd,

617

.is choice,

618

regular/.code={%

619

\let\metropolis@sectiontitleformat\@empty%

620

\setbeamerfont{section title}{shape=\normalfont}%

621

},

622

smallcaps/.code={%

623

\let\metropolis@sectiontitleformat\@empty%

624

\setbeamerfont{section title}{shape=\scshape}%

625

},

626

allsmallcaps/.code={%

627

\let\metropolis@sectiontitleformat\MakeLowercase%

628

\setbeamerfont{section title}{shape=\scshape}%

629

\PackageWarning{beamerthememetropolis}{%

630

Be aware that titleformat section=allsmallcaps can lead to prob-

37

lems%
}

631
632

},

633

allcaps/.code={%

634

\let\metropolis@sectiontitleformat\MakeUppercase%

635

\setbeamerfont{section title}{shape=\normalfont}%

636

\PackageWarning{beamerthememetropolis}{%

637

Be aware that titleformat section=allcaps can lead to problems%
}

638

},

639
640 }

frametitleformat

Control the format of the frame title.
641 \pgfkeys{
642

/metropolis/font/titleformat frame/.cd,

643

.is choice,

644

regular/.code={%
\let\metropolis@frametitleformat\@empty%

645

\setbeamerfont{frametitle}{shape=\normalfont}%

646
647

},

648

smallcaps/.code={%

649

\let\metropolis@frametitleformat\@empty%

650

\setbeamerfont{frametitle}{shape=\scshape}%

651

},

652

allsmallcaps/.code={%

653

\let\metropolis@frametitleformat\MakeLowercase%

654

\setbeamerfont{frametitle}{shape=\scshape}%

655

\PackageWarning{beamerthememetropolis}{%
Be aware that titleformat frame=allsmallcaps can lead to prob-

656

lems%
}

657
658

},

659

allcaps/.code={%

660

\let\metropolis@frametitleformat\MakeUppercase%

661

\setbeamerfont{frametitle}{shape=\normalfont}

662
663
664

\PackageWarning{beamerthememetropolis}{%
Be aware that titleformat frame=allcaps can lead to problems%
}

38

},

665
666 }

titleformat aliases

metropolis@font@setdefaults

Allows titleformat title et al. to be used in the \usetheme declaration,
where LATEX automatically removes all spaces.
667 \pgfkeys{
668
669

/metropolis/font/.cd,
titleformattitle/.code=\pgfkeysalso{titleformat title=#1},

670

titleformatsubtitle/.code=\pgfkeysalso{titleformat subtitle=#1},

671

titleformatsection/.code=\pgfkeysalso{titleformat section=#1},

672

titleformatframe/.code=\pgfkeysalso{titleformat frame=#1},

673 }

Sets default values for font theme options.
674 \newcommand{\metropolis@font@setdefaults}{
675

\pgfkeys{/metropolis/font/.cd,

676

titleformat title=regular,

677

titleformat subtitle=regular,

678

titleformat section=regular,

679

titleformat frame=regular,

680

}

681 }

We first define hooks to change the case format of the titles.
682 \def\metropolis@titleformat#1{#1}
683 \def\metropolis@subtitleformat#1{#1}
684 \def\metropolis@sectiontitleformat#1{#1}
685 \def\metropolis@frametitleformat#1{#1}

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 this StackExchange
question.
686 \patchcmd{\beamer@title}%
687

{\def\inserttitle{#2}}%

688

{\def\inserttitle{\metropolis@titleformat{#2}}}%

689

{}%

39

690

{\PackageError{beamerfontthememetropolis}{Patching title failed}}

691 \patchcmd{\beamer@subtitle}%
692

{\def\insertsubtitle{#2}}%

693

{\def\insertsubtitle{\metropolis@subtitleformat{#2}}}%

694
695

{}%
{\PackageError{beamerfontthememetropolis}{Patching subtitle failed}}

696 \patchcmd{\sectionentry}
697

{\def\insertsectionhead{#2}}

698

{\def\insertsectionhead{\metropolis@sectiontitleformat{#2}}}

699

{}

700

{\PackageError{beamerfontthememetropolis}{Patching section title failed}}

701 \patchcmd{\beamer@section}
702
703

{\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{#1}}}
{\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{%
\metropolis@sectiontitleformat{#1}}}}

704
705

{}

706

{\PackageError{beamerfontthememetropolis}{Patching section title failed}}

Similarly, to make the \MakeLowercase and \MakeUppercase macros work
in the frame title we have to patch \beamer@@frametitle.
707 \patchcmd{\beamer@@frametitle}
708

{\beamer@ifempty{#2}{}{%
\gdef\insertframetitle{{#2\ifnum\beamer@autobreakcount>0\relax{}\space%

709

\usebeamertemplate*{frametitle continuation}\fi}}%

710
711

\gdef\beamer@frametitle{#2}%

712

\gdef\beamer@shortframetitle{#1}%
}}

713
714

{\beamer@ifempty{#2}{}{%
\gdef\insertframetitle{{\metropolis@frametitleformat{#2}\ifnum%

715
716

\beamer@autobreakcount>0\relax{}\space%

717

\usebeamertemplate*{frametitle continuation}\fi}}%

718

\gdef\beamer@frametitle{#2}%

719

\gdef\beamer@shortframetitle{#1}%
}}

720
721
722

{}
{\PackageError{beamerfontthememetropolis}{Patching frame title failed}}

40

8.4.5

Process package options

723 \metropolis@font@setdefaults
724 \ProcessPgfPackageOptions{/metropolis/font}

8.5 metropolis color theme
8.5.1 Package dependencies
725 \RequirePackage{pgfopts}

8.5.2
block

Options

Optionally adds a light grey background to block environments like theorem
and example.
726 \pgfkeys{
727

/metropolis/color/block/.cd,

728

.is choice,

729

transparent/.code=\metropolis@block@transparent,

730

fill/.code=\metropolis@block@fill,

731 }

colors

etropolis@color@setdefaults

Provides the option to have a dark background and light foreground instead of
the reverse.
732 \pgfkeys{
733

/metropolis/color/background/.cd,

734

.is choice,

735

dark/.code=\metropolis@colors@dark,

736

light/.code=\metropolis@colors@light,

737 }

Sets default values for color theme options.
738 \newcommand{\metropolis@color@setdefaults}{
739

\pgfkeys{/metropolis/color/.cd,

740

background=light,

741

block=transparent,

742

}

743 }

41

8.5.3

Base colors

744 \definecolor{mDarkBrown}{HTML}{604c38}
745 \definecolor{mDarkTeal}{HTML}{23373b}
746 \definecolor{mLightBrown}{HTML}{EB811B}
747 \definecolor{mLightGreen}{HTML}{14B03D}

8.5.4

Base styles

All colors in metropolis are derived from the definitions of normal text,
alerted text, and example text.
748 \newcommand{\metropolis@colors@dark}{
749

\setbeamercolor{normal text}{%
fg=black!2,

750

bg=mDarkTeal

751
752

}

753 }
754 \newcommand{\metropolis@colors@light}{
755

\setbeamercolor{normal text}{%

756

fg=mDarkTeal,

757

bg=black!2

758

}

759 }
760 \setbeamercolor{alerted
761

text}{%

fg=mLightBrown

762 }
763 \setbeamercolor{example
764

text}{%

fg=mLightGreen

765 }

8.5.5

Derived colors

The titles and structural elements (e.g. itemize bullets) are set in the same
color as normal text. This would ideally done by setting normal text
as a parent style, which we do to set titlelike, but this doesn’t work for
structure as its foreground is set explicitly in beamercolorthemedefault.sty.
766 \setbeamercolor{titlelike}{use=normal
767 \setbeamercolor{author}{use=normal

42

text, parent=normal text}

text, parent=normal text}

768 \setbeamercolor{date}{use=normal

text, parent=normal text}

769 \setbeamercolor{institute}{use=normal

text, parent=normal text}

770 \setbeamercolor{structure}{use=normal

text, fg=normal text.fg}

The “primary” palette should be used for the most important navigational elements, and possibly of other elements. metropolis uses it for frame titles and
slides.
771 \setbeamercolor{palette
772

use=normal text,

773

fg=normal text.bg,

774

bg=normal text.fg

primary}{%

775 }
776 \setbeamercolor{frametitle}{%
777

use=palette primary,

778

parent=palette primary

779 }

The metropolis inner or outer themes optionally display progress 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 title page is also set based
on the progress bar color and can be customized with title separator.
780 \setbeamercolor{progress

bar}{%

781

use=alerted text,

782

fg=alerted text.fg,

783

bg=alerted text.fg!50!black!30

784 }
785 \setbeamercolor{title
786

use=progress bar,

787

parent=progress bar

separator}{

788 }
789 \setbeamercolor{progress
790

use=progress bar,

791

parent=progress bar

bar in head/foot}{%

792 }
793 \setbeamercolor{progress
794

use=progress bar,

795

parent=progress bar

bar in section page}{

796 }

43

Block environments such as theorem and example have no background color
by default. The option block=fill sets a background color based on the background and foreground of normal text. The option block=transparent
reverts the block environments to an empty background, which can be useful if
changing colors mid-presentation.
797 \newcommand{\metropolis@block@transparent}{
798

\setbeamercolor{block title}{%

799

use=normal text,

800

fg=normal text.fg,
bg=

801
802

}

803

\setbeamercolor{block body}{
bg=

804
805

}

806 }
807 \newcommand{\metropolis@block@fill}{
808

\setbeamercolor{block title}{%

809

use=normal text,

810

fg=normal text.fg,
bg=normal text.bg!80!fg

811
812

}

813

\setbeamercolor{block body}{

814

use={block title, normal text},

815

bg=block title.bg!50!normal text.bg

816

}

817 }
818 \setbeamercolor{block

title alerted}{%

819

use={block title, alerted text},

820

bg=block title.bg,

821

fg=alerted text.fg

822 }
823 \setbeamercolor{block

title example}{%

824

use={block title, example text},

825

bg=block title.bg,

826

fg=example text.fg

827 }
828 \setbeamercolor{block

body alerted}{use=block body, parent=block body}

829 \setbeamercolor{block

body example}{use=block body, parent=block body}

44

Footnotes
830 \setbeamercolor{footnote}{fg=normal
831 \setbeamercolor{footnote

8.5.6

text.fg!90}

mark}{fg=.}

Process package options

832 \metropolis@color@setdefaults
833 \ProcessPgfPackageOptions{/metropolis/color}
834 \mode

8.6 Tol pgfplots theme
Paul Tol’s 12-color palette1 is as follows:
835 \definecolor{TolDarkPurple}{HTML}{332288}
836 \definecolor{TolDarkBlue}{HTML}{6699CC}
837 \definecolor{TolLightBlue}{HTML}{88CCEE}
838 \definecolor{TolLightGreen}{HTML}{44AA99}
839 \definecolor{TolDarkGreen}{HTML}{117733}
840 \definecolor{TolDarkBrown}{HTML}{999933}
841 \definecolor{TolLightBrown}{HTML}{DDCC77}
842 \definecolor{TolDarkRed}{HTML}{661100}
843 \definecolor{TolLightRed}{HTML}{CC6677}
844 \definecolor{TolLightPink}{HTML}{AA4466}
845 \definecolor{TolDarkPink}{HTML}{882255}
846 \definecolor{TolLightPurple}{HTML}{AA4499}

To use these colors, we describe “cycle lists” from which PGF chooses styles for
the different series in a chart.
mbarplot cycle

Colors and styles intended for bar charts with up to 12 series.
847 \pgfplotscreateplotcyclelist{mbarplot

cycle}{%

848

{draw=TolDarkBlue,

fill=TolDarkBlue!70},

849

{draw=TolLightBrown,

fill=TolLightBrown!70},

850

{draw=TolLightGreen,

fill=TolLightGreen!70},

{draw=TolDarkPink,

fill=TolDarkPink!70},

851

1 Tol

actually describes several palettes; these colours are taken from the bottom row of Figure 3
in his technical note.

45

852

{draw=TolDarkPurple,

fill=TolDarkPurple!70},

853

{draw=TolDarkRed,

fill=TolDarkRed!70},

854

{draw=TolDarkBrown,

fill=TolDarkBrown!70},

855

{draw=TolLightRed,

fill=TolLightRed!70},

856

{draw=TolLightPink,

fill=TolLightPink!70},

857

{draw=TolLightPurple, fill=TolLightPurple!70},

858

{draw=TolLightBlue,

fill=TolLightBlue!70},

859

{draw=TolDarkGreen,

fill=TolDarkGreen!70},

860 }

mlineplot cycle

Colors and styles intended for line charts with up to 4 series.
861 \pgfplotscreateplotcyclelist{mlineplot

cycle}{%

862

{TolDarkBlue, mark=*, mark size=1.5pt},

863

{TolLightBrown, mark=square*, mark size=1.3pt},

864

{TolLightGreen, mark=triangle*, mark size=1.5pt},

865

{TolDarkBrown, mark=diamond*, mark size=1.5pt},

866 }

However, the above cycle lists are not applied automatically. We still need to
define styles — mlineplot and mbarplot — that the user can apply to the axis
of a pgfplots chart to use the colors. We’ll also take the opportunity to adjust
the display of chart axes when these styles are used.
867 \pgfplotsset{
868

mlineplot

compat=1.9,

A style to apply to the axis of a PGF line plot.
869

mlineplot/.style={

870

mbaseplot,

871

xmajorgrids=true,

872

ymajorgrids=true,

873

major grid style={dotted},

874

axis x line=bottom,

875

axis y line=left,

876

legend style={
cells={anchor=west},

877

draw=none

878
879

},

880

cycle list name=mlineplot cycle,

46

881

},

mbarplot

A style to apply to the axis of a PGF bar chart. mbarplot uses vertical bars by

horizontal mbarplot

default, while horizontal mbarplot has horizontal bars as the name implies.
Their shared properties are factored out into the internal style mbarplot base.
882

mbarplot base/.style={

883

mbaseplot,

884

bar width=6pt,

885

axis y line*=none,

886

},

887

mbarplot/.style={

888

mbarplot base,

889

ybar,

890

xmajorgrids=false,

891

ymajorgrids=true,

892

area legend,

893

legend image code/.code={%
\draw[#1] (0cm,-0.1cm) rectangle (0.15cm,0.1cm);

894

},

895

cycle list name=mbarplot cycle,

896
897

},

898

horizontal mbarplot/.style={

899

mbarplot base,

900

xmajorgrids=true,

901

ymajorgrids=false,

902

xbar stacked,

903

area legend,

904

legend image code/.code={%
\draw[#1] (0cm,-0.1cm) rectangle (0.15cm,0.1cm);

905
906

},

907

cycle list name=mbarplot cycle,

908

mbaseplot

},

Adjusts the appearance of the axes in a PGF chart.
909

mbaseplot/.style={

910

legend style={

911

draw=none,

912

fill=none,

913

cells={anchor=west},

47

914

},

915

x tick label style={
font=\footnotesize

916
917

},

918

y tick label style={

919

font=\footnotesize

920

},

921

legend style={
font=\footnotesize

922
923

},

924

major grid style={
dotted,

925

},

926

axis x line*=bottom,

927
928

},

929

disable thousands separator/.style={
/pgf/number format/.cd,

930

1000 sep={}

931
932

},

933 }

48



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.5
Linearized                      : No
Page Mode                       : UseOutlines
Page Count                      : 48
Creator                         : LaTeX with hyperref package
Producer                        : xdvipdfmx (0.7.9)
Create Date                     : 2016:03:14 11:47:15+01:00
EXIF Metadata provided by EXIF.tools

Navigation menu