😎 Give your xaringan slides some style
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

243 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. <meta name="robots" content="noindex">
  28. <!-- 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]>
  29. <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  30. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  31. <![endif]-->
  32. </head>
  33. <body data-spy="scroll" data-target="#toc">
  34. <div class="container template-article">
  35. <header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
  36. <div class="container">
  37. <div class="navbar-header">
  38. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
  39. <span class="sr-only">Toggle navigation</span>
  40. <span class="icon-bar"></span>
  41. <span class="icon-bar"></span>
  42. <span class="icon-bar"></span>
  43. </button>
  44. <span class="navbar-brand">
  45. <a class="navbar-link" href="../index.html">xaringanthemer</a>
  46. <span class="version label label-danger" data-toggle="tooltip" data-placement="bottom" title="In-development version">0.4.0.9000</span>
  47. </span>
  48. </div>
  49. <div id="navbar" class="navbar-collapse collapse">
  50. <ul class="nav navbar-nav">
  51. <li>
  52. <a href="../articles/xaringanthemer.html">Features</a>
  53. </li>
  54. <li>
  55. <a href="../reference/index.html">Reference</a>
  56. </li>
  57. <li>
  58. <a href="../articles/themes.html">Themes</a>
  59. </li>
  60. <li>
  61. <a href="../articles/ggplot2-themes.html">ggplot2 Themes</a>
  62. </li>
  63. <li class="dropdown">
  64. <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
  65. More
  66. <span class="caret"></span>
  67. </a>
  68. <ul class="dropdown-menu" role="menu">
  69. <li>
  70. <a href="../articles/fonts.html">Fonts</a>
  71. </li>
  72. <li>
  73. <a href="../articles/template-variables.html">Template Variables</a>
  74. </li>
  75. </ul>
  76. </li>
  77. </ul>
  78. <ul class="nav navbar-nav navbar-right">
  79. <li class="dropdown">
  80. <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
  81. <span class="far fa-newspaper fa-lg"></span>
  82. <span class="caret"></span>
  83. </a>
  84. <ul class="dropdown-menu" role="menu">
  85. <li>
  86. <a href="https://garrickadenbuie.com/blog/xaringanthemer-v0-3-0/">xaringanthemer 0.3.0</a>
  87. </li>
  88. <li class="divider">
  89. <li>
  90. <a href="../news/index.html">Changelog</a>
  91. </li>
  92. </ul>
  93. </li>
  94. <li>
  95. <a href="https://github.com/gadenbuie/xaringanthemer">
  96. <span class="fab fa-github fa-lg"></span>
  97. </a>
  98. </li>
  99. <li>
  100. <a href="https://twitter.com/grrrck">
  101. <span class="fab fa-twitter fa-lg"></span>
  102. </a>
  103. </li>
  104. <li>
  105. <a href="https://www.garrickadenbuie.com">
  106. <span class="fas fa-home fa-lg"></span>
  107. </a>
  108. </li>
  109. </ul>
  110. </div>
  111. <!--/.nav-collapse -->
  112. </div>
  113. <!--/.container -->
  114. </div>
  115. <!--/.navbar -->
  116. </header><script src="fonts_files/accessible-code-block-0.0.1/empty-anchor.js"></script><div class="row">
  117. <div class="col-md-9 contents">
  118. <div class="page-header toc-ignore">
  119. <h1 data-toc-skip>Fonts</h1>
  120. <small class="dont-index">Source: <a href="https://github.com/gadenbuie/xaringanthemer/blob/master/vignettes/fonts.Rmd"><code>vignettes/fonts.Rmd</code></a></small>
  121. <div class="hidden name"><code>fonts.Rmd</code></div>
  122. </div>
  123. <!-- Need to set [adding-custom-css] -->
  124. <p><link href="https://fonts.googleapis.com/css2?family=Cabin:wght@600&amp;family=Noto+Sans&amp;display=swap" rel="stylesheet"></p>
  125. <style type="text/css">
  126. .cabin {
  127. font-family: Cabin;
  128. font-weight: 600
  129. }
  130. .noto-sans {
  131. font-family: 'Noto Sans';
  132. }
  133. .font-preview {
  134. padding: 1em;
  135. margin-top: 1em;
  136. margin-bottom: 1em;
  137. border: 1px solid #dddddd;
  138. border-radius: 3px;
  139. font-size: 1.25em;
  140. }
  141. </style>
  142. <div id="default-fonts" class="section level3">
  143. <h3 class="hasAnchor">
  144. <a href="#default-fonts" class="anchor"></a>Default Fonts</h3>
  145. <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>
  146. <div class="font-preview">
  147. <p style="font-size: 1.5em" class="cabin">
  148. A Cabin in the Clearing
  149. </p>
  150. <p class="noto-sans">
  151. Pack my box with five dozen liquor jugs. Amazingly few discotheques provide jukeboxes.
  152. </p>
  153. </div>
  154. <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>
  155. <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>
  156. <div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
  157. <code class="sourceCode R"><span class="fu"><a href="../reference/xaringanthemer_font_default.html">style_xaringan</a></span><span class="op">(</span>
  158. text_font_family <span class="op">=</span> <span class="st">"Droid Serif"</span>,
  159. text_font_url <span class="op">=</span> <span class="st">"https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic"</span>,
  160. 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>
  161. <span class="op">)</span></code></pre></div>
  162. </div>
  163. <div id="custom-and-google-font-fonts" class="section level3">
  164. <h3 class="hasAnchor">
  165. <a href="#custom-and-google-font-fonts" class="anchor"></a>Custom and <em>Google Font</em> Fonts</h3>
  166. <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>
  167. <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>
  168. <div class="sourceCode" id="cb2"><pre class="downlit sourceCode r">
  169. <code class="sourceCode R"><span class="fu"><a href="../reference/style_mono_light.html">style_mono_light</a></span><span class="op">(</span>
  170. 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>,
  171. 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>,
  172. 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>
  173. <span class="op">)</span></code></pre></div>
  174. <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>
  175. <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>
  176. <div class="sourceCode" id="cb3"><pre class="downlit sourceCode r">
  177. <code class="sourceCode R"><span class="fu"><a href="../reference/style_solarized_dark.html">style_solarized_dark</a></span><span class="op">(</span>
  178. code_font_family <span class="op">=</span> <span class="st">"Fira Code"</span>,
  179. code_font_url <span class="op">=</span> <span class="st">"https://cdn.jsdelivr.net/gh/tonsky/FiraCode@2/distr/fira_code.css"</span>
  180. <span class="op">)</span></code></pre></div>
  181. <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>
  182. </div>
  183. <div id="using-additional-fonts" class="section level3">
  184. <h3 class="hasAnchor">
  185. <a href="#using-additional-fonts" class="anchor"></a>Using Additional Fonts</h3>
  186. <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>
  187. <div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
  188. <code class="sourceCode R"><span class="fu"><a href="../reference/style_mono_light.html">style_mono_light</a></span><span class="op">(</span>
  189. 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>
  190. <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>,
  191. <span class="co"># Young Serif by uplaod.fr</span>
  192. <span class="st">"https://cdn.jsdelivr.net/gh/uplaod/YoungSerif/fonts/webfonts/fontface.css"</span>,
  193. <span class="op">)</span>,
  194. 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>
  195. <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>,
  196. 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>
  197. <span class="op">)</span>
  198. <span class="op">)</span></code></pre></div>
  199. </div>
  200. </div>
  201. <div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
  202. </div>
  203. </div>
  204. <footer><div class="copyright">
  205. <p>Developed by <a href="https://www.garrickadenbuie.com">Garrick Aden-Buie</a>.</p>
  206. </div>
  207. <div class="pkgdown">
  208. <p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.6.1.</p>
  209. </div>
  210. </footer>
  211. </div>
  212. </body>
  213. </html>