Skip to content
Patrick Schratz edited this page Mar 27, 2018 · 12 revisions

Welcome to the xaringan wiki!

As most R users are not familiar with CSS, this vignette will show examples of basic slide modifications. They can be adapted and extended to your desires. However, you are still highly encouraged to familiarize yourself with remark.js (the engine behind xaringan) and read the Wiki!*

Prerequisites

To enable slide modifications, you need to specify a custom .css file in the YAML header of your .Rmd file.
Make sure to insert the relative path to the file if it is not placed in the same directory as your .Rmd file.
Your YAML header should look as follows:

---
title: "Presentation Ninja"
subtitle: "with xaringan"
author: "Yihui Xie"
date: "2016/12/12"
output:
  xaringan::moon_reader:
    css: "my-theme.css"
    lib_dir: libs
    nature:
      highlightStyle: github
      highlightLines: true
---

In this example I assume that our file is named my-theme.css. If you want to specify multiple files and split up your CSS modifications, use square brackets: css: ["my-theme.css", "my-font.css"].

You can either copy the default CSS default.css and adapt this copy to your needs, or change a small subset of CSS rules based on this CSS file. In the former case, you completely override the css option of moon_reader(), e.g., css: "my-theme.css"; in the latter case, you can add your CSS file after "default" ("default" means the aforementioned example.css), e.g.,

output:
  xaringan::moon_reader:
    css: ["default", "my-theme.css"]