😎 Give your xaringan slides some style
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

242 lines
15KB

  1. <!DOCTYPE html>
  2. <!-- Generated by pkgdown: do not edit by hand --><html lang="en">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <meta charset="utf-8">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  8. <title>Fonts • xaringanthemer</title>
  9. <!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png">
  10. <link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png">
  11. <link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png">
  12. <link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png">
  13. <link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png">
  14. <link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png">
  15. <!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha256-bZLfwXAP04zRMK2BjiO8iu9pf4FbLqX6zitd+tIvLhE=" crossorigin="anonymous">
  16. <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script><!-- bootstrap-toc --><link rel="stylesheet" href="../bootstrap-toc.css">
  17. <script src="../bootstrap-toc.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous">
  18. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous">
  19. <!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet">
  20. <script src="../pkgdown.js"></script><link href="../extra.css" rel="stylesheet">
  21. <meta property="og:title" content="Fonts">
  22. <meta property="og:description" content="xaringanthemer">
  23. <meta property="og:image" content="https://pkg.garrickadenbuie.com/xaringanthemer/logo.png">
  24. <meta name="twitter:card" content="summary">
  25. <meta name="twitter:creator" content="@grrrck">
  26. <meta name="twitter:site" content="@grrrck">
  27. <!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
  28. <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  29. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  30. <![endif]-->
  31. </head>
  32. <body data-spy="scroll" data-target="#toc">
  33. <div class="container template-article">
  34. <header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
  35. <div class="container">
  36. <div class="navbar-header">
  37. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
  38. <span class="sr-only">Toggle navigation</span>
  39. <span class="icon-bar"></span>
  40. <span class="icon-bar"></span>
  41. <span class="icon-bar"></span>
  42. </button>
  43. <span class="navbar-brand">
  44. <a class="navbar-link" href="../index.html">xaringanthemer</a>
  45. <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.3.4.9000</span>
  46. </span>
  47. </div>
  48. <div id="navbar" class="navbar-collapse collapse">
  49. <ul class="nav navbar-nav">
  50. <li>
  51. <a href="../articles/xaringanthemer.html">Features</a>
  52. </li>
  53. <li>
  54. <a href="../reference/index.html">Reference</a>
  55. </li>
  56. <li>
  57. <a href="../articles/themes.html">Themes</a>
  58. </li>
  59. <li>
  60. <a href="../articles/ggplot2-themes.html">ggplot2 Themes</a>
  61. </li>
  62. <li class="dropdown">
  63. <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
  64. More
  65. <span class="caret"></span>
  66. </a>
  67. <ul class="dropdown-menu" role="menu">
  68. <li>
  69. <a href="../articles/fonts.html">Fonts</a>
  70. </li>
  71. <li>
  72. <a href="../articles/template-variables.html">Template Variables</a>
  73. </li>
  74. </ul>
  75. </li>
  76. </ul>
  77. <ul class="nav navbar-nav navbar-right">
  78. <li class="dropdown">
  79. <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
  80. <span class="far fa-newspaper fa-lg"></span>
  81. <span class="caret"></span>
  82. </a>
  83. <ul class="dropdown-menu" role="menu">
  84. <li>
  85. <a href="https://garrickadenbuie.com/blog/xaringanthemer-v0-3-0/">xaringan 0.3.0</a>
  86. </li>
  87. <li class="divider">
  88. <li>
  89. <a href="../news/index.html">Changelog</a>
  90. </li>
  91. </ul>
  92. </li>
  93. <li>
  94. <a href="https://github.com/gadenbuie/xaringanthemer">
  95. <span class="fab fa-github fa-lg"></span>
  96. </a>
  97. </li>
  98. <li>
  99. <a href="https://twitter.com/grrrck">
  100. <span class="fab fa-twitter fa-lg"></span>
  101. </a>
  102. </li>
  103. <li>
  104. <a href="https://www.garrickadenbuie.com">
  105. <span class="fas fa-home fa-lg"></span>
  106. </a>
  107. </li>
  108. </ul>
  109. </div>
  110. <!--/.nav-collapse -->
  111. </div>
  112. <!--/.container -->
  113. </div>
  114. <!--/.navbar -->
  115. </header><script src="fonts_files/accessible-code-block-0.0.1/empty-anchor.js"></script><div class="row">
  116. <div class="col-md-9 contents">
  117. <div class="page-header toc-ignore">
  118. <h1 data-toc-skip>Fonts</h1>
  119. <small class="dont-index">Source: <a href="https://github.com/gadenbuie/xaringanthemer/blob/master/vignettes/fonts.Rmd"><code>vignettes/fonts.Rmd</code></a></small>
  120. <div class="hidden name"><code>fonts.Rmd</code></div>
  121. </div>
  122. <!-- Need to set [adding-custom-css] -->
  123. <p><link href="https://fonts.googleapis.com/css2?family=Cabin:wght@600&amp;family=Noto+Sans&amp;display=swap" rel="stylesheet"></p>
  124. <style type="text/css">
  125. .cabin {
  126. font-family: Cabin;
  127. font-weight: 600
  128. }
  129. .noto-sans {
  130. font-family: 'Noto Sans';
  131. }
  132. .font-preview {
  133. padding: 1em;
  134. margin-top: 1em;
  135. margin-bottom: 1em;
  136. border: 1px solid #dddddd;
  137. border-radius: 3px;
  138. font-size: 1.25em;
  139. }
  140. </style>
  141. <div id="default-fonts" class="section level3">
  142. <h3 class="hasAnchor">
  143. <a href="#default-fonts" class="anchor"></a>Default Fonts</h3>
  144. <p>The default heading and body fonts used in <strong>xaringanthemer</strong> are different than the xaringan default fonts. In xaringanthemer, <a href="https://fonts.google.com/specimen/Cabin">Cabin</a> is used for headings and <a href="https://fonts.google.com/specimen/Noto+Sans">Noto Sans</a> for body text.</p>
  145. <div class="font-preview">
  146. <p style="font-size: 1.5em" class="cabin">
  147. A Cabin in the Clearing
  148. </p>
  149. <p class="noto-sans">
  150. Pack my box with five dozen liquor jugs. Amazingly few discotheques provide jukeboxes.
  151. </p>
  152. </div>
  153. <p>These fonts are easier to read on screens and at a distance during presentations, and they support a wide variety of languages and weights. Another reason for the change is that the xaringan (remarkjs) default body font, <em>Droid Serif</em>, is no longer officially included in Google Fonts.</p>
  154. <p>If you would like to use the fonts from the <a href="https://slides.yihui.org/xaringan/">default xaringan theme</a>, you can use the following arguments in your style function.</p>
  155. <div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
  156. <code class="sourceCode R"><span class="fu"><a href="../reference/xaringanthemer_font_default.html">style_xaringan</a></span><span class="op">(</span>
  157. text_font_family <span class="op">=</span> <span class="st">"Droid Serif"</span>,
  158. text_font_url <span class="op">=</span> <span class="st">"https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic"</span>,
  159. header_font_google <span class="op">=</span> <span class="fu"><a href="../reference/google_font.html">google_font</a></span><span class="op">(</span><span class="st">"Yanone Kaffeesatz"</span><span class="op">)</span>
  160. <span class="op">)</span></code></pre></div>
  161. </div>
  162. <div id="custom-and-google-font-fonts" class="section level3">
  163. <h3 class="hasAnchor">
  164. <a href="#custom-and-google-font-fonts" class="anchor"></a>Custom and <em>Google Font</em> Fonts</h3>
  165. <p><strong>xaringanthemer</strong> makes it easy to use <a href="https://fonts.google.com">Google Fonts</a> in your presentations (provided you have an internet connection during the presentation) or to fully specify your font files.</p>
  166. <p>To use <a href="https://fonts.google.com">Google Fonts</a>, set the <code>&lt;type&gt;_font_google</code> theme arguments – <code>text_font_google</code>, <code>header_font_google</code>, <code>code_font_google</code> — using the <code><a href="../reference/google_font.html">google_font()</a></code> helper. The help documentation in <code><a href="../reference/google_font.html">?google_font</a></code> provides more info.</p>
  167. <div class="sourceCode" id="cb2"><pre class="downlit sourceCode r">
  168. <code class="sourceCode R"><span class="fu"><a href="../reference/style_mono_light.html">style_mono_light</a></span><span class="op">(</span>
  169. header_font_google <span class="op">=</span> <span class="fu"><a href="../reference/google_font.html">google_font</a></span><span class="op">(</span><span class="st">"Josefin Slab"</span>, <span class="st">"600"</span><span class="op">)</span>,
  170. text_font_google <span class="op">=</span> <span class="fu"><a href="../reference/google_font.html">google_font</a></span><span class="op">(</span><span class="st">"Work Sans"</span>, <span class="st">"300"</span>, <span class="st">"300i"</span><span class="op">)</span>,
  171. code_font_google <span class="op">=</span> <span class="fu"><a href="../reference/google_font.html">google_font</a></span><span class="op">(</span><span class="st">"IBM Plex Mono"</span><span class="op">)</span>
  172. <span class="op">)</span></code></pre></div>
  173. <p>If you set an <code>&lt;type&gt;_font_google</code> theme arguments, then <code>&lt;type&gt;_font_family</code>, <code>&lt;type&gt;_font_weight</code> and <code>&lt;type&gt;_font_url</code> are overwritten – where <code>&lt;type&gt;</code> is one of <code>header</code>, <code>text</code>, or <code>code</code>.</p>
  174. <p>To use a font hosted outside of Google fonts, you need to provide both <code>&lt;type&gt;_font_family</code> and <code>&lt;type&gt;_font_url</code>. For example, suppose you want to use a code font with ligatures for your code chunks, such as <a href="https://github.com/tonsky/FiraCode">Fira Code</a>, which would be declared with <code>code_font_family</code>. The <a href="https://github.com/tonsky/FiraCode#browser-support">browser usage</a> section of the Fira Code README provides a CSS URL to be used with an <code>@import</code> statement that you can use with the <code>code_font_url</code> argument.</p>
  175. <div class="sourceCode" id="cb3"><pre class="downlit sourceCode r">
  176. <code class="sourceCode R"><span class="fu"><a href="../reference/style_solarized_dark.html">style_solarized_dark</a></span><span class="op">(</span>
  177. code_font_family <span class="op">=</span> <span class="st">"Fira Code"</span>,
  178. code_font_url <span class="op">=</span> <span class="st">"https://cdn.jsdelivr.net/gh/tonsky/FiraCode@2/distr/fira_code.css"</span>
  179. <span class="op">)</span></code></pre></div>
  180. <p>Remember that you need to supply either <code>&lt;type&gt;_google_font</code> using the <code><a href="../reference/google_font.html">google_font()</a></code> helper <em>or both</em> <code>&lt;type&gt;_font_family</code> and <code>&lt;type&gt;_font_url</code>.</p>
  181. </div>
  182. <div id="using-additional-fonts" class="section level3">
  183. <h3 class="hasAnchor">
  184. <a href="#using-additional-fonts" class="anchor"></a>Using Additional Fonts</h3>
  185. <p>If you want to use additional fonts for use in <a href="xaringanthemer.html#adding-custom-css">custom CSS definitions</a>, use the <code>extra_fonts</code> argument to pass a list of URLs or <code><a href="../reference/google_font.html">google_font()</a></code>s. Notice that you will need to add custom CSS (for example, via <code>extra_css</code>) to use the fonts imported in <code>extra_fonts</code>.</p>
  186. <div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
  187. <code class="sourceCode R"><span class="fu"><a href="../reference/style_mono_light.html">style_mono_light</a></span><span class="op">(</span>
  188. extra_fonts <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span><span class="op">(</span>
  189. <span class="fu"><a href="../reference/google_font.html">google_font</a></span><span class="op">(</span><span class="st">"Sofia"</span><span class="op">)</span>,
  190. <span class="co"># Young Serif by uplaod.fr</span>
  191. <span class="st">"https://cdn.jsdelivr.net/gh/uplaod/YoungSerif/fonts/webfonts/fontface.css"</span>,
  192. <span class="op">)</span>,
  193. extra_css <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span><span class="op">(</span>
  194. <span class="st">".title-slide h2"</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span><span class="op">(</span><span class="st">"font-family"</span> <span class="op">=</span> <span class="st">"Sofia"</span><span class="op">)</span>,
  195. blockquote <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span><span class="op">(</span><span class="st">"font-family"</span> <span class="op">=</span> <span class="st">"youngserifregular"</span><span class="op">)</span>
  196. <span class="op">)</span>
  197. <span class="op">)</span></code></pre></div>
  198. </div>
  199. </div>
  200. <div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
  201. </div>
  202. </div>
  203. <footer><div class="copyright">
  204. <p>Developed by <a href="https://www.garrickadenbuie.com">Garrick Aden-Buie</a>.</p>
  205. </div>
  206. <div class="pkgdown">
  207. <p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.6.1.</p>
  208. </div>
  209. </footer>
  210. </div>
  211. </body>
  212. </html>