Metropolistheme Manual
metropolistheme_manual
User Manual:
Open the PDF directly: View PDF .
Page Count: 50
Download | |
Open PDF In Browser | View PDF |
Modern Beamer Presentations with the metropolis package Matthias Vogelgesang matthias.vogelgesang@gmail.com v1.2 — 2017/01/23 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 7 6.2 6.3 Interactions with other color themes . . . . . . . . . . . . . . . . . . . 12 Notes on second screen . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 6.4 6.5 Standout frames with labels . . . . . . . . . . . . . . . . . . . . . . . . 13 Standout frames with Pandoc . . . . . . . . . . . . . . . . . . . . . . . . 14 License 14 8 Implementation 8.1 metropolis parent theme . . . . . . . . . . . . . . . . . . . . . . . . . . 15 8.1.1 Package dependencies . . . . . . . . . . . . . . . . . . . . . . . 15 8.1.2 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 8.1.3 8.1.4 8.2 8.3 15 Component sub-packages . . . . . . . . . . . . . . . . . . . . . 17 Custom commands . . . . . . . . . . . . . . . . . . . . . . . . . . 17 8.1.5 Process package options . . . . . . . . . . . . . . . . . . . . . . 18 metropolis inner theme . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 8.2.1 Package dependencies . . . . . . . . . . . . . . . . . . . . . . . 18 8.2.2 8.2.3 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Title page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 8.2.4 8.2.5 8.2.6 Section page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Block environments . . . . . . . . . . . . . . . . . . . . . . . . . 25 Lists and floats . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 8.2.7 8.2.8 Footnotes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Text and spacing settings . . . . . . . . . . . . . . . . . . . . . . 27 8.2.9 Standout frames . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 8.2.10 Process package options . . . . . . . . . . . . . . . . . . . . . . 29 metropolis outer theme . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 8.3.1 8.3.2 Package dependencies . . . . . . . . . . . . . . . . . . . . . . . 29 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 8.3.3 Head and footline . . . . . . . . . . . . . . . . . . . . . . . . . . 31 2 8.3.4 8.4 8.5 8.3.5 Process package options . . . . . . . . . . . . . . . . . . . . . . 33 metropolis font theme . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 8.4.1 8.4.2 8.4.3 Package dependencies . . . . . . . . . . . . . . . . . . . . . . . 34 Load Fira fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 General font definitions . . . . . . . . . . . . . . . . . . . . . . . 36 8.4.4 8.4.5 Title format options . . . . . . . . . . . . . . . . . . . . . . . . . 37 Process package options . . . . . . . . . . . . . . . . . . . . . . 42 metropolis color theme . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 8.5.1 Package dependencies . . . . . . . . . . . . . . . . . . . . . . . 43 8.5.2 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 8.5.3 8.5.4 8.6 1 Frametitle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Base colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 Base styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 8.5.5 Derived colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 8.5.6 Process package options . . . . . . . . . . . . . . . . . . . . . . 47 Tol pgfplots theme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 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). titleformat 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 6.4 Standout frames with labels Because the standout frame option creates a group to restrict the colour change to a single slide, labels defined after calling standout will stay local to the group. In other words, the following may result in a “label undefined” error. \begin{frame}[standout, label=conclusion]{Conclusion} Awesome slide 13 \end{frame} To fix this problem, change the order of the keys in the frame. \begin{frame}[label=conclusion, standout]{Conclusion} Awesome slide \end{frame} This error can be unwittingly triggered if you export your slides from Emacs Org mode, which automatically adds labels after frame options. Alex Branham offers the following solution for Org mode users, using org-set-property. * Start of a frame :PROPERTIES: :BEAMER_opt: label=conclusion,standout :END: 6.5 Standout frames with Pandoc With Pandoc versions prior 1.17.2 it was not possible to create standout frames because Pandoc only supported a specific list of frame attributes thus ignoring additional attributes such as {.standout}. 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. 14 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 }, 15 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}% 32 \PackageWarning{beamerthememetropolis}{% Be aware that titleformat plain=allcaps can lead to prob- 33 lems% } 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, 43 titleformat plain=#1, 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 usetitleprogressbar/.code=\pgfkeysalso{outer/progressbar=frametitle}, 48 noslidenumbers/.code=\pgfkeysalso{outer/numbering=none}, 49 usetotalslideindicator/.code=\pgfkeysalso{outer/numbering=fraction}, 50 nosectionslide/.code=\pgfkeysalso{inner/sectionpage=none}, 51 darkcolors/.code=\pgfkeysalso{color/background=dark}, 52 blockbg/.code=\pgfkeysalso{color/block=fill, inner/block=fill}, 16 53 } 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. 17 69 \def\metropolis@plaintitleformat#1{#1} 70 \newcommand{\plain}[2][]{% \PackageWarning{beamerthememetropolis}{% 71 The syntax ‘\plain’ may be deprecated in a future version of Metropo- 72 lis. 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} 18 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 } subsectionpage 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. 19 111 \setbeamertemplate{title 112 page}{ \begin{minipage}[b][\paperheight]{\textwidth} 113 \ifx\inserttitlegraphic\@empty\else\usebeamertemplate*{title graphic}\fi 114 \vfill% 115 \ifx\inserttitle\@empty\else\usebeamertemplate*{title}\fi 116 \ifx\insertsubtitle\@empty\else\usebeamertemplate*{subtitle}\fi 117 \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 \ifx\beamer@shortauthor\@empty\else\usebeamertemplate*{author}\fi 119 \ifx\insertdate\@empty\else\usebeamertemplate*{date}\fi 120 \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 } 20 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 \raggedright% 151 \insertsubtitle% 152 \par% 153 \vspace*{0.5em} 154 } title separator Template to set the title graphic in a zero-height box. (It won’t change the position of other elements.) 155 \newlength{\metropolis@titleseparator@linewidth} 156 \setlength{\metropolis@titleseparator@linewidth}{0.4pt} 157 \setbeamertemplate{title 158 159 separator}{ \begin{tikzpicture} \fill[fg] (0,0) rectangle (\textwidth, \metropolis@titleseparator@linewidth); 160 \end{tikzpicture}% 161 \par% 162 } 21 author Set the author on the title page. 163 \setbeamertemplate{author}{ 164 \vspace*{2em} 165 \insertauthor% 166 \par% 167 \vspace*{0.25em} 168 } date Set the date on the title page. 169 \setbeamertemplate{date}{ 170 \insertdate% 171 \par% 172 } institute Set the institute on the title page. 173 \setbeamertemplate{institute}{ 174 \vspace*{3mm} 175 \insertinstitute% 176 \par% 177 } 8.2.4 section page Section page Template for the section title slide at the beginning of each section. 178 \defbeamertemplate{section 179 page}{simple}{ \begin{center} 180 \usebeamercolor[fg]{section title} 181 \usebeamerfont{section title} 182 \insertsectionhead\par 183 \ifx\insertsubsectionhead\@empty\else 184 \usebeamercolor[fg]{subsection title} 185 \usebeamerfont{subsection title} 186 187 188 \insertsubsectionhead \fi \end{center} 189 } 22 190 \defbeamertemplate{section 191 \centering 192 \begin{minipage}{22em} page}{progressbar}{ 193 \raggedright 194 \usebeamercolor[fg]{section title} 195 \usebeamerfont{section title} 196 \insertsectionhead\\[-1ex] 197 \usebeamertemplate*{progress bar in section page} 198 \par 199 \ifx\insertsubsectionhead\@empty\else% 200 \usebeamercolor[fg]{subsection title}% 201 \usebeamerfont{subsection title}% 202 \insertsubsectionhead \fi 203 204 \end{minipage} 205 \par 206 \vspace{\baselineskip} 207 } 208 \newcommand{\metropolis@disablesectionpage}{ 209 \AtBeginSection{ % intentionally empty 210 211 } 212 } 213 \newcommand{\metropolis@enablesectionpage}{ 214 \AtBeginSection{ \ifbeamer@inframe 215 \sectionpage 216 \else 217 \frame[plain,c,noframenumbering]{\sectionpage} 218 \fi 219 220 } 221 } subsection page Template for the subsection title slide that can optionally be added to at the beginning of each subsection. 222 \setbeamertemplate{subsection 223 page}{% \usebeamertemplate*{section page} 224 } 225 \newcommand{\metropolis@disablesubsectionpage}{ 23 rogress bar in section page \AtBeginSubsection{ 226 % intentionally empty 227 } 228 229 } 230 \newcommand{\metropolis@enablesubsectionpage}{ 231 \AtBeginSubsection{ 232 \ifbeamer@inframe 233 \subsectionpage \else 234 \frame[plain,c,noframenumbering]{\subsectionpage} 235 \fi 236 } 237 238 } 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. 239 \newlength{\metropolis@progressonsectionpage} 240 \newlength{\metropolis@progressonsectionpage@linewidth} 241 \setlength{\metropolis@progressonsectionpage@linewidth}{0.4pt} 242 \setbeamertemplate{progress bar in section page}{ \setlength{\metropolis@progressonsectionpage}{% 243 \textwidth * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}% 244 245 }% 246 \begin{tikzpicture} 247 \fill[bg] (0,0) rectangle (\textwidth, \metropolis@progressonsectionpage@linewid 248 \fill[fg] (0,0) rectangle (\metropolis@progressonsectionpage, \metropolis@progressonsectionpage@linewidth); 249 \end{tikzpicture}% 250 } 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 24 that situation likely have deeper problems to solve. 251 \def\inserttotalframenumber{100} 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 252 \newlength{\metropolis@blocksep} 253 \newlength{\metropolis@blockadjust} 254 \setlength{\metropolis@blocksep}{0.75ex} 255 \setlength{\metropolis@blockadjust}{0.25ex} 256 \providecommand{\metropolis@strut}{% 257 \vphantom{ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz()}% 258 } 259 \newcommand{\metropolis@block}[1]{ 260 \par\vskip\medskipamount% 261 \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. 262 263 264 \ifbeamercolorempty[bg]{block title#1}{% \begin{beamercolorbox}[rightskip=0pt plus 4em]{block title#1}}{% \ifbeamercolorempty[bg]{block title}{% 25 \begin{beamercolorbox}[rightskip=0pt plus 4em]{block title#1}% 265 }% 266 267 % \end{macrocode} 268 % 269 % Otherwise, if the |block title| has a background, we set the padding based 270 % on |\metropolis@blockskip|. However, we have to visually com- pensate for 271 % the |\metropolis@strut| added to the block title (see below) by 272 % subtracting |\metropolis@blockadjust| from the top and bottom padding. 273 % 274 % \begin{macrocode} {% 275 \begin{beamercolorbox}[ 276 277 sep=\dimexpr\metropolis@blocksep-\metropolis@blockadjust\relax, 278 leftskip=\metropolis@blockadjust, rightskip=\dimexpr\metropolis@blockadjust plus 4em\relax 279 ]{block title#1}% 280 }}% 281 282 % \end{macrocode} 283 % 284 % We can now set the contents of the |block title|. The zero-width but 285 % positive-height box |\metropolis@strut| ensures that the block ti- tle box 286 % has a consistent height, even if it lacks punctuation, ascen- ders, or 287 % descenders. 288 % 289 % \begin{macrocode} 290 \usebeamerfont*{block title#1}% 291 \metropolis@strut% 292 \insertblocktitle% 293 \metropolis@strut% \end{beamercolorbox}% 294 295 % \end{macrocode} 296 % 297 % Next, we typeset the |block body|. This the code is similar to, but sim- pler 298 % than, the |block title| code since we don’t need to adjust for any struts. 299 % 300 % \begin{macrocode} 26 301 \nointerlineskip% 302 \ifbeamercolorempty[bg]{block body#1}{% \begin{beamercolorbox}[vmode]{block body#1}}{ 303 \ifbeamercolorempty[bg]{block body}{% 304 \begin{beamercolorbox}[vmode]{block body#1}% 305 }{% 306 307 \begin{beamercolorbox}[sep=\metropolis@blocksep, vmode]{block body#1}% 308 \vspace{-\metropolis@parskip} }}% 309 310 \usebeamerfont{block body#1}% 311 \setlength{\parskip}{\metropolis@parskip}% 312 } This concludes the auxiliary macro \metropolis@block. Finally, we define the block beamer templates using this macro. 313 \setbeamertemplate{block begin}{\metropolis@block{}} 314 \setbeamertemplate{block alerted begin}{\metropolis@block{ alerted}} 315 \setbeamertemplate{block example begin}{\metropolis@block{ exam- ple}} 316 \setbeamertemplate{block end}{\end{beamercolorbox}\vspace*{0.2ex}} 317 \setbeamertemplate{block alerted end}{\end{beamercolorbox}\vspace*{0.2ex}} 318 \setbeamertemplate{block example end}{\end{beamercolorbox}\vspace*{0.2ex}} 8.2.6 Lists and floats 319 \setbeamertemplate{itemize items}{\textbullet} 320 \setbeamertemplate{caption label separator}{: } 321 \setbeamertemplate{caption}[numbered] 8.2.7 Footnotes 322 \setbeamertemplate{footnote}{% 323 \parindent 0em\noindent% 324 \raggedright 325 \usebeamercolor{footnote}\hbox to 0.8em{\hfil\insertfootnotemark}\insertfootnotete 326 } 8.2.8 Text and spacing settings 327 \newlength{\metropolis@parskip} 27 328 \setlength{\metropolis@parskip}{0.5em} 329 \setlength{\parskip}{\metropolis@parskip} 330 \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. 331 \define@key{beamerframe}{c}[true]{% centered 332 \beamer@frametopskip=0pt plus 1fill\relax% 333 \beamer@framebottomskip=0pt plus 1fill\relax% 334 \beamer@frametopskipautobreak=0pt plus .4\paperheight\relax% 335 \beamer@framebottomskipautobreak=0pt plus .6\paperheight\relax% 336 \def\beamer@initfirstlineunskip{}% 337 } 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] ... \ 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. 338 \providebool{metropolis@standout} 339 \define@key{beamerframe}{standout}[true]{% 340 \booltrue{metropolis@standout} 341 \begingroup 342 \setkeys{beamerframe}{c} 343 \setkeys{beamerframe}{noframenumbering} 344 \ifbeamercolorempty[bg]{palette primary}{ \setbeamercolor{background canvas}{ 345 346 use=palette primary, 347 bg=-palette primary.fg } 348 349 350 }{ \setbeamercolor{background canvas}{ 28 use=palette primary, 351 bg=palette primary.bg 352 } 353 } 354 355 \centering 356 \usebeamercolor[fg]{palette primary} 357 \usebeamerfont{standout} 358 } 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. 359 \apptocmd{\beamer@reseteecodes}{% 360 \ifbool{metropolis@standout}{ 361 362 \endgroup \boolfalse{metropolis@standout} 363 }{} 364 }{}{} 8.2.10 Process package options 365 \metropolis@inner@setdefaults 366 \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 367 \RequirePackage{etoolbox} 368 \RequirePackage{calc} 369 \RequirePackage{pgfopts} 29 8.3.2 numbering Options Adds slide numbers to the bottom right of each slide. 370 \pgfkeys{ 371 /metropolis/outer/numbering/.cd, 372 .is choice, 373 none/.code=\setbeamertemplate{frame numbering}[none], 374 counter/.code=\setbeamertemplate{frame numbering}[counter], 375 fraction/.code=\setbeamertemplate{frame numbering}[fraction], 376 } progressbar etropolis@outer@setdefaults Adds a progress bar to the top, bottom, or frametitle of each slide. 377 \pgfkeys{ 378 /metropolis/outer/progressbar/.cd, 379 .is choice, 380 none/.code={% 381 \setbeamertemplate{headline}[plain] 382 \setbeamertemplate{frametitle}[plain] 383 \setbeamertemplate{footline}[plain] 384 }, 385 head/.code={\pgfkeys{/metropolis/outer/progressbar=none} \addtobeamertemplate{headline}{}{% 386 \usebeamertemplate*{progress bar in head/foot} 387 } 388 389 }, 390 frametitle/.code={\pgfkeys{/metropolis/outer/progressbar=none} \addtobeamertemplate{frametitle}{}{% 391 \usebeamertemplate*{progress bar in head/foot} 392 } 393 394 }, 395 foot/.code={\pgfkeys{/metropolis/outer/progressbar=none} \addtobeamertemplate{footline}{}{% 396 \usebeamertemplate*{progress bar in head/foot}% 397 } 398 399 }, 400 } Sets default values for outer theme options. 30 401 \newcommand{\metropolis@outer@setdefaults}{ 402 \pgfkeys{/metropolis/outer/.cd, 403 numbering=counter, 404 progressbar=none, 405 } 406 } 8.3.3 Head and footline All good beamer presentations should already remove the navigation symbols, but metropolis removes them automatically (just in case). 407 \setbeamertemplate{navigation frame numbering symbols}{} Templates for the frame number. Can be omitted, shown or displayed as a fraction of the total frames. 408 \defbeamertemplate{frame footer}{none}{} 409 \defbeamertemplate{frame footer}{custom}[1]{ #1 } 410 \defbeamertemplate{frame numbering}{none}{} 411 \defbeamertemplate{frame numbering}{counter}{\insertframenumber} 412 \defbeamertemplate{frame numbering}{fraction}{ 413 \insertframenumber/\inserttotalframenumber 414 } headline footline Templates for the head- and footline at the top and bottom of each frame. 415 \defbeamertemplate{headline}{plain}{} 416 \defbeamertemplate{footline}{plain}{% 417 \begin{beamercolorbox}[wd=\textwidth, sep=3ex]{footline}% 418 \usebeamerfont{page number in head/foot}% 419 \usebeamertemplate*{frame footer} 420 \hfill% 421 422 \usebeamertemplate*{frame numbering} \end{beamercolorbox}% 423 } 31 8.3.4 frametitle Frametitle Templates for the frame title, which is optionally underlined with a progress bar. 424 \newlength{\metropolis@frametitle@padding} 425 \setlength{\metropolis@frametitle@padding}{2.2ex} 426 \newcommand{\metropolis@frametitlestrut@start}{ 427 \rule{0pt}{\metropolis@frametitle@padding +% \totalheightof{% 428 \ifcsdef{metropolis@frametitleformat}{\metropolis@frametitleformat X}{X}% 429 }% 430 431 }% 432 } 433 \newcommand{\metropolis@frametitlestrut@end}{ 434 \rule[-\metropolis@frametitle@padding]{0pt}{\metropolis@frametitle@padding} 435 } 436 \defbeamertemplate{frametitle}{plain}{% 437 \nointerlineskip% 438 \begin{beamercolorbox}[% 439 wd=\paperwidth,% 440 sep=0pt,% 441 leftskip=\metropolis@frametitle@padding,% 442 443 rightskip=\metropolis@frametitle@padding,% ]{frametitle}% 444 \metropolis@frametitlestrut@start% 445 \insertframetitle% 446 \nolinebreak% 447 \metropolis@frametitlestrut@end% 448 \end{beamercolorbox}% 449 } 450 \setbeamertemplate{frametitle continuation}{% 451 \usebeamerfont{frametitle} 452 \romannumeral \insertcontinuationcount 453 } 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. 454 \newlength{\metropolis@progressinheadfoot} 32 455 \newlength{\metropolis@progressinheadfoot@linewidth} 456 \setlength{\metropolis@progressinheadfoot@linewidth}{0.4pt} 457 \setbeamertemplate{progress bar in head/foot}{ 458 \nointerlineskip 459 \setlength{\metropolis@progressinheadfoot}{% \paperwidth * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}% 460 461 }% 462 \begin{beamercolorbox}[wd=\paperwidth]{progress bar in head/foot} \begin{tikzpicture} 463 464 \fill[bg] (0,0) rectangle (\paperwidth, \metropolis@progressinheadfoot@linewid 465 \fill[fg] (0,0) rectangle (\metropolis@progressinheadfoot, \metropolis@progressinheadfoot@linewidth); 466 \end{tikzpicture}% 467 \end{beamercolorbox} 468 } 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. 469 \AtBeginDocument{% 470 471 \apptocmd{\appendix}{% \pgfkeys{% 472 /metropolis/outer/.cd, 473 numbering=none, 474 progressbar=none} 475 }{}{} 476 } 8.3.5 Process package options 477 \metropolis@outer@setdefaults 478 \ProcessPgfPackageOptions{/metropolis/outer} 8.4 metropolis font theme A beamer font theme sets the style of the font used in the document. 33 8.4.1 Package dependencies 479 \RequirePackage{etoolbox} 480 \RequirePackage{ifxetex} 481 \RequirePackage{ifluatex} 482 \RequirePackage{pgfopts} 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. 483 \ifboolexpr{bool 484 \@ifpackageloaded{fontspec}{ \PassOptionsToPackage{no-math}{fontspec} 485 486 }{ \RequirePackage[no-math]{fontspec} 487 488 \checkfont {xetex} or bool {luatex}}{ } Checks if a font is installed; if not, fontsnotfound is increased. 489 \newcounter{fontsnotfound} 490 \newcommand{\checkfont}[1]{% 491 \suppressfontnotfounderror=1% 492 \font\x = ”#1” at 10pt 493 \selectfont 494 \ifx\x\nullfont% \stepcounter{fontsnotfound}% 495 \fi% 496 \suppressfontnotfounderror=0% 497 498 } 499 \iffontsavailable Resets the fontsnotfound counter and calls \checkfont for each font in the comma separated list in the first argument. 500 \newcommand{\iffontsavailable}[3]{% 501 \setcounter{fontsnotfound}{0}% 502 \expandafter\forcsvlist\expandafter% 503 \checkfont\expandafter{#1}% 504 \ifnum\value{fontsnotfound}=0% 34 #2% 505 \else% 506 #3% 507 \fi% 508 509 } 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. 510 \iffontsavailable{Fira Sans Light,% 511 Fira Sans Light Italic,% 512 Fira Sans,% Fira Sans Italic}% 513 514 {% \setsansfont[ItalicFont={Fira Sans Light Italic},% 515 BoldFont={Fira Sans},% 516 BoldItalicFont={Fira Sans Italic}]% 517 {Fira Sans Light}% 518 519 }{% \iffontsavailable{Fira Sans Light OT,% 520 521 Fira Sans Light Italic OT,% 522 Fira Sans OT,% 523 Fira Sans Italic OT}% {% 524 \setsansfont[ItalicFont={Fira Sans Light Italic OT},% 525 BoldFont={Fira Sans OT},% 526 BoldItalicFont={Fira Sans Italic OT}]% 527 {Fira Sans Light OT}% 528 }{% 529 \PackageWarning{beamerthememetropolis}{% 530 Could not find Fira Sans fonts% 531 } 532 } 533 534 } 535 \iffontsavailable{Fira Mono, Fira Mono Bold}{% 536 537 538 \setmonofont[BoldFont={Fira Mono Medium}]{Fira Mono}% }{% \iffontsavailable{Fira Mono OT, Fira Mono Bold OT}{% 35 \setmonofont[BoldFont={Fira Mono Medium OT}]{Fira Mono OT}% 539 }{% 540 \PackageWarning{beamerthememetropolis}{% 541 Could not find Fira Mono fonts% 542 } 543 } 544 545 } 546 \AtBeginEnvironment{tabular}{% \addfontfeature{Numbers={Monospaced}}% 547 548 } 549 }{% 550 \PackageWarning{beamerthememetropolis}{% You need to compile with XeLaTeX or LuaLaTeX to use the Fira fonts% 551 552 } 553 } 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 554 \setbeamerfont{title}{size=\Large,% series=\bfseries} 555 556 \setbeamerfont{author}{size=\small} 557 \setbeamerfont{date}{size=\small} 558 \setbeamerfont{section title}{size=\Large,% series=\bfseries} 559 560 \setbeamerfont{block title}{size=\normalsize,% series=\bfseries} 561 562 \setbeamerfont{block title alerted}{size=\normalsize,% series=\bfseries} 563 564 \setbeamerfont*{subtitle}{size=\large} 565 \setbeamerfont{frametitle}{size=\large,% series=\bfseries} 566 567 \setbeamerfont{caption}{size=\small} 568 \setbeamerfont{caption name}{series=\bfseries} 569 \setbeamerfont{description 570 \setbeamerfont{page item}{series=\bfseries} number in head/foot}{size=\scriptsize} 571 \setbeamerfont{bibliography entry author}{size=\normalsize,% 36 series=\normalfont} 572 573 \setbeamerfont{bibliography entry title}{size=\normalsize,% series=\bfseries} 574 575 \setbeamerfont{bibliography entry location}{size=\normalsize,% series=\normalfont} 576 577 \setbeamerfont{bibliography entry note}{size=\small,% series=\normalfont} 578 579 \setbeamerfont{standout}{size=\Large,% series=\bfseries} 580 8.4.4 titleformat title Title format options Controls the format of the title. 581 \pgfkeys{ 582 /metropolis/font/titleformat title/.cd, 583 .is choice, 584 regular/.code={% \let\metropolis@titleformat\@empty% 585 \setbeamerfont{title}{shape=\normalfont}% 586 587 }, 588 smallcaps/.code={% 589 \let\metropolis@titleformat\@empty% 590 \setbeamerfont{title}{shape=\scshape}% 591 }, 592 allsmallcaps/.code={% 593 \let\metropolis@titleformat\lowercase% 594 \setbeamerfont{title}{shape=\scshape}% 595 \PackageWarning{beamerthememetropolis}{% Be aware that titleformat title=allsmallcaps can lead to prob- 596 lems% } 597 598 }, 599 allcaps/.code={% 600 \let\metropolis@titleformat\uppercase% 601 \setbeamerfont{title}{shape=\normalfont} 602 \PackageWarning{beamerthememetropolis}{% Be aware that titleformat title=allcaps can lead to prob- 603 lems% 604 } 37 }, 605 606 } titleformat subtitle Control the format of the subtitle. 607 \pgfkeys{ /metropolis/font/titleformat subtitle/.cd, 608 609 .is choice, 610 regular/.code={% 611 \let\metropolis@subtitleformat\@empty% 612 \setbeamerfont{subtitle}{shape=\normalfont}% 613 }, 614 smallcaps/.code={% \let\metropolis@subtitleformat\@empty% 615 \setbeamerfont{subtitle}{shape=\scshape}% 616 617 }, 618 allsmallcaps/.code={% 619 \let\metropolis@subtitleformat\lowercase% 620 \setbeamerfont{subtitle}{shape=\scshape}% 621 \PackageWarning{beamerthememetropolis}{% Be aware that titleformat subtitle=allsmallcaps can lead to prob- 622 lems% } 623 624 }, 625 allcaps/.code={% 626 \let\metropolis@subtitleformat\uppercase% 627 \setbeamerfont{subtitle}{shape=\normalfont}% 628 \PackageWarning{beamerthememetropolis}{% Be aware that titleformat subtitle=allcaps can lead to prob- 629 lems% } 630 631 }, 632 } titleformat section Controls the format of the section title. 633 \pgfkeys{ 634 /metropolis/font/titleformat section/.cd, 635 .is choice, 636 regular/.code={% 637 \let\metropolis@sectiontitleformat\@empty% 38 \setbeamerfont{section title}{shape=\normalfont}% 638 639 }, 640 smallcaps/.code={% \let\metropolis@sectiontitleformat\@empty% 641 \setbeamerfont{section title}{shape=\scshape}% 642 643 }, 644 allsmallcaps/.code={% 645 \let\metropolis@sectiontitleformat\MakeLowercase% 646 \setbeamerfont{section title}{shape=\scshape}% 647 \PackageWarning{beamerthememetropolis}{% Be aware that titleformat section=allsmallcaps can lead to prob- 648 lems% } 649 650 }, 651 allcaps/.code={% 652 \let\metropolis@sectiontitleformat\MakeUppercase% 653 \setbeamerfont{section title}{shape=\normalfont}% 654 \PackageWarning{beamerthememetropolis}{% Be aware that titleformat section=allcaps can lead to prob- 655 lems% } 656 657 }, 658 } frametitleformat Control the format of the frame title. 659 \pgfkeys{ 660 /metropolis/font/titleformat frame/.cd, 661 .is choice, 662 regular/.code={% 663 \let\metropolis@frametitleformat\@empty% 664 \setbeamerfont{frametitle}{shape=\normalfont}% 665 }, 666 smallcaps/.code={% \let\metropolis@frametitleformat\@empty% 667 \setbeamerfont{frametitle}{shape=\scshape}% 668 669 }, 670 allsmallcaps/.code={% 671 \let\metropolis@frametitleformat\MakeLowercase% 672 \setbeamerfont{frametitle}{shape=\scshape}% 39 \PackageWarning{beamerthememetropolis}{% 673 Be aware that titleformat frame=allsmallcaps can lead to prob- 674 lems% } 675 676 }, 677 allcaps/.code={% 678 \let\metropolis@frametitleformat\MakeUppercase% 679 \setbeamerfont{frametitle}{shape=\normalfont} 680 \PackageWarning{beamerthememetropolis}{% Be aware that titleformat frame=allcaps can lead to prob- 681 lems% } 682 }, 683 684 } titleformat aliases metropolis@font@setdefaults Allows titleformat title et al. to be used in the \usetheme declaration, where LATEX automatically removes all spaces. 685 \pgfkeys{ 686 /metropolis/font/.cd, 687 titleformattitle/.code=\pgfkeysalso{titleformat title=#1}, 688 titleformatsubtitle/.code=\pgfkeysalso{titleformat subtitle=#1}, 689 titleformatsection/.code=\pgfkeysalso{titleformat section=#1}, 690 titleformatframe/.code=\pgfkeysalso{titleformat frame=#1}, 691 } Sets default values for font theme options. 692 \newcommand{\metropolis@font@setdefaults}{ 693 \pgfkeys{/metropolis/font/.cd, 694 titleformat title=regular, 695 titleformat subtitle=regular, 696 titleformat section=regular, 697 titleformat frame=regular, 698 } 699 } We first define hooks to change the case format of the titles. 700 \def\metropolis@titleformat#1{#1} 701 \def\metropolis@subtitleformat#1{#1} 40 702 \def\metropolis@sectiontitleformat#1{#1} 703 \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. 704 \patchcmd{\beamer@title}% 705 {\def\inserttitle{#2}}% 706 {\def\inserttitle{\metropolis@titleformat{#2}}}% 707 {}% 708 {\PackageError{beamerfontthememetropolis}{Patching title failed}\@ehc} 709 \patchcmd{\beamer@subtitle}% 710 {\def\insertsubtitle{#2}}% 711 {\def\insertsubtitle{\metropolis@subtitleformat{#2}}}% 712 {}% 713 {\PackageError{beamerfontthememetropolis}{Patching subtitle failed}\@ehc} 714 \patchcmd{\sectionentry} 715 {\def\insertsectionhead{#2}} 716 {\def\insertsectionhead{\metropolis@sectiontitleformat{#2}}} 717 {} 718 {\PackageError{beamerfontthememetropolis}{Patching section title failed}\@ehc} 719 \@tempswafalse 720 \patchcmd{\beamer@section} 721 {\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{#1}}} 722 {\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{% \metropolis@sectiontitleformat{#1}}}} 723 724 {\@tempswatrue} 725 {} 726 \patchcmd{\beamer@section} 727 {\protected@edef\insertsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{#1}} 728 {\protected@edef\insertsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{% \noexpand\metropolis@sectiontitleformat{#1}}}} 729 730 {\@tempswatrue} 731 {} 732 \if@tempswa\else 733 \PackageError{beamerfontthememetropolis}{Patching section title failed}\@ehc 734 \fi 41 735 \@tempswafalse 736 \patchcmd{\beamer@subsection} 737 {\def\insertsubsectionhead{\hyperlink{Navigation\the\c@page}{#1}}} 738 {\def\insertsubsectionhead{\hyperlink{Navigation\the\c@page}{% \metropolis@sectiontitleformat{#1}}}} 739 740 {\@tempswatrue} 741 {} 742 \patchcmd{\beamer@subsection} 743 {\protected@edef\insertsubsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{# 744 {\protected@edef\insertsubsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{% \noexpand\metropolis@sectiontitleformat{#1}}}} 745 746 {\@tempswatrue} 747 {} 748 \if@tempswa\else 749 \PackageError{beamerfontthememetropolis}{Patching section title failed}\@ehc 750 \fi Similarly, to make the \MakeLowercase and \MakeUppercase macros work in the frame title we have to patch \beamer@@frametitle. 751 \patchcmd{\beamer@@frametitle} 752 {{% 753 \gdef\insertframetitle{{#2\ifnum\beamer@autobreakcount>0\relax{}\space% 754 \usebeamertemplate*{frametitle continuation}\fi}}% 755 \gdef\beamer@frametitle{#2}% 756 \gdef\beamer@shortframetitle{#1}% 757 }} 758 {{% 759 \gdef\insertframetitle{{\metropolis@frametitleformat{#2}\ifnum% 760 \beamer@autobreakcount>0\relax{}\space% 761 \usebeamertemplate*{frametitle continuation}\fi}}% 762 \gdef\beamer@frametitle{#2}% 763 \gdef\beamer@shortframetitle{#1}% 764 }} 765 {} 766 {\PackageError{beamerfontthememetropolis}{Patching frame title failed}\@ehc} 8.4.5 Process package options 767 \metropolis@font@setdefaults 42 768 \ProcessPgfPackageOptions{/metropolis/font} 8.5 metropolis color theme 8.5.1 Package dependencies 769 \RequirePackage{pgfopts} 8.5.2 block Options Optionally adds a light grey background to block environments like theorem and example. 770 \pgfkeys{ 771 /metropolis/color/block/.cd, 772 .is choice, 773 transparent/.code=\metropolis@block@transparent, 774 fill/.code=\metropolis@block@fill, 775 } colors etropolis@color@setdefaults Provides the option to have a dark background and light foreground instead of the reverse. 776 \pgfkeys{ 777 /metropolis/color/background/.cd, 778 .is choice, 779 dark/.code=\metropolis@colors@dark, 780 light/.code=\metropolis@colors@light, 781 } Sets default values for color theme options. 782 \newcommand{\metropolis@color@setdefaults}{ 783 \pgfkeys{/metropolis/color/.cd, 784 background=light, 785 block=transparent, 786 } 787 } 8.5.3 Base colors 43 788 \definecolor{mDarkBrown}{HTML}{604c38} 789 \definecolor{mDarkTeal}{HTML}{23373b} 790 \definecolor{mLightBrown}{HTML}{EB811B} 791 \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. 792 \newcommand{\metropolis@colors@dark}{ 793 \setbeamercolor{normal text}{% 794 fg=black!2, 795 bg=mDarkTeal 796 } 797 \usebeamercolor[fg]{normal text} 798 } 799 \newcommand{\metropolis@colors@light}{ 800 \setbeamercolor{normal text}{% 801 fg=mDarkTeal, 802 bg=black!2 803 } 804 } 805 \setbeamercolor{alerted 806 text}{% fg=mLightBrown 807 } 808 \setbeamercolor{example 809 text}{% fg=mLightGreen 810 } 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. 811 \setbeamercolor{titlelike}{use=normal 812 \setbeamercolor{author}{use=normal 813 \setbeamercolor{date}{use=normal 44 text, parent=normal text} text, parent=normal text} text, parent=normal text} 814 \setbeamercolor{institute}{use=normal text, parent=normal text} 815 \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. 816 \setbeamercolor{palette 817 use=normal text, 818 fg=normal text.bg, 819 bg=normal text.fg primary}{% 820 } 821 \setbeamercolor{frametitle}{% 822 use=palette primary, 823 parent=palette primary 824 } 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. 825 \setbeamercolor{progress bar}{% 826 use=alerted text, 827 fg=alerted text.fg, 828 bg=alerted text.fg!50!black!30 829 } 830 \setbeamercolor{title 831 use=progress bar, 832 parent=progress bar separator}{ 833 } 834 \setbeamercolor{progress 835 use=progress bar, 836 parent=progress bar bar in head/foot}{% 837 } 838 \setbeamercolor{progress 839 use=progress bar, 840 parent=progress bar bar in section page}{ 841 } Block environments such as theorem and example have no background color 45 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. 842 \newcommand{\metropolis@block@transparent}{ 843 \setbeamercolor{block title}{% 844 use=normal text, 845 fg=normal text.fg, bg= 846 847 } 848 \setbeamercolor{block body}{ bg= 849 850 } 851 } 852 \newcommand{\metropolis@block@fill}{ 853 \setbeamercolor{block title}{% 854 use=normal text, 855 fg=normal text.fg, bg=normal text.bg!80!fg 856 857 } 858 \setbeamercolor{block body}{ use={block title, normal text}, 859 bg=block title.bg!50!normal text.bg 860 861 } 862 } 863 \setbeamercolor{block title alerted}{% 864 use={block title, alerted text}, 865 bg=block title.bg, 866 fg=alerted text.fg 867 } 868 \setbeamercolor{block title example}{% 869 use={block title, example text}, 870 bg=block title.bg, 871 fg=example text.fg 872 } 873 \setbeamercolor{block body alerted}{use=block body, parent=block body} 874 \setbeamercolor{block body example}{use=block body, parent=block body} Footnotes 46 875 \setbeamercolor{footnote}{fg=normal 876 \setbeamercolor{footnote 8.5.6 text.fg!90} mark}{fg=.} Process package options 877 \metropolis@color@setdefaults 878 \ProcessPgfPackageOptions{/metropolis/color} 879 \mode8.6 Tol pgfplots theme Paul Tol’s 12-color palette1 is as follows: 880 \definecolor{TolDarkPurple}{HTML}{332288} 881 \definecolor{TolDarkBlue}{HTML}{6699CC} 882 \definecolor{TolLightBlue}{HTML}{88CCEE} 883 \definecolor{TolLightGreen}{HTML}{44AA99} 884 \definecolor{TolDarkGreen}{HTML}{117733} 885 \definecolor{TolDarkBrown}{HTML}{999933} 886 \definecolor{TolLightBrown}{HTML}{DDCC77} 887 \definecolor{TolDarkRed}{HTML}{661100} 888 \definecolor{TolLightRed}{HTML}{CC6677} 889 \definecolor{TolLightPink}{HTML}{AA4466} 890 \definecolor{TolDarkPink}{HTML}{882255} 891 \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. 892 \pgfplotscreateplotcyclelist{mbarplot cycle}{% 893 {draw=TolDarkBlue, fill=TolDarkBlue!70}, 894 {draw=TolLightBrown, fill=TolLightBrown!70}, 895 {draw=TolLightGreen, fill=TolLightGreen!70}, 896 {draw=TolDarkPink, fill=TolDarkPink!70}, 897 {draw=TolDarkPurple, fill=TolDarkPurple!70}, {draw=TolDarkRed, fill=TolDarkRed!70}, 898 1 Tol actually describes several palettes; these colours are taken from the bottom row of Figure 3 in his technical note. 47 899 {draw=TolDarkBrown, fill=TolDarkBrown!70}, 900 {draw=TolLightRed, fill=TolLightRed!70}, 901 {draw=TolLightPink, fill=TolLightPink!70}, 902 {draw=TolLightPurple, fill=TolLightPurple!70}, 903 {draw=TolLightBlue, fill=TolLightBlue!70}, 904 {draw=TolDarkGreen, fill=TolDarkGreen!70}, 905 } mlineplot cycle Colors and styles intended for line charts with up to 4 series. 906 \pgfplotscreateplotcyclelist{mlineplot cycle}{% 907 {TolDarkBlue, mark=*, mark size=1.5pt}, 908 {TolLightBrown, mark=square*, mark size=1.3pt}, 909 {TolLightGreen, mark=triangle*, mark size=1.5pt}, 910 {TolDarkBrown, mark=diamond*, mark size=1.5pt}, 911 } 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. 912 \pgfplotsset{ 913 mlineplot compat=1.9, A style to apply to the axis of a PGF line plot. 914 mlineplot/.style={ 915 mbaseplot, 916 xmajorgrids=true, 917 ymajorgrids=true, 918 major grid style={dotted}, 919 axis x line=bottom, 920 axis y line=left, 921 legend style={ 922 cells={anchor=west}, 923 draw=none 924 }, 925 cycle list name=mlineplot cycle, 926 }, 48 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. 927 mbarplot base/.style={ 928 mbaseplot, 929 bar width=6pt, axis y line*=none, 930 931 }, 932 mbarplot/.style={ 933 mbarplot base, 934 ybar, 935 xmajorgrids=false, 936 ymajorgrids=true, 937 area legend, 938 legend image code/.code={% \draw[#1] (0cm,-0.1cm) rectangle (0.15cm,0.1cm); 939 940 }, 941 cycle list name=mbarplot cycle, 942 }, 943 horizontal mbarplot/.style={ 944 mbarplot base, 945 xmajorgrids=true, 946 ymajorgrids=false, 947 xbar stacked, 948 area legend, 949 legend image code/.code={% \draw[#1] (0cm,-0.1cm) rectangle (0.15cm,0.1cm); 950 }, 951 cycle list name=mbarplot cycle, 952 953 mbaseplot }, Adjusts the appearance of the axes in a PGF chart. 954 mbaseplot/.style={ 955 legend style={ 956 draw=none, 957 fill=none, cells={anchor=west}, 958 959 }, 49 x tick label style={ 960 font=\footnotesize 961 962 }, 963 y tick label style={ font=\footnotesize 964 965 }, 966 legend style={ font=\footnotesize 967 968 }, 969 major grid style={ dotted, 970 971 }, 972 axis x line*=bottom, 973 }, 974 disable thousands separator/.style={ /pgf/number format/.cd, 975 1000 sep={} 976 977 }, 978 } 50
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 : 50 Creator : LaTeX with hyperref package Producer : XeTeX 0.99992 Create Date : 2017:01:23 13:47:04+01:00EXIF Metadata provided by EXIF.tools