Explorar el Código

v0.3.3

tags/v0.3.3
Garrick Aden-Buie hace 5 años
padre
commit
dd57776684
Ninguna cuenta vinculada a la dirección de correo electrónico del committer
Se han modificado 30 ficheros con 219 adiciones y 485 borrados
  1. +2
    -2
      DESCRIPTION
  2. +10
    -4
      NEWS.md
  3. +5
    -5
      R/ggplot2.R
  4. +1
    -1
      README.Rmd
  5. +1
    -1
      README.md
  6. +4
    -42
      cran-comments.md
  7. +170
    -415
      inst/rmarkdown/templates/xaringanthemer/skeleton/skeleton.Rmd
  8. +3
    -0
      make.R
  9. +1
    -1
      man-roxygen/style_solarized_dark.R
  10. +1
    -1
      man-roxygen/style_solarized_light.R
  11. +1
    -0
      man/figures/lifecycle-archived.svg
  12. +1
    -0
      man/figures/lifecycle-defunct.svg
  13. +1
    -0
      man/figures/lifecycle-deprecated.svg
  14. +1
    -0
      man/figures/lifecycle-experimental.svg
  15. +1
    -0
      man/figures/lifecycle-maturing.svg
  16. +1
    -0
      man/figures/lifecycle-questioning.svg
  17. +1
    -0
      man/figures/lifecycle-stable.svg
  18. +1
    -0
      man/figures/lifecycle-superseded.svg
  19. +1
    -1
      man/fragments/_fonts.Rmd
  20. +2
    -2
      man/fragments/_thanks.Rmd
  21. +1
    -1
      man/fragments/_themes.Rmd
  22. +1
    -1
      man/scale_xaringan.Rd
  23. +1
    -1
      man/style_solarized_dark.Rd
  24. +1
    -1
      man/style_solarized_light.Rd
  25. +1
    -1
      man/theme_xaringan.Rd
  26. +1
    -1
      man/theme_xaringan_base.Rd
  27. +1
    -1
      man/theme_xaringan_inverse.Rd
  28. +1
    -1
      man/theme_xaringan_set_defaults.Rd
  29. +1
    -1
      man/xaringanthemer-package.Rd
  30. +1
    -1
      vignettes/ggplot2-themes.Rmd

+ 2
- 2
DESCRIPTION Ver fichero

@@ -1,7 +1,7 @@
Type: Package
Package: xaringanthemer
Title: Custom 'xaringan' CSS Themes
Version: 0.3.0.9000
Version: 0.3.3
Authors@R:
person(given = "Garrick",
family = "Aden-Buie",
@@ -15,7 +15,7 @@ Description: Create beautifully color-coordinated and customized
your slides' 'R Markdown' source file or in a separate external
script.
License: MIT + file LICENSE
URL: https://pkg.garrickadenbuie.com/xaringanthemer,
URL: https://pkg.garrickadenbuie.com/xaringanthemer/,
https://github.com/gadenbuie/xaringanthemer
BugReports: https://github.com/gadenbuie/xaringanthemer/issues
Depends:

+ 10
- 4
NEWS.md Ver fichero

@@ -1,10 +1,16 @@
# xaringanthemer 0.3.0.9000
# xaringanthemer 0.3.3

- Add `inverse_link_color` to control color of links on inverse slides (thanks @dmi3kno, #44)
* Add `inverse_link_color` to control color of links on inverse slides
(thanks @dmi3kno, #44)

- .pull-right[] now clears floats just for its immediate sibling
* .pull-right[] now clears floats just for its immediate sibling

- Add `header_font_family_fallback` to control fallback fonts for headings (thanks @mattwarkentin, #41)
* Add `header_font_family_fallback` to control fallback fonts for headings
(thanks @mattwarkentin, #41)
* New xaringanthemer presentation skeleton with a kitchen sink of typical
slide elements with the goal of making it easier to preview new themes
during development.

# xaringanthemer 0.3.0


+ 5
- 5
R/ggplot2.R Ver fichero

@@ -3,7 +3,7 @@
#'
#' @description
#'
#' **Lifecycle:** [Maturing](https://www.tidyverse.org/lifecycle/#maturing)
#' `r lifecycle::badge("maturing")`
#'
#' Creates \pkg{ggplot2} themes to match the xaringanthemer theme used in the
#' \pkg{xaringan} slides that seamlessly matches the "normal" slide colors and
@@ -96,7 +96,7 @@ theme_xaringan <- function(
#'
#' @description
#'
#' **Lifecycle:** [Maturing](https://www.tidyverse.org/lifecycle/#maturing)
#' `r lifecycle::badge("maturing")`
#'
#' A \pkg{ggplot2} xaringanthemer plot theme to seamlessly match the "inverse"
#' \pkg{xaringan} slide colors and styles as styled by [xaringanthemer]. See
@@ -185,7 +185,7 @@ theme_xaringan_inverse <- function(
#'
#' @description
#'
#' **Lifecycle:** [Maturing](https://www.tidyverse.org/lifecycle/#maturing)
#' `r lifecycle::badge("maturing")`
#'
#' Provides a base plot theme for \pkg{ggplot2} to match the \pkg{xaringan}
#' slide theme created by [xaringanthemer]. The theme is designed to create a
@@ -380,7 +380,7 @@ theme_xaringan_base <- function(
#'
#' @description
#'
#' **Lifecycle:** [Maturing](https://www.tidyverse.org/lifecycle/#maturing)
#' `r lifecycle::badge("maturing")`
#'
#' Set \pkg{ggplot2} _geom_ defaults to match [theme_xaringan()] with
#' `theme_xaringan_set_defaults()` and restore the standard or previously-set
@@ -511,7 +511,7 @@ safely_set_geom <- function(geom, new) {
#'
#' @description
#'
#' **Lifecycle:** [Maturing](https://www.tidyverse.org/lifecycle/#maturing)
#' `r lifecycle::badge("maturing")`
#'
#' Color and fill single-color scales for discrete and continuous values,
#' created using the primary accent color of the xaringanthemer styles. See

+ 1
- 1
README.Rmd Ver fichero

@@ -21,7 +21,7 @@ library(xaringanthemer)

<!-- badges: start -->
[![CRAN status](https://www.r-pkg.org/badges/version/xaringanthemer)](https://CRAN.R-project.org/package=xaringanthemer)
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://www.tidyverse.org/lifecycle/#stable)
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html)
[![CI by {tic}](https://github.com/gadenbuie/xaringanthemer/workflows/tic/badge.svg?branch=master)](https://github.com/gadenbuie/xaringanthemer/actions)
[![Codecov](https://img.shields.io/codecov/c/github/gadenbuie/xaringanthemer)](https://codecov.io/github/gadenbuie/xaringanthemer)
<!-- badges: end -->

+ 1
- 1
README.md Ver fichero

@@ -8,7 +8,7 @@
[![CRAN
status](https://www.r-pkg.org/badges/version/xaringanthemer)](https://CRAN.R-project.org/package=xaringanthemer)
[![Lifecycle:
stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://www.tidyverse.org/lifecycle/#stable)
stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html)
[![CI by
{tic}](https://github.com/gadenbuie/xaringanthemer/workflows/tic/badge.svg?branch=master)](https://github.com/gadenbuie/xaringanthemer/actions)
[![Codecov](https://img.shields.io/codecov/c/github/gadenbuie/xaringanthemer)](https://codecov.io/github/gadenbuie/xaringanthemer)

+ 4
- 42
cran-comments.md Ver fichero

@@ -1,46 +1,8 @@
## Test environments
* local OS X install, R 3.6.2
* local OS X install, R 4.0.0
* local Ubuntu 18.04, R 3.6.3
* local Ubuntu 18.04, R 4.0.0
* win-builder (devel and release)
* Microsoft Windows Server 2019 (on GitHub Actions), R 3.6.3
* MacOS (release and devel, on GitHub Actions)
* Ubuntu 18.04 (on GitHub Action), R 3.6.3

## R CMD check results

0 errors | 0 warnings | 1 note

* This is a new release.

## Changes in this resubmission

> Package names are case sensitive. (in title:) --> 'xaringan'

The title was changed accordingly.

> Please do not modify the global environment (e.g. by using <<- or
> assign() without a specified environment) in your functions.

`assign()` is used but always with an explicit environment to ensure
that the global environment is not modified.

> Please make sure you do not write or download anything without the
> user's permission.

I've verified that all file outputs are consented, either by setting a function
argument to the path of an outfile or by prompt. In one case where a required
file needs to be downloaded, the user's consent is requested prior to the
download. If the user consents, the file is downloaded into the temp folder.

> Please make sure that you do not change the user's options, par or
> working directory.

The global options are not modified by any functions in the package. There are
a few places in the tests where options are temporarily modified for the test,
but the options are reverted when exiting the scope of the test.
0 errors | 0 warnings | 0 notes

> Missing Rd-tags: \value, \arguments
No reverse dependencies.

I've added the missing Rd tags in all files.
Replaces previous submission with corrected links
for three URLs that were moved to a new location.

+ 170
- 415
inst/rmarkdown/templates/xaringanthemer/skeleton/skeleton.Rmd Ver fichero

@@ -7,16 +7,27 @@ author:
date: '`r Sys.Date()`'
output:
xaringan::moon_reader:
lib_dir: libs
css: xaringan-themer.css
nature:
slideNumberFormat: "%current%"
highlightStyle: github
highlightLines: true
countIncrementalSlides: false
ratio: 16:9
countIncrementalSlides: true
---

```{r setup, include=FALSE}
options(htmltools.dir.version = FALSE)
knitr::opts_chunk$set(
fig.width=9, fig.height=3.5, fig.retina=3,
out.width = "100%",
cache = FALSE,
echo = TRUE,
message = FALSE,
warning = FALSE,
fig.show = TRUE,
hiline = TRUE
)
```

```{r xaringan-themer, include=FALSE, warning=FALSE}
@@ -28,548 +39,292 @@ style_duo_accent(
)
```

background-image: url(https://upload.wikimedia.org/wikipedia/commons/b/be/Sharingan_triple.svg)

???

Image credit: [Wikimedia Commons](https://commons.wikimedia.org/wiki/File:Sharingan_triple.svg)

---
class: center, middle

# xaringan

### /ʃæ.'riŋ.ɡæn/

---
class: inverse, center, middle

# Get Started

---

# Hello World

Install the **xaringan** package from [Github](https://github.com/yihui/xaringan):

```{r eval=FALSE, tidy=FALSE}
devtools::install_github("yihui/xaringan")
```

--
## Typography

You are recommended to use the [RStudio IDE](https://www.rstudio.com/products/rstudio/), but you do not have to.
Text can be **bold**, _italic_, ~~strikethrough~~, or `inline code`.

- Create a new R Markdown document from the menu `File -> New File -> R Markdown -> From Template -> Ninja Presentation`;<sup>1</sup>
[Link to another slide](#colors).

--
### Lorem Ipsum

- Click the `Knit` button to compile it;
--
Dolor imperdiet nostra sapien scelerisque praesent curae metus facilisis dignissim tortor.
Lacinia neque mollis nascetur neque urna velit bibendum.
Himenaeos suspendisse leo varius mus risus sagittis aliquet venenatis duis nec.

- or use the [RStudio Addin](https://rstudio.github.io/rstudioaddins/)<sup>2</sup> "Infinite Moon Reader" to live preview the slides (every time you update and save the Rmd document, the slides will be automatically reloaded in RStudio Viewer.
- Dolor cubilia nostra nunc sodales

.footnote[
[1] 中文用户请看[这份教程](http://slides.yihui.name/xaringan/zh-CN.html)
- Consectetur aliquet mauris blandit

[2] See [#2](https://github.com/yihui/xaringan/issues/2) if you do not see the template or addin in RStudio.
]
- Ipsum dis nec porttitor urna sed

---
background-image: url(`r xaringan:::karl`)
background-position: 50% 50%
class: center, bottom, inverse

# You only live once!
name: colors

---
## Colors

# Hello Ninja
- <span style="color: var(--text-color)">Text Color</span>

As a presentation ninja, you certainly should not be satisfied by the "Hello World" example. You need to understand more about two things:
- <span style="color: var(--header-color); font-family: var(--header-font-family);">Header Color</span>

1. The [remark.js](https://remarkjs.com) library;
- <span style="color: var(--link-color)">Link Color</span>

1. The **xaringan** package;
- <span style="color: var(--text-bold-color); font-weight: bold;">Bold Color</span>

Basically **xaringan** injected the chakra of R Markdown (minus Pandoc) into **remark.js**. The slides are rendered by remark.js in the web browser, and the Markdown source needed by remark.js is generated from R Markdown (**knitr**).
- `inline code color`

---

# remark.js
# Big Topic or Inverse Slides `#`

You can see an introduction of remark.js from [its homepage](https://remarkjs.com). You should read the [remark.js Wiki](https://github.com/gnab/remark/wiki) at least once to know how to
## Slide Headings `##`

- create a new slide (Markdown syntax<sup>*</sup> and slide properties);
### Sub-slide Headings `###`

- format a slide (e.g. text alignment);
#### Bold Call-Out `####`

- configure the slideshow;
This is a normal paragraph text. Only use header levels 1-4.

- and use the presentation (keyboard shortcuts).
##### Possible, but not recommended `#####`

It is important to be familiar with remark.js before you can understand the options in **xaringan**.

.footnote[[*] It is different with Pandoc's Markdown! It is limited but should be enough for presentation purposes. Come on... You do not need a slide for the Table of Contents! Well, the Markdown support in remark.js [may be improved](https://github.com/gnab/remark/issues/142) in the future.]
###### Definitely don't use h6 `######`

---
background-image: url(`r xaringan:::karl`)
background-size: cover
class: center, bottom, inverse

# I was so happy to have discovered remark.js!
class: inverse center middle

---
class: inverse, middle, center
# Topic Changing Interstitial

# Using xaringan

---

# xaringan

Provides an R Markdown output format `xaringan::moon_reader` as a wrapper for remark.js, and you can use it in the YAML metadata, e.g.
--

```yaml
---
title: "A Cool Presentation"
output:
xaringan::moon_reader
yolo: true
nature:
autoplay: 30000
---
```
See the help page `?xaringan::moon_reader` for all possible options that you can use.
class: inverse center middle
```

---
layout: true

# remark.js vs xaringan

Some differences between using remark.js (left) and using **xaringan** (right):

.pull-left[
1. Start with a boilerplate HTML file;

1. Plain Markdown;

1. Write JavaScript to autoplay slides;

1. Manually configure MathJax;

1. Highlight code with `*`;

1. Edit Markdown source and refresh browser to see updated slides;
]

.pull-right[
1. Start with an R Markdown document;

1. R Markdown (can embed R/other code chunks);

1. Provide an option `autoplay`;

1. MathJax just works;<sup>*</sup>

1. Highlight code with `{{}}`;

1. The RStudio addin "Infinite Moon Reader" automatically refreshes slides on changes;
]

.footnote[[*] Not really. See next page.]
## Blocks

---

# Math Expressions

You can write LaTeX math expressions inside a pair of dollar signs, e.g. &#36;\alpha+\beta$ renders $\alpha+\beta$. You can use the display style with double dollar signs:

```
$$\bar{X}=\frac{1}{n}\sum_{i=1}^nX_i$$
```
### Blockquote

$$\bar{X}=\frac{1}{n}\sum_{i=1}^nX_i$$

Limitations:

1. The source code of a LaTeX math expression must be in one line, unless it is inside a pair of double dollar signs, in which case the starting `$$` must appear in the very beginning of a line, followed immediately by a non-space character, and the ending `$$` must be at the end of a line, led by a non-space character;

1. There should not be spaces after the opening `$` or before the closing `$`.

1. Math does not work on the title slide (see [#61](https://github.com/yihui/xaringan/issues/61) for a workaround).
> This is a blockquote following a header.
>
> When something is important enough, you do it even if the odds are not in your favor.

---

# R Code
### Code Blocks

```{r comment='#'}
# a boring regression
fit = lm(dist ~ 1 + speed, data = cars)
coef(summary(fit))
dojutsu = c('地爆天星', '天照', '加具土命', '神威', '須佐能乎', '無限月読')
grep('天', dojutsu, value = TRUE)
```
#### R Code

---

# R Plots

```{r cars, fig.height=4, dev='svg'}
par(mar = c(4, 4, 1, .1))
plot(cars, pch = 19, col = 'darkgray', las = 1)
abline(fit, lwd = 2)
```{r eval=FALSE}
ggplot(gapminder) +
aes(x = gdpPercap, y = lifeExp, size = pop, color = country) +
geom_point() +
facet_wrap(~year)
```

---

# Tables

If you want to generate a table, make sure it is in the HTML format (instead of Markdown or other formats), e.g.,
#### JavaScript

```{r}
knitr::kable(head(mtcars), format = 'html')
```js
var fun = function lang(l) {
dateformat.i18n = require('./lang/' + l)
return true;
}
```

---

# HTML Widgets

I have not thoroughly tested HTML widgets against **xaringan**. Some may work well, and some may not. It is a little tricky.

Similarly, the Shiny mode (`runtime: shiny`) does not work. I might get these issues fixed in the future, but these are not of high priority to me. I never turn my presentation into a Shiny app. When I need to demonstrate more complicated examples, I just launch them separately. It is convenient to share slides with other people when they are plain HTML/JS applications.
### More R Code

See the next page for two HTML widgets.

---

```{r out.width='100%', fig.height=6, eval=require('leaflet')}
library(leaflet)
leaflet() %>% addTiles() %>% setView(-93.65, 42.0285, zoom = 17)
```{r eval=FALSE}
dplyr::starwars %>% dplyr::slice_sample(n = 4)
```

---

```{r eval=require('DT'), tidy=FALSE}
DT::datatable(
mtcars[1:6, 1:6],
fillContainer = FALSE, options = list(pageLength = 8)
)
```{r message=TRUE}
cli::cli_alert_success("It worked!")
```

---

# Some Tips

- When you use the "Infinite Moon Reader" addin in RStudio, your R session will be blocked by default. You can click the red button on the right of the console to stop serving the slides, or use the _daemonized_ mode so that it does not block your R session. To do the latter, you can set the option

```r
options(servr.daemon = TRUE)
```
in your current R session, or in `~/.Rprofile` so that it is applied to all future R sessions. I do the latter by myself.
To know more about the web server, see the [**servr**](https://github.com/yihui/servr) package.

--

- Do not forget to try the `yolo` option of `xaringan::moon_reader`.

```yaml
output:
xaringan::moon_reader:
yolo: true
```

---

# Some Tips
```{r message=TRUE}
message("Just a friendly message")
```

- Slides can be automatically played if you set the `autoplay` option under `nature`, e.g. go to the next slide every 30 seconds in a lightning talk:
--

```yaml
output:
xaringan::moon_reader:
nature:
autoplay: 30000
```
```{r warning=TRUE}
warning("This could be bad...")
```

--

- A countdown timer can be added to every page of the slides using the `countdown` option under `nature`, e.g. if you want to spend one minute on every page when you give the talk, you can set:

```yaml
output:
xaringan::moon_reader:
nature:
countdown: 60000
```
```{r error=TRUE}
stop("I hope you're sitting down for this")
```

Then you will see a timer counting down from `01:00`, to `00:59`, `00:58`, ... When the time is out, the timer will continue but the time turns red.

---
layout: true

# Some Tips

- There are several ways to build incremental slides. See [this presentation](https://slides.yihui.name/xaringan/incremental.html) for examples.

- The option `highlightLines: true` of `nature` will highlight code lines that start with `*`, or are wrapped in `{{ }}`, or have trailing comments `#<<`;

```yaml
output:
xaringan::moon_reader:
nature:
highlightLines: true
```

See examples on the next page.
## Tables

---

# Some Tips


.pull-left[
An example using a leading `*`:

```r
if (TRUE) {
** message("Very important!")
}
```
Output:
```r
if (TRUE) {
* message("Very important!")
}
```

This is invalid R code, so it is a plain fenced code block that is not executed.
]

.pull-right[
An example using `{{}}`:

`r ''````{r tidy=FALSE}
if (TRUE) {
*{{ message("Very important!") }}
}
```
Output:
```{r tidy=FALSE}
if (TRUE) {
{{ message("Very important!") }}
}
```{r}
tibble::as_tibble(mtcars)
```

It is valid R code so you can run it. Note that `{{}}` can wrap an R expression of multiple lines.
]

---

# Some Tips

An example of using the trailing comment `#<<` to highlight lines:

````markdown
`r ''````{r tidy=FALSE}
library(ggplot2)
ggplot(mtcars) +
aes(mpg, disp) +
geom_point() + #<<
geom_smooth() #<<
```{r}
knitr::kable(head(mtcars), format = 'html')
```
````

Output:
---

```{r tidy=FALSE, eval=FALSE}
library(ggplot2)
ggplot(mtcars) +
aes(mpg, disp) +
geom_point() + #<<
geom_smooth() #<<
```{r}
DT::datatable(head(mtcars), fillContainer = FALSE, options = list(pageLength = 4))
```

---
layout: true

# Some Tips

- To make slides work offline, you need to download a copy of remark.js in advance, because **xaringan** uses the online version by default (see the help page `?xaringan::moon_reader`).

- You can use `xaringan::summon_remark()` to download the latest or a specified version of remark.js. By default, it is downloaded to `libs/remark-latest.min.js`.

- Then change the `chakra` option in YAML to point to this file, e.g.

```yaml
output:
xaringan::moon_reader:
chakra: libs/remark-latest.min.js
```

- If you used Google fonts in slides (the default theme uses _Yanone Kaffeesatz_, _Droid Serif_, and _Source Code Pro_), they won't work offline unless you download or install them locally. The Heroku app [google-webfonts-helper](https://google-webfonts-helper.herokuapp.com/fonts) can help you download fonts and generate the necessary CSS.
## Lists

---

# Macros

- remark.js [allows users to define custom macros](https://github.com/yihui/xaringan/issues/80) (JS functions) that can be applied to Markdown text using the syntax `![:macroName arg1, arg2, ...]` or `![:macroName arg1, arg2, ...](this)`. For example, before remark.js initializes the slides, you can define a macro named `scale`:
.pull-left[
#### Here is an unordered list:

```js
remark.macros.scale = function (percentage) {
var url = this;
return '<img src="' + url + '" style="width: ' + percentage + '" />';
};
```
* Item foo
* Item bar
* Item baz
* Item zip
]

Then the Markdown text
.pull-right[

```markdown
![:scale 50%](image.jpg)
```
#### And an ordered list:

will be translated to
```html
<img src="image.jpg" style="width: 50%" />
```
1. Item one
1. Item two
1. Item three
1. Item four
]

---

# Macros (continued)
### And a nested list:

- To insert macros in **xaringan** slides, you can use the option `beforeInit` under the option `nature`, e.g.,

```yaml
output:
xaringan::moon_reader:
nature:
beforeInit: "macros.js"
```

You save your remark.js macros in the file `macros.js`.

- The `beforeInit` option can be used to insert arbitrary JS code before `remark.create()`. Inserting macros is just one of its possible applications.
- level 1 item
- level 2 item
- level 2 item
- level 3 item
- level 3 item
- level 1 item
- level 2 item
- level 2 item
- level 2 item
- level 1 item
- level 2 item
- level 2 item
- level 1 item

---

# CSS
### Nesting an ol in ul in an ol

Among all options in `xaringan::moon_reader`, the most challenging but perhaps also the most rewarding one is `css`, because it allows you to customize the appearance of your slides using any CSS rules or hacks you know.

You can see the default CSS file [here](https://github.com/yihui/xaringan/blob/master/inst/rmarkdown/templates/xaringan/resources/default.css). You can completely replace it with your own CSS files, or define new rules to override the default. See the help page `?xaringan::moon_reader` for more information.
- level 1 item (ul)
1. level 2 item (ol)
1. level 2 item (ol)
- level 3 item (ul)
- level 3 item (ul)
- level 1 item (ul)
1. level 2 item (ol)
1. level 2 item (ol)
- level 3 item (ul)
- level 3 item (ul)
1. level 4 item (ol)
1. level 4 item (ol)
- level 3 item (ul)
- level 3 item (ul)
- level 1 item (ul)

---
layout: true

# CSS

For example, suppose you want to change the font for code from the default "Source Code Pro" to "Ubuntu Mono". You can create a CSS file named, say, `ubuntu-mono.css`:

```css
@import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic);

.remark-code, .remark-inline-code { font-family: 'Ubuntu Mono'; }
```

Then set the `css` option in the YAML metadata:

```yaml
output:
xaringan::moon_reader:
css: ["default", "ubuntu-mono.css"]
```

Here I assume `ubuntu-mono.css` is under the same directory as your Rmd.

See [yihui/xaringan#83](https://github.com/yihui/xaringan/issues/83) for an example of using the [Fira Code](https://github.com/tonsky/FiraCode) font, which supports ligatures in program code.
## Plots

---

# Themes

Don't want to learn CSS? Okay, you can use some user-contributed themes. A theme typically consists of two CSS files `foo.css` and `foo-fonts.css`, where `foo` is the theme name. Below are some existing themes:

```{r}
names(xaringan:::list_css())
```

To use a theme, you can specify the `css` option as an array of CSS filenames (without the `.css` extensions), e.g.,

```yaml
output:
xaringan::moon_reader:
css: [default, metropolis, metropolis-fonts]
```{r plot-example}
library(ggplot2)
(g <- ggplot(mpg) + aes(hwy, cty, color = class) + geom_point())
```

If you want to contribute a theme to **xaringan**, please read [this blog post](https://yihui.name/en/2017/10/xaringan-themes).

---
class: inverse, middle, center
background-image: url(https://upload.wikimedia.org/wikipedia/commons/3/39/Naruto_Shiki_Fujin.svg)
background-size: contain

# Naruto
```{r plot-example-themed}
g + xaringanthemer::theme_xaringan(text_font_size = 16, title_font_size = 18) +
ggtitle("A Plot About Cars")
```

---
background-image: url(https://upload.wikimedia.org/wikipedia/commons/b/be/Sharingan_triple.svg)
background-size: 100px
background-position: 90% 8%

# Sharingan

The R package name **xaringan** was derived<sup>1</sup> from **Sharingan**, a dōjutsu in the Japanese anime _Naruto_ with two abilities:
layout: false

- the "Eye of Insight"
## Square image

- the "Eye of Hypnotism"
<center><img src="https://octodex.github.com/images/labtocat.png" height="400px" /></center>

I think a presentation is basically a way to communicate insights to the audience, and a great presentation may even "hypnotize" the audience.<sup>2,3</sup>

.footnote[
[1] In Chinese, the pronounciation of _X_ is _Sh_ /ʃ/ (as in _shrimp_). Now you should have a better idea of how to pronounce my last name _Xie_.

[2] By comparison, bad presentations only put the audience to sleep.

[3] Personally I find that setting background images for slides is a killer feature of remark.js. It is an effective way to bring visual impact into your presentations.
]
.footnote[GitHub Octocat]

---

# Naruto terminology

The **xaringan** package borrowed a few terms from Naruto, such as
### Wide image

- [Sharingan](http://naruto.wikia.com/wiki/Sharingan) (写輪眼; the package name)
![](https://guides.github.com/activities/hello-world/branching.png)

- The [moon reader](http://naruto.wikia.com/wiki/Moon_Reader) (月読; an attractive R Markdown output format)
.footnote[Wide images scale to 100% slide width]

- [Chakra](http://naruto.wikia.com/wiki/Chakra) (查克拉; the path to the remark.js library, which is the power to drive the presentation)

- [Nature transformation](http://naruto.wikia.com/wiki/Nature_Transformation) (性質変化; transform the chakra by setting different options)
---

- The [infinite moon reader](http://naruto.wikia.com/wiki/Infinite_Tsukuyomi) (無限月読; start a local web server to continuously serve your slides)
## Two images

- The [summoning technique](http://naruto.wikia.com/wiki/Summoning_Technique) (download remark.js from the web)
.pull-left[
![](https://octodex.github.com/images/motherhubbertocat.png)
]

You can click the links to know more about them if you want. The jutsu "Moon Reader" may seem a little evil, but that does not mean your slides are evil.
.pull-right[
![](https://octodex.github.com/images/dinotocat.png)
]

---

class: center

# Hand seals (印)

Press `h` or `?` to see the possible ninjutsu you can use in remark.js.
### Definition lists can be used with HTML syntax.

![](https://upload.wikimedia.org/wikipedia/commons/7/7e/Mudra-Naruto-KageBunshin.svg)
<dl>
<dt>Name</dt>
<dd>Godzilla</dd>
<dt>Born</dt>
<dd>1952</dd>
<dt>Birthplace</dt>
<dd>Japan</dd>
<dt>Color</dt>
<dd>Green</dd>
</dl>

---

class: center, middle

# Thanks!

Slides created via the R package [**xaringan**](https://github.com/yihui/xaringan).
Slides created via the R packages:

[**xaringan**](https://github.com/yihui/xaringan)<br>
[gadenbuie/xaringanthemer](https://github.com/gadenbuie/xaringanthemer)

The chakra comes from [remark.js](https://remarkjs.com), [**knitr**](http://yihui.name/knitr), and [R Markdown](https://rmarkdown.rstudio.com).

+ 3
- 0
make.R Ver fichero

@@ -11,5 +11,8 @@ unlink("README.html")
message("Checking package")
devtools::check(document = FALSE)

message("Checking urls")
urlchecker::url_check()

message("Building and Installing Package with Vignettes")
devtools::install(build_vignettes = TRUE)

+ 1
- 1
man-roxygen/style_solarized_dark.R Ver fichero

@@ -2,7 +2,7 @@
#' @description A dark theme based around on the solarized color scheme.
#' Works well with "\code{highlightStyle: solarized-dark}" or
#' "\code{highlighStyle: solarized-light}".
#' @references \url{http://ethanschoonover.com/solarized}
#' @references \url{https://ethanschoonover.com/solarized/}
#' @examples
#' # Create a xaringan style in a temporary file
#' xaringan_themer_css <- tempfile("xaringan-themer-", fileext = ".css")

+ 1
- 1
man-roxygen/style_solarized_light.R Ver fichero

@@ -2,7 +2,7 @@
#' @description A light theme based around on the solarized color scheme.
#' Works well with "\code{highlightStyle: solarized-dark}" or
#' "\code{highlighStyle: solarized-light}".
#' @references \url{http://ethanschoonover.com/solarized}
#' @references \url{https://ethanschoonover.com/solarized/}
#' @examples
#' # Create a xaringan style in a temporary file
#' xaringan_themer_css <- tempfile("xaringan-themer-", fileext = ".css")

+ 1
- 0
man/figures/lifecycle-archived.svg Ver fichero

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="110" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="110" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h53v20H0z"/><path fill="#e05d44" d="M53 0h57v20H53z"/><path fill="url(#b)" d="M0 0h110v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"> <text x="275" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">lifecycle</text><text x="275" y="140" transform="scale(.1)" textLength="430">lifecycle</text><text x="805" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="470">archived</text><text x="805" y="140" transform="scale(.1)" textLength="470">archived</text></g> </svg>

+ 1
- 0
man/figures/lifecycle-defunct.svg Ver fichero

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="104" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="104" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h53v20H0z"/><path fill="#e05d44" d="M53 0h51v20H53z"/><path fill="url(#b)" d="M0 0h104v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><text x="275" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">lifecycle</text><text x="275" y="140" transform="scale(.1)" textLength="430">lifecycle</text><text x="775" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="410">defunct</text><text x="775" y="140" transform="scale(.1)" textLength="410">defunct</text></g> </svg>

+ 1
- 0
man/figures/lifecycle-deprecated.svg Ver fichero

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="124" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="124" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h53v20H0z"/><path fill="#fe7d37" d="M53 0h71v20H53z"/><path fill="url(#b)" d="M0 0h124v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><text x="275" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">lifecycle</text><text x="275" y="140" transform="scale(.1)" textLength="430">lifecycle</text><text x="875" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="610">deprecated</text><text x="875" y="140" transform="scale(.1)" textLength="610">deprecated</text></g> </svg>

+ 1
- 0
man/figures/lifecycle-experimental.svg Ver fichero

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="136" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="136" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h53v20H0z"/><path fill="#fe7d37" d="M53 0h83v20H53z"/><path fill="url(#b)" d="M0 0h136v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><text x="275" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">lifecycle</text><text x="275" y="140" transform="scale(.1)" textLength="430">lifecycle</text><text x="935" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="730">experimental</text><text x="935" y="140" transform="scale(.1)" textLength="730">experimental</text></g> </svg>

+ 1
- 0
man/figures/lifecycle-maturing.svg Ver fichero

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="114" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="114" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h53v20H0z"/><path fill="#007ec6" d="M53 0h61v20H53z"/><path fill="url(#b)" d="M0 0h114v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><text x="275" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">lifecycle</text><text x="275" y="140" transform="scale(.1)" textLength="430">lifecycle</text><text x="825" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="510">maturing</text><text x="825" y="140" transform="scale(.1)" textLength="510">maturing</text></g> </svg>

+ 1
- 0
man/figures/lifecycle-questioning.svg Ver fichero

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="126" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="126" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h53v20H0z"/><path fill="#007ec6" d="M53 0h73v20H53z"/><path fill="url(#b)" d="M0 0h126v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><text x="275" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">lifecycle</text><text x="275" y="140" transform="scale(.1)" textLength="430">lifecycle</text><text x="885" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="630">questioning</text><text x="885" y="140" transform="scale(.1)" textLength="630">questioning</text></g> </svg>

+ 1
- 0
man/figures/lifecycle-stable.svg Ver fichero

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="96" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="96" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h53v20H0z"/><path fill="#4c1" d="M53 0h43v20H53z"/><path fill="url(#b)" d="M0 0h96v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><text x="275" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">lifecycle</text><text x="275" y="140" transform="scale(.1)" textLength="430">lifecycle</text><text x="735" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="330">stable</text><text x="735" y="140" transform="scale(.1)" textLength="330">stable</text></g> </svg>

+ 1
- 0
man/figures/lifecycle-superseded.svg Ver fichero

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="128" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h55v20H0z"/><path fill="#007ec6" d="M55 0h73v20H55z"/><path fill="url(#b)" d="M0 0h128v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"> <text x="285" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="450">lifecycle</text><text x="285" y="140" transform="scale(.1)" textLength="450">lifecycle</text><text x="905" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="630">superseded</text><text x="905" y="140" transform="scale(.1)" textLength="630">superseded</text></g> </svg>

+ 1
- 1
man/fragments/_fonts.Rmd Ver fichero

@@ -45,7 +45,7 @@ _Droid Serif_,
is no longer officially included in Google Fonts.

If you would like to use the fonts from the
[default xaringan theme](https://slides.yihui.name/xaringan/),
[default xaringan theme](https://slides.yihui.org/xaringan/),
you can use the following arguments in your style function.

```{r eval=FALSE, echo=TRUE}

+ 2
- 2
man/fragments/_thanks.Rmd Ver fichero

@@ -5,8 +5,8 @@

**xaringanthemer** was built by [Garrick Aden-Buie](https://www.garrickadenbuie.com) ([&commat;grrrck](https://twitter.com/grrrck)).

Big thank you to [Yihui Xie](https://yihui.name), especially for [xaringan].
Also thanks to [Ole Petter Bang](http://gnab.org) for [remark.js][remarkjs].
Big thank you to [Yihui Xie](https://yihui.org), especially for [xaringan].
Also thanks to [Ole Petter Bang](http://www.gnab.org/) for [remark.js][remarkjs].

Feel free to [file an issue](https://github.com/gadenbuie/xaringanthemer/issues)
if you find a bug or have a theme suggestion -- or better yet, submit a pull request!

+ 1
- 1
man/fragments/_themes.Rmd Ver fichero

@@ -119,7 +119,7 @@ demo_function_call(style_duo_accent_inverse, 2)

### Solarized

There are also two themes based around the [solarized color palette](http://ethanschoonover.com/solarized), `style_solarized_light()` and `style_solarized_dark()`.
There are also two themes based around the [solarized color palette](https://ethanschoonover.com/solarized/), `style_solarized_light()` and `style_solarized_dark()`.
For both themes, it is advisted to change the syntax highlighting theme to `solarized-light` or `solarized-dark` (looks great paired or constrasted).

#### `style_solarized_light()`

+ 1
- 1
man/scale_xaringan.Rd Ver fichero

@@ -96,7 +96,7 @@ value of \code{inverse_header_color}}
\item{end}{Number in the range of \code{[0, 1]} indicating to which point in the color scale the largest data value should be mapped.}
}
\description{
\strong{Lifecycle:} \href{https://www.tidyverse.org/lifecycle/#maturing}{Maturing}
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#maturing}{\figure{lifecycle-maturing.svg}{options: alt='[Maturing]'}}}{\strong{[Maturing]}}

Color and fill single-color scales for discrete and continuous values,
created using the primary accent color of the xaringanthemer styles. See

+ 1
- 1
man/style_solarized_dark.Rd Ver fichero

@@ -442,7 +442,7 @@ style_solarized_dark(
# file.edit(xaringan_themer_css)
}
\references{
\url{http://ethanschoonover.com/solarized}
\url{https://ethanschoonover.com/solarized/}
}
\seealso{
Other themes:

+ 1
- 1
man/style_solarized_light.Rd Ver fichero

@@ -442,7 +442,7 @@ style_solarized_light(
# file.edit(xaringan_themer_css)
}
\references{
\url{http://ethanschoonover.com/solarized}
\url{https://ethanschoonover.com/solarized/}
}
\seealso{
Other themes:

+ 1
- 1
man/theme_xaringan.Rd Ver fichero

@@ -72,7 +72,7 @@ not available locally.}
A ggplot2 theme
}
\description{
\strong{Lifecycle:} \href{https://www.tidyverse.org/lifecycle/#maturing}{Maturing}
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#maturing}{\figure{lifecycle-maturing.svg}{options: alt='[Maturing]'}}}{\strong{[Maturing]}}

Creates \pkg{ggplot2} themes to match the xaringanthemer theme used in the
\pkg{xaringan} slides that seamlessly matches the "normal" slide colors and

+ 1
- 1
man/theme_xaringan_base.Rd Ver fichero

@@ -69,7 +69,7 @@ not available locally.}
A ggplot2 theme
}
\description{
\strong{Lifecycle:} \href{https://www.tidyverse.org/lifecycle/#maturing}{Maturing}
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#maturing}{\figure{lifecycle-maturing.svg}{options: alt='[Maturing]'}}}{\strong{[Maturing]}}

Provides a base plot theme for \pkg{ggplot2} to match the \pkg{xaringan}
slide theme created by \link{xaringanthemer}. The theme is designed to create a

+ 1
- 1
man/theme_xaringan_inverse.Rd Ver fichero

@@ -72,7 +72,7 @@ not available locally.}
A ggplot2 theme
}
\description{
\strong{Lifecycle:} \href{https://www.tidyverse.org/lifecycle/#maturing}{Maturing}
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#maturing}{\figure{lifecycle-maturing.svg}{options: alt='[Maturing]'}}}{\strong{[Maturing]}}

A \pkg{ggplot2} xaringanthemer plot theme to seamlessly match the "inverse"
\pkg{xaringan} slide colors and styles as styled by \link{xaringanthemer}. See

+ 1
- 1
man/theme_xaringan_set_defaults.Rd Ver fichero

@@ -37,7 +37,7 @@ Invisibly returns a list of the current ggplot2 geom defaults
Invisibly returns a list of the current ggplot2 geom defaults
}
\description{
\strong{Lifecycle:} \href{https://www.tidyverse.org/lifecycle/#maturing}{Maturing}
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#maturing}{\figure{lifecycle-maturing.svg}{options: alt='[Maturing]'}}}{\strong{[Maturing]}}

Set \pkg{ggplot2} \emph{geom} defaults to match \code{\link[=theme_xaringan]{theme_xaringan()}} with
\code{theme_xaringan_set_defaults()} and restore the standard or previously-set

+ 1
- 1
man/xaringanthemer-package.Rd Ver fichero

@@ -18,7 +18,7 @@ Create beautifully color-coordinated and customized
\seealso{
Useful links:
\itemize{
\item \url{https://pkg.garrickadenbuie.com/xaringanthemer}
\item \url{https://pkg.garrickadenbuie.com/xaringanthemer/}
\item \url{https://github.com/gadenbuie/xaringanthemer}
\item Report bugs at \url{https://github.com/gadenbuie/xaringanthemer/issues}
}

+ 1
- 1
vignettes/ggplot2-themes.Rmd Ver fichero

@@ -345,7 +345,7 @@ in the xaringanthemer package.

```{r eval=FALSE}
font_url <- file.path(
"https://fontlibrary.org/assets/fonts/glacial-indifference",
"https://fontlibrary.org/assets/fonts/glacial-indifference/",
"5f2cf277506e19ec77729122f27b1faf/0820b3c58fed35de298219f314635982",
"GlacialIndifferenceRegular.ttf"
)

Cargando…
Cancelar
Guardar