Skip to content
TC edited this page Oct 4, 2018 · 4 revisions

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"]