😎 Give your xaringan slides some style
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

45 lines
1.8KB

  1. <!-- Need to set [adding-custom-css] -->
  2. [google-fonts]: https://fonts.google.com
  3. Yihui picked out great fonts for the [default xaringan theme](https://slides.yihui.name/xaringan/), but sometimes you want something new and interesting.
  4. **xaringanthemer** makes it easy to use [Google Fonts][google-fonts] in your presentations (well, as long as you have an internet connection) or to fully specify your font files.
  5. To use [Google Fonts][google-fonts], set the `_font_google` theme arguments --
  6. ```{r results='asis', echo=FALSE}
  7. cat(paste0("`", tvv[grepl("_font_google$", tvv)], "`", collapse = ", "))
  8. ```
  9. --- using the `google_font()` helper.
  10. See `?google_font` for more info.
  11. ```r
  12. mono_light(
  13. header_font_google = google_font("Josefin Slab", "600"),
  14. text_font_google = google_font("Work Sans", "300", "300i"),
  15. code_font_google = google_font("IBM Plex Mono")
  16. )
  17. ```
  18. 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}`.
  19. Of course, you can manually set `header_font_url`, etc., and ignore the `header_font_google` argument.
  20. For example, suppose you want to use a ligature font for the code font, such as [Fira Code](https://github.com/yihui/xaringan/issues/83).
  21. Just set `code_font_family` and `code_font_url`!
  22. ```r
  23. solarized_dark(
  24. code_font_family = "Fira Code",
  25. code_font_url = "https://cdn.rawgit.com/tonsky/FiraCode/1.204/distr/fira_code.css"
  26. )
  27. ```
  28. If you need to import additional fonts for use in [custom CSS definitions][adding-custom-css], you can use the `extra_fonts` argument to pass a list of URLs or `google_font()`s.
  29. ```r
  30. mono_light(
  31. extra_fonts = list(google_font("Sofia")),
  32. extra_css = list(".title-slide h2" = list("font-family" = "Sofia"))
  33. )
  34. ```