😎 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.

223 lines
16KB

  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, shrink-to-fit=no">
  8. <meta name="description" content="xaringanthemer">
  9. <title>Fonts • xaringanthemer</title>
  10. <!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png">
  11. <link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png">
  12. <link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png">
  13. <link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png">
  14. <link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png">
  15. <link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png">
  16. <script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  17. <link href="../deps/bootstrap-5.1.0/bootstrap.min.css" rel="stylesheet">
  18. <script src="../deps/bootstrap-5.1.0/bootstrap.bundle.min.js"></script><link href="../deps/_IBM%20Plex%20Mono-0.4.0/font.css" rel="stylesheet">
  19. <link href="../deps/_Montserrat-0.4.0/font.css" rel="stylesheet">
  20. <!-- 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">
  21. <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">
  22. <!-- bootstrap-toc --><script src="https://cdn.rawgit.com/afeld/bootstrap-toc/v1.0.1/dist/bootstrap-toc.min.js"></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><!-- 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><!-- search --><script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/6.4.6/fuse.js" integrity="sha512-zv6Ywkjyktsohkbp9bb45V6tEMoWhzFzXis+LrMehmJZZSys19Yxf1dopHx7WzIKxr5tK2dVcYmaCk2uqdjF4A==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/autocomplete.js/0.38.0/autocomplete.jquery.min.js" integrity="sha512-GU9ayf+66Xx2TmpxqJpliWbT5PiGYxpaG8rfnBEk1LL8l1KGkRShhngwdXK1UgqhAzWpZHSiYPc09/NwDQIGyg==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/mark.min.js" integrity="sha512-5CYOlHXGh6QpOFA/TeTylKLWfB3ftPsde7AnmhuitiTX4K5SqCLBeKro6sPS8ilsz1Q4NRx3v8Ko2IBiszzdww==" crossorigin="anonymous"></script><!-- pkgdown --><script src="../pkgdown.js"></script><link href="../extra.css" rel="stylesheet">
  23. <meta property="og:title" content="Fonts">
  24. <meta property="og:description" content="xaringanthemer">
  25. <meta property="og:image" content="https://pkg.garrickadenbuie.com/xaringanthemer/logo.png">
  26. <meta name="twitter:card" content="summary">
  27. <meta name="twitter:creator" content="@grrrck">
  28. <meta name="twitter:site" content="@grrrck">
  29. <!-- 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]>
  30. <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  31. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  32. <![endif]-->
  33. </head>
  34. <body>
  35. <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
  36. <nav class="navbar fixed-top navbar-light navbar-expand-lg bg-light"><div class="container">
  37. <a class="navbar-brand me-2" href="../index.html">xaringanthemer</a>
  38. <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Released version">0.4.1</small>
  39. <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
  40. <span class="navbar-toggler-icon"></span>
  41. </button>
  42. <div id="navbar" class="collapse navbar-collapse ms-2">
  43. <ul class="navbar-nav me-auto">
  44. <li class="nav-item">
  45. <a class="nav-link" href="../articles/xaringanthemer.html">Features</a>
  46. </li>
  47. <li class="nav-item">
  48. <a class="nav-link" href="../reference/index.html">Reference</a>
  49. </li>
  50. <li class="active nav-item dropdown">
  51. <a href="#" class="nav-link dropdown-toggle" data-bs-toggle="dropdown" role="button" aria-expanded="false" aria-haspopup="true" id="dropdown-themes">Themes</a>
  52. <div class="dropdown-menu" aria-labelledby="dropdown-themes">
  53. <h6 class="dropdown-header" data-toc-skip>Themes</h6>
  54. <a class="dropdown-item" href="../articles/themes.html">Slide Themes</a>
  55. <a class="dropdown-item" href="../articles/ggplot2-themes.html">ggplot2 Themes</a>
  56. <div class="dropdown-divider"></div>
  57. <h6 class="dropdown-header" data-toc-skip>More Customization</h6>
  58. <a class="dropdown-item" href="../articles/fonts.html">Fonts</a>
  59. <a class="dropdown-item" href="../articles/template-variables.html">Template Variables</a>
  60. </div>
  61. </li>
  62. </ul>
  63. <form class="form-inline my-2 my-lg-0" role="search">
  64. <input type="search" class="form-control me-sm-2" aria-label="Toggle navigation" name="search-input" data-search-index="../search.json" id="search-input" placeholder="Search for" autocomplete="off">
  65. </form>
  66. <ul class="navbar-nav">
  67. <li class="nav-item dropdown">
  68. <a href="#" class="nav-link dropdown-toggle" data-bs-toggle="dropdown" role="button" aria-expanded="false" aria-haspopup="true" id="dropdown--">
  69. <span class="far fa far fa-newspaper fa-lg"></span>
  70. </a>
  71. <div class="dropdown-menu" aria-labelledby="dropdown--">
  72. <a class="external-link dropdown-item" href="https://garrickadenbuie.com/blog/xaringanthemer-v0-3-0/">xaringanthemer 0.3.0</a>
  73. <div class="dropdown-divider"></div>
  74. <a class="dropdown-item" href="../news/index.html">Changelog</a>
  75. </div>
  76. </li>
  77. <li class="nav-item">
  78. <a class="external-link nav-link" href="https://github.com/gadenbuie/xaringanthemer">
  79. <span class="fab fa fab fa-github fa-lg"></span>
  80. </a>
  81. </li>
  82. <li class="nav-item">
  83. <a class="external-link nav-link" href="https://twitter.com/grrrck">
  84. <span class="fab fa fab fa-twitter fa-lg"></span>
  85. </a>
  86. </li>
  87. <li class="nav-item">
  88. <a class="external-link nav-link" href="https://www.garrickadenbuie.com">
  89. <span class="fas fa fas fa-home fa-lg"></span>
  90. </a>
  91. </li>
  92. </ul>
  93. </div>
  94. </div>
  95. </nav><div class="container template-article">
  96. <script src="fonts_files/accessible-code-block-0.0.1/empty-anchor.js"></script><div class="row">
  97. <main id="main"><div class="page-header">
  98. <img src="../logo.png" class="logo" alt=""><h1>Fonts</h1>
  99. <small class="dont-index">Source: <a href="https://github.com/gadenbuie/xaringanthemer/blob/HEAD/vignettes/fonts.Rmd" class="external-link"><code>vignettes/fonts.Rmd</code></a></small>
  100. <div class="d-none name"><code>fonts.Rmd</code></div>
  101. </div>
  102. <!-- Need to set [adding-custom-css] -->
  103. <p><link href="https://fonts.googleapis.com/css2?family=Cabin:wght@600&amp;family=Noto+Sans&amp;display=swap" rel="stylesheet"></p>
  104. <style type="text/css">
  105. .cabin {
  106. font-family: Cabin;
  107. font-weight: 600
  108. }
  109. .noto-sans {
  110. font-family: 'Noto Sans';
  111. }
  112. .font-preview {
  113. padding: 1em;
  114. margin-top: 1em;
  115. margin-bottom: 1em;
  116. border: 1px solid #dddddd;
  117. border-radius: 3px;
  118. font-size: 1.25em;
  119. }
  120. </style>
  121. <div class="section level3">
  122. <h3 id="default-fonts">Default Fonts<a class="anchor" aria-label="anchor" href="#default-fonts"></a>
  123. </h3>
  124. <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" class="external-link">Cabin</a> is used for headings and <a href="https://fonts.google.com/specimen/Noto+Sans" class="external-link">Noto Sans</a> for body text.</p>
  125. <div class="font-preview">
  126. <p style="font-size: 1.5em" class="cabin">
  127. A Cabin in the Clearing
  128. </p>
  129. <p class="noto-sans">
  130. Pack my box with five dozen liquor jugs. Amazingly few discotheques provide jukeboxes.
  131. </p>
  132. </div>
  133. <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>
  134. <p>If you would like to use the fonts from the <a href="https://slides.yihui.org/xaringan/" class="external-link">default xaringan theme</a>, you can use the following arguments in your style function.</p>
  135. <div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
  136. <code class="sourceCode R"><span class="fu"><a href="../reference/style_xaringan.html">style_xaringan</a></span><span class="op">(</span>
  137. text_font_family <span class="op">=</span> <span class="st">"Droid Serif"</span>,
  138. text_font_url <span class="op">=</span> <span class="st">"https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic"</span>,
  139. 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>
  140. <span class="op">)</span></code></pre></div>
  141. </div>
  142. <div class="section level3">
  143. <h3 id="custom-and-google-font-fonts">Custom and <em>Google Font</em> Fonts<a class="anchor" aria-label="anchor" href="#custom-and-google-font-fonts"></a>
  144. </h3>
  145. <p><strong>xaringanthemer</strong> makes it easy to use <a href="https://fonts.google.com" class="external-link">Google Fonts</a> in your presentations (provided you have an internet connection during the presentation) or to fully specify your font files.</p>
  146. <p>To use <a href="https://fonts.google.com" class="external-link">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>
  147. <div class="sourceCode" id="cb2"><pre class="downlit sourceCode r">
  148. <code class="sourceCode R"><span class="fu"><a href="../reference/style_mono_light.html">style_mono_light</a></span><span class="op">(</span>
  149. 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>,
  150. 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>,
  151. 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>
  152. <span class="op">)</span></code></pre></div>
  153. <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>
  154. <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" class="external-link">Fira Code</a>, which would be declared with <code>code_font_family</code>. The <a href="https://github.com/tonsky/FiraCode#browser-support" class="external-link">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>
  155. <div class="sourceCode" id="cb3"><pre class="downlit sourceCode r">
  156. <code class="sourceCode R"><span class="fu"><a href="../reference/style_solarized_dark.html">style_solarized_dark</a></span><span class="op">(</span>
  157. code_font_family <span class="op">=</span> <span class="st">"Fira Code"</span>,
  158. code_font_url <span class="op">=</span> <span class="st">"https://cdn.jsdelivr.net/gh/tonsky/FiraCode@2/distr/fira_code.css"</span>
  159. <span class="op">)</span></code></pre></div>
  160. <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>
  161. </div>
  162. <div class="section level3">
  163. <h3 id="using-additional-fonts">Using Additional Fonts<a class="anchor" aria-label="anchor" href="#using-additional-fonts"></a>
  164. </h3>
  165. <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>
  166. <div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
  167. <code class="sourceCode R"><span class="fu"><a href="../reference/style_mono_light.html">style_mono_light</a></span><span class="op">(</span>
  168. extra_fonts <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span>
  169. <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>,
  170. <span class="co"># Young Serif by uplaod.fr</span>
  171. <span class="st">"https://cdn.jsdelivr.net/gh/uplaod/YoungSerif/fonts/webfonts/fontface.css"</span>,
  172. <span class="op">)</span>,
  173. extra_css <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span>
  174. <span class="st">".title-slide h2"</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">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>,
  175. blockquote <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">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>
  176. <span class="op">)</span>
  177. <span class="op">)</span></code></pre></div>
  178. </div>
  179. </main>
  180. </div>
  181. <footer><div class="pkgdown-footer-left">
  182. <p></p>
  183. <p>Developed by <a href="https://www.garrickadenbuie.com" class="external-link">Garrick Aden-Buie</a>.</p>
  184. </div>
  185. <div class="pkgdown-footer-right">
  186. <p></p>
  187. <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.1.</p>
  188. </div>
  189. </footer>
  190. </div>
  191. </body>
  192. </html>