├── Makefile ├── README.md ├── beamerPresentation.Rmd ├── beamerPresentation.gif └── beamerPresentation.pdf /Makefile: -------------------------------------------------------------------------------- 1 | 2 | sources := $(wildcard *.Rmd) 3 | slides := $(sources:.Rmd=.pdf) 4 | 5 | all: ${slides} 6 | 7 | %.pdf: %.Rmd 8 | Rscript -e "rmarkdown::render(\"$<\", clean=TRUE)" 9 | 10 | 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | ## samples-rmarkdown-metropolis 3 | 4 | Example for a [Metropolis](https://github.com/matze/mtheme)-themed 5 | [RMarkdown](http://rmarkdown.rstudio.com/)-driven LaTeX 6 | [Beamer](https://en.wikipedia.org/wiki/Beamer_(LaTeX)) presentation. 7 | 8 | ### Note 9 | 10 | If you are interested in this, you probably want to look at the [binb](https://github.com/eddelbuettel/binb) package which 11 | implements Metropolis (and more) directly from RMarkdown. 12 | 13 | ### About 14 | 15 | _NB: This dates mostly from 2016. For a more recent and more complete alternative, see [binb](https://github.com/eddelbuettel/binb)._ 16 | 17 | For the last two or so years, I have been using 18 | [mtheme](https://github.com/matze/mtheme) (and/or a local variant I called 19 | 'm2') as well as the newer (renamed to metropolis) release 20 | [metropolis](https://github.com/matze/mtheme) for all my 21 | [RMarkdown](http://rmarkdown.rstudio.com/)-based presentations as you can see 22 | [from my presentations page](http://dirk.eddelbuettel.com/presentations.html). 23 | 24 | And earlier last year I cleaned this up and wrote myself _local_ Ubuntu packages 25 | which are [here on Launchpad](https://launchpad.net/~edd/+archive/ubuntu/misc/+packages). 26 | I also have two [GitHub](https://www.github.com) repos for the underlying .deb package code: 27 | - the [pkg-latex-metropolis](https://github.com/eddelbuettel/pkg-latex-metropolis) package for the LaTeX part 28 | (which is also in TeXlive in an older version) 29 | - the [pkg-fonts-fira](https://github.com/eddelbuettel/pkg-fonts-fira) for 30 | the underlying (free) font (and this sadly cannot build on launchpad as it 31 | needs a download step). 32 | 33 | ### Example 34 | 35 | An animated gif containing all pages of the very simple example included here follows: 36 | 37 | ![](beamerPresentation.gif) 38 | 39 | As an aside, creating the gif is trivial, I used 40 | 41 | ```bash 42 | convert -delay 250 -geometry 480x360 beamerPresentation.pdf beamerPresentation.gif 43 | ``` 44 | 45 | where `convert` is a component of [imagemagick](http://www.imagemagick.org/); you can probably rely on 46 | [graphicsmagick](http://www.graphicsmagick.org/) too. 47 | 48 | ### Status 49 | 50 | This is a somewhat static example which may not get updated over time. 51 | 52 | ### Note 53 | 54 | If you are interested in this, you probably want to look at the [binb](https://github.com/eddelbuettel/binb) package which 55 | implements Metropolis (and more) directly from RMarkdown. 56 | 57 | ### Author 58 | 59 | Dirk Eddelbuettel 60 | 61 | ### License 62 | 63 | The aggregation is provided under the GPL (version 2 or later). 64 | -------------------------------------------------------------------------------- /beamerPresentation.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | author: Your Name Here and Some Other Person 3 | title: "Something really clever here: \\newline And maybe a second line" 4 | subtitle: You can also have a subtitle 5 | date: "2016-07-01" 6 | output: 7 | beamer_presentation: 8 | keep_tex: no 9 | theme: metropolis 10 | latex_engine: xelatex 11 | slide_level: 2 12 | incremental: no 13 | fontsize: 12pt 14 | classoption: compress 15 | header-includes: 16 | \setbeamercolor{frametitle}{bg=gray} 17 | \hypersetup{colorlinks,citecolor=orange,filecolor=red,linkcolor=brown,urlcolor=blue} 18 | --- 19 | 20 | ```{r,setup, include=FALSE} 21 | knitr::opts_chunk$set(cache=TRUE) 22 | ``` 23 | 24 | # A Section Header 25 | 26 | ## A Slide Header 27 | 28 | ### A Subtitle 29 | 30 | - Point A 31 | - Point B 32 | - Point C 33 | 34 | # Principal Resources 35 | 36 | ## Metropolis 37 | 38 | ### Main Repos 39 | 40 | - [Official GitHub Repo of Metropolis](https://github.com/matze/mtheme) 41 | (formerly mtheme); older version in TeXLive 42 | - [My GitHub Repo for a local Ubuntu package of Metropolis](https://github.com/eddelbuettel/pkg-latex-metropolis) -- formerly mtheme 43 | - [My GitHub Repo for a local Ubuntu package for the Fira font](https://github.com/eddelbuettel/pkg-fonts-fira) 44 | 45 | ## Ubuntu and Launchpad 46 | 47 | ### Briefly 48 | 49 | - The packages which can be built (ie not Fira as it needs external fonts 50 | which we cannot download during build) are 51 | [in this repo](https://launchpad.net/~edd/+archive/ubuntu/misc/+packages) 52 | - If you're not on Ubuntu, it is probably more work to get 53 | - Metropolis into your \LaTeX environment 54 | - the Fira font into your \LaTeX environment 55 | - I *did* try without (on plain Ubuntu 16.04) and it _builds_ but looks less 56 | crisp 57 | - So for the time being you probably want these fresh from source, or via my 58 | helpers. YMMV. 59 | 60 | ## Local Adaption 61 | 62 | - mtheme and metropolis changed a bit since I first used them 63 | - I started with a local modification I called m2; the package is still in 64 | the launchpad repo 65 | - I generally include a file `header.tex` from the YAML for color, font, 66 | ... tweaking at the \LaTeX level, but as these are presentation-specific I 67 | didn't include any changes here. 68 | 69 | _ _ _ 70 | 71 | \LARGE Breakout page 72 | 73 | ## Using LaTeX Parts: Equations 74 | 75 | ### Linear Model 76 | 77 | $$ \hat{\beta} = \text{argmin}_{b \in \mathbb{R}} S(b) = \left( \frac{1}{n} \sum_{i=1}^n x_i x_i^T \right)^{-1} \cdot \frac{1}{n} \sum_{i=1}^n x_i y_i $$ 78 | or in matrix form 79 | 80 | $$ \hat{\beta} = (X^TX)^{-1} X^T y $$ 81 | 82 | 83 | ## Using LaTeX Parts: Blocks 84 | 85 | As one example of falling back into \LaTeX, consider the example of 86 | three different block environments are pre-defined and may be styled 87 | with an optional background color. 88 | 89 | 90 | \metroset{block=fill} 91 | 92 | \begin{block}{Default} 93 | Block content. 94 | \end{block} 95 | 96 | \begin{alertblock}{Alert} 97 | Block content. 98 | \end{alertblock} 99 | 100 | \begin{exampleblock}{Example} 101 | Block content. 102 | \end{exampleblock} 103 | 104 | ## Finally 105 | 106 | ### Going Forward 107 | 108 | - Questions etc: Open issue tickets [at the GitHub repo](https://github.com/eddelbuettel/samples-rmarkdown-metropolis/issues) 109 | - Pull requests welcome for bug fixes, extensions, examples, ... 110 | 111 | -------------------------------------------------------------------------------- /beamerPresentation.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eddelbuettel/samples-rmarkdown-metropolis/c419e507342853fd008eccd8300fae4dd05d873d/beamerPresentation.gif -------------------------------------------------------------------------------- /beamerPresentation.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eddelbuettel/samples-rmarkdown-metropolis/c419e507342853fd008eccd8300fae4dd05d873d/beamerPresentation.pdf --------------------------------------------------------------------------------