4

I would like to set a default set of slide content classes applicable to all slides of my xaringan presentation. This will save me from having to write

class: someclass

at the top of every single slide. I'm guessing this could be set by using templates but then I'd still have to remember to copy that information to each slide.

It is possible to set the default content classes for the title slide using titleSlideClass in the YAML such as:

---
output:
  xaringan::moon_reader:
    nature:
      titleSlideClass: ["right", "top", "my-title"]
---

I'd like to be able to do that for each slide. If it's not possible I'll tinker with adding it to the moon_reader myself but would like not to reinvent the wheel if possible.

PS: One might argue: why not just update the CSS file if you want a particular class for every slide anyway. That is indeed an option but I just want to set a default slide transition option and don't want to mess unnecessarily around with animate.js.

Yihui Xie
  • 28,913
  • 23
  • 193
  • 419
ekstroem
  • 5,957
  • 3
  • 22
  • 48

1 Answers1

2

I guess I found an easy solution after perusing the remark.js documentation. The layout: true option allows the user to include a set of default classes as the first slide. Showing it here in case someone else might need it:

Thus, right after the YAML the following slide will be hidden, but will be applied to all subsequent slides

---

class: animated, fadeIn
layout: true

---
ekstroem
  • 5,957
  • 3
  • 22
  • 48