revealjs
- essentially the replacement for xaringan
, but with Pandoc-native syntaxbeamer
for LaTex slidesrevealjs
reveal.js is an open source HTML presentation framework. It’s a tool that enables anyone with a web browser to create fully-featured and beautiful presentations for free.
revealjs
for Quarto is a framework for turning Pandoc-friendly markdown + code into beautiful slides
User guide: https://quarto.org/docs/presentations/revealjs/
---
format: revealjs
---
## Step 1
- Split slides up with level 2 headers: `## Heading 2`
- Add some markdown + text and/or some R/Python code
## Step 2
- quarto render
## Step 3
- Profit
materials/workshop/05-presentations/revealjs-penguins.qmd
---
format:
revealjs:
slide-number: c/t
width: 1600
height: 900
logo: "https://www.rstudio.com/wp-content/uploads/2018/10/RStudio-Logo-Flat.png"
footer: "[Get started with Quarto](https://rstudio-conf-2022.github.io/get-started-quarto/)"
css: ["theme/theme.css"]
theme: simple
echo: true
---
Transition | Description |
---|---|
none |
No transition (switch instantly) |
fade |
Cross fade |
slide |
Slide horizontally |
convex |
Slide at a convex angle |
concave |
Slide at a concave angle |
zoom |
Scale the incoming slide so it grows in from the center of the screen. |
width |
The “normal” width of the presentation, aspect ratio will be preserved when the presentation is scaled to fit different resolutions. Can be specified using percentage units. |
---|---|
height |
The “normal” height of the presentation, aspect ratio will be preserved when the presentation is scaled to fit different resolutions. Can be specified using percentage units. |
slide-number |
Display the page number of the current slide
Can optionally be set as a string that specifies the number formatting:
|
revealjs
presentations will open up as a “background job” in the Presentation tab.revealjs
Quarto presentationrevealjs
vs xaringan
xaringan
for RMarkdown uses only knitr
and remark.js
, without Pandoc and with some Pandoc-incompatabilitiesrevealjs
was a lesser known RMarkdown package, but is the primary HTML slide generator for QuartoIf you loved xaringan
, you’ll love revealjs
!
Unlike xaringan
, Quarto + revealjs
can be edited with the RStudio Visual Editor!
Level 2 header = new slide
Level 1 header = new slide and new section
---
can also delineate slides via horizontal rules or leave the heading “blank” for untitled slides::: {.class}
<SOME CONTENT>
:::
Some text with a specific [span]{.span-class}
-
or *
or 1.
Incrementally reveal elements with:
::: {.incremental}
- First item
- Second item
:::
Or turn it off for specific lists
::: {.nonincremental}
- 1st Item
- 2nd Item
:::
Not limited to just bullet points…
Use . . .
syntax to indicate a break at an arbitrary location
mpg cyl disp hp drat wt qsec vs am gear carb
Mazda RX4 21.0 6 160 110 3.90 2.620 16.46 0 1 4 4
Mazda RX4 Wag 21.0 6 160 110 3.90 2.875 17.02 0 1 4 4
Datsun 710 22.8 4 108 93 3.85 2.320 18.61 1 1 4 1
Hornet 4 Drive 21.4 6 258 110 3.08 3.215 19.44 1 0 3 1
Hornet Sportabout 18.7 8 360 175 3.15 3.440 17.02 0 0 3 2
Valiant 18.1 6 225 105 2.76 3.460 20.22 1 0 3 1
You can also make a point with fragments
Fade in
Fade out
Highlight red
Fade in, then out
Slide up while fading in
::: {.fragment}
Fade in
:::
::: {.fragment .fade-out}
Fade out
:::
::: {.fragment .highlight-red}
Highlight red
:::
::: {.fragment .fade-in-then-out}
Fade in, then out
:::
::: {.fragment .fade-up}
Slide up while fading in
:::
Fragments can be nested to affect the same “text” multiple times
Fade in > Turn red > Semi fade out
::: {.fragment .fade-in}
::: {.fragment .highlight-red}
::: {.fragment .semi-fade-out}
Fade in > Turn red > Semi fade out
:::
:::
:::
This is an important sentence!
This is an [important sentence!]{.fragment .highlight-red}
Mind the gap when riding the rail!
Mind the [gap]{.fragment .fade-in} when riding the rail!
Appears last
Appears first
Appears second
::: {.fragment fragment-index=3}
Appears last
:::
::: {.fragment fragment-index=1}
Appears first
:::
::: {.fragment fragment-index=2}
Appears second
:::
materials/workshop/05-presentation/fragments.qmd
:::: {.columns}
::: {.column width="40%"}
contents...
:::
::: {.column width="60%"}
contents...
:::
::::
On the left
On the right
Rows: 32
Columns: 11
$ mpg <dbl> 21.0, 21.0, 22.8, 21.4, 18.7, 18.1, 14.3, 24.4, 22.8, 19.2, 17.8,…
$ cyl <dbl> 6, 6, 4, 6, 8, 6, 8, 4, 4, 6, 6, 8, 8, 8, 8, 8, 8, 4, 4, 4, 4, 8,…
$ disp <dbl> 160.0, 160.0, 108.0, 258.0, 360.0, 225.0, 360.0, 146.7, 140.8, 16…
$ hp <dbl> 110, 110, 93, 110, 175, 105, 245, 62, 95, 123, 123, 180, 180, 180…
$ drat <dbl> 3.90, 3.90, 3.85, 3.08, 3.15, 2.76, 3.21, 3.69, 3.92, 3.92, 3.92,…
$ wt <dbl> 2.620, 2.875, 2.320, 3.215, 3.440, 3.460, 3.570, 3.190, 3.150, 3.…
$ qsec <dbl> 16.46, 17.02, 18.61, 19.44, 17.02, 20.22, 15.84, 20.00, 22.90, 18…
$ vs <dbl> 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0,…
$ am <dbl> 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0,…
$ gear <dbl> 4, 4, 4, 3, 3, 3, 3, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 4, 4, 4, 3, 3,…
$ carb <dbl> 4, 4, 1, 1, 2, 1, 4, 2, 2, 4, 4, 3, 3, 3, 4, 4, 4, 1, 2, 1, 1, 2,…
column-fragment
column
fragment
slide
slide
If you try . . .
syntax WITH ::: {.columns}
- it won’t be incremental… BUT:
mpg cyl disp hp drat wt qsec vs am gear carb
Mazda RX4 21.0 6 160 110 3.90 2.620 16.46 0 1 4 4
Mazda RX4 Wag 21.0 6 160 110 3.90 2.875 17.02 0 1 4 4
Datsun 710 22.8 4 108 93 3.85 2.320 18.61 1 1 4 1
Hornet 4 Drive 21.4 6 258 110 3.08 3.215 19.44 1 0 3 1
Hornet Sportabout 18.7 8 360 175 3.15 3.440 17.02 0 0 3 2
Valiant 18.1 6 225 105 2.76 3.460 20.22 1 0 3 1
You can nest .incremental
+ .fragment
to get your expected behavior.
::: {.columns}
and use .fragment
tags on the columns for incremental reveal of those columns![](images/boston-sleep.png){fig-align="center"}
![](images/boston-sleep.png)
Incremental reveal of images/content
::: {.r-stack}
![](image1.png){.fragment width="450"}
![](image2.png){.fragment width="400"}
![](image3.png){.fragment width="300"}
:::
ATTENTION
{.r-fit-text}
::: {.r-fit-text}
Attention
:::
{.r-stretch}
Fit to the remaining space - this is the default behavior in revealjs
![](images/howard-glamour.jpg){.r-stretch}
---
format: revealjs
title: Hello Quarto
subtitle: Slides with revealjs
author: <a href="https://themockup.blog">Tom Mock</a>
date: 2022-07-11
institute: RStudio
title-slide-attributes:
data-background-image: images/paper-texture.jpg
data-background-size: cover
---
# {background-image="images/paper-texture.jpg" background-size="cover"}
:::{style="text-align: center;"}
<h1>Hello Quarto</h1>
<img src="images/headshot.jpeg" style="border-radius: 50%; border:10px solid #447099;" width="250px"/>
<h2>Tom Mock, RStudio</h2>
:::
format: revealjs
footer: <https://quarto.org/>
logo: https://www.rstudio.com/wp-content/uploads/2018/10/RStudio-Logo-Flat.png
A footer can also be set by slide with:
::: {.footer}
<https://themockup.blog>
:::
::: {style="text-align: right;"}
<h2>Right aligned!</h2>
- Some bullets
- Another bullet
:::
## Slide backgrounds, color {background-color="blue"}
## Slide backgrounds, images {background-image="images/howard-table.png" background-size="cover"}
Note, you may need to set a background-color
to black/white to “force” the text to contrast.
Attribute | Default | Description |
---|---|---|
background-image |
URL of the image to show. GIFs restart when the slide opens. | |
background-size |
cover | See background-size on MDN. |
background-position |
center | See background-position on MDN. |
background-repeat |
no-repeat | See background-repeat on MDN. |
background-opacity |
1 | Opacity of the background image on a 0-1 scale. 0 is transparent and 1 is fully opaque. |
::: {.panel-tabset}
## Element 1
## Element 2
:::
mpg cyl disp hp drat wt qsec vs am gear carb
Mazda RX4 21.0 6 160 110 3.90 2.620 16.46 0 1 4 4
Mazda RX4 Wag 21.0 6 160 110 3.90 2.875 17.02 0 1 4 4
Datsun 710 22.8 4 108 93 3.85 2.320 18.61 1 1 4 1
Hornet 4 Drive 21.4 6 258 110 3.08 3.215 19.44 1 0 3 1
Hornet Sportabout 18.7 8 360 175 3.15 3.440 17.02 0 0 3 2
Valiant 18.1 6 225 105 2.76 3.460 20.22 1 0 3 1
Footnotes in presentations are placed at the bottom of the slide and numbered.
For example, did you know that Howard is a dog^[Specifically he is a Boston Terrier, although sometimes he acts like a cat]?
For example, did you know that Howard is a dog1?
He also likes to sleep2
Asides are like footnotes, but don’t have numbers1.
::: aside
They are placed above footnotes if footnotes are present on the page
:::
revealjs
presentationUse #| code-line-numbers: "3"
syntax - will highlight line and fade other lines
Sometimes you want to make a point though…
And I often want to “walk through” a set of code!
![](image1.png){.absolute top=200 left=0 width="350" height="300"}
![](image2.png){.absolute top=50 right=50 width="450" height="250"}
![](image3.png){.absolute bottom=0 right=50 width="300" height="300"}
.absolute
.absolute
Automatically animate matching elements across slides with Auto-Animate.
Automatically animate matching elements across slides with Auto-Animate.