Xaringan mediocre
xaringan.RmdThis vignette illustrates how to build xaringan
slides in a style consistent with mediocrethemes. This is
simply an application of the xaringanthemer
package.
This vignette assumes that you are familiar with
xaringan slides. If not, please refer to this presentation by
Yihui Xie, the creator of the xaringan package.
Preview of the styles
Before anything, here are examples of the type of slides this theme can produce:

Simple use
To build similar a mediocre/xaringan template, you simply need to add this to the YAML header of your slides:
output:
xaringan::moon_reader:
# self_contained: true
css: mediocre-themer.css
nature:
countIncrementalSlides: no
highlightLines: yes
highlightStyle: github
ratio: '16:9'
titleSlideClass: [right, middle, inverse]And this to your set up chunk:
library(mediocrethemes)
xaringan_mediocre(pal = "coty")You are all set!
Note that countIncrementalSlides,
highlightLines and highlightStyle are not
necessary. However, ratio is necessary as font sizes are
defined for 16:9 slides. Also note, to be able to use this xaringan
theme without internet connection, you may want to locally install the
Google Fonts Lato, Josefin
Sans and Source
Code Pro. This is however not required.
You can use the palette of your choice. Also note that you may also
need to add knitr::opts_chunk$set(fig.showtext = TRUE) to
your set up chunk for the fonts to work properly.
Xaringan html slides are not self-contained. Setting
self_contained: true enables to make them so.
Example .Rmd file
Here is an example of a minimal .Rmd slide file:
---
title: "A very nice title"
subtitle: "<br />"
author: "Jeffrey Lebowski"
date: "April 34, 2103"
output:
xaringan::moon_reader:
# self_contained: true
lib_dir: libs
css: mediocre-themer.css
nature:
countIncrementalSlides: no
highlightLines: yes
highlightStyle: github
ratio: '16:9'
titleSlideClass: [right, middle, inverse]
---
```{r themer, include=FALSE}
library(mediocrethemes)
xaringan_mediocre(pal = "coty")
```
# Lipsum latin words
- Lorem ipsum dolor sit amet, **sed sed sapien ac aliquam sollicitudin dapibus**.
- Ut elementum **efficitur penatibus**, taciti diam risus, donec.Mediocrethemes plots in slides
By default, the xaringan_mediocre function is built to
generate plots in the mediocrethemes format. To turn it of, set the
parameter mediocre_plots to FALSE.
Centering text but not title
To center the main text of a slide but keep the title at the top (in
a LaTeX beamer fashion), set the class attributes to titled
and middle for the slide of interest:
Helpful functions for xaringan slides
The following functions are not part of the
mediocrethemes package but are very helpful when working
with xaringan slides. I compile them here for an easy
access.
Continuous updating of the preview
The super-helpful function xaringan::inf_mr() (or the
RStudio addin “Infinite Moon Reader”) enables to continuously update the
preview of the slides, by only saving the source document.
In this
presentation, Alisson Hill gives an excellent introduction to these
and many other xaringan features.
Nice transition slides
Xaringanthemer provides nice transition slides that can be created by adding the following lines to your code:
Here is what these transition slides look like with mediocrethemes:

Export
The package renderthis
can be used to export the slides. For instance, to export them to pdf,
one can use the function renderthis::to_pdf. Setting the
parameter partial_slides to TRUE enables to
keep the pauses in the export.
As mentioned above, self_contained: true enables to
create self-contained html slides.