Yihui picked out great fonts for the default xaringan theme, but sometimes you want something new and interesting.

xaringanthemer makes it easy to use Google Fonts in your presentations (well, as long as you have an internet connection) or to fully specify your font files.

To use Google Fonts, set the _font_google theme arguments – text_font_google, header_font_google, code_font_google — using the google_font() helper. See ?google_font for more info.

  header_font_google = google_font("Josefin Slab", "600"),
  text_font_google   = google_font("Work Sans", "300", "300i"),
  code_font_google   = google_font("IBM Plex Mono")

If you set an xxx_font_google theme arguments, then xxx_font_family, xxx_font_weight and xxx_font_url are overwritten – where xxx in {header, text, code}. Of course, you can manually set header_font_url, etc., and ignore the header_font_google argument.

For example, suppose you want to use a ligature font for the code font, such as Fira Code. Just set code_font_family and code_font_url!

If you need to import additional fonts for use in custom CSS definitions, you can use the extra_fonts argument to pass a list of URLs or google_font()s.