rmarkdown (version 0.1.2)

revealjs_presentation: Convert to a reveal.js presentation


Format for converting from R Markdown to a reveal.js presentation.


revealjs_presentation(incremental = FALSE, center = FALSE, fig_width = 8,
  fig_height = 6, fig_retina = 2, fig_caption = FALSE, smart = TRUE,
  self_contained = TRUE, theme = "default", transition = "default",
  highlight = "default", mathjax = "default", template = "default",
  includes = NULL, data_dir = NULL, pandoc_args = NULL)



TRUE to vertically center content on slides


Visual theme ("default", "simple", sky", "beige", "serif", or "solarized").


Slide transition ("default", "cube", "page", "concave", "zoom", "linear", "fade", or "none")


Pandoc template to use for rendering. Pass "default" to use the rmarkdown package default template; pass NULL to use pandoc's built-in template; pass a path to use a custom template that you've created. Note that if you don't use the "default" template then some features of revealjs_presentation won't be available (see the Templates section below for more details).


TRUE to render slide bullets incrementally. Note that if you want to reverse the default incremental behavior for an individual bullet you can preceded it with >. For example: > - Bullet Text


Default width (in inches) for figures


Default width (in inches) for figures


TRUE to render figures with captions


Syntax highlighting style. Supported styles include "default", "tango", "pygments", "kate", "monochrome", "espresso", "zenburn", and "haddock". Pass NULL to prevent syntax highlighting.


Named list of additional content to include within the document (typically created using the includes function).


Additional directory to resolve relatives paths of templates and included content against (the directory of the input file is used by default).


Additional command line options to pass to pandoc


Scaling to perform for retina displays (defaults to 2, which currently works for all widely used retina displays). Note that this only takes effect if you are using knitr >= 1.5.21. Set to NULL to prevent retina scaling.


Produce typographically correct output, converting straight quotes to curly quotes, --- to em-dashes, -- to en-dashes, and ... to ellipses.


Produce a standalone HTML file with no external dependencies, using data: URIs to incorporate the contents of linked scripts, stylesheets, images, and videos. Note that if you specify "local" for mathjax then self_contained is automatically set to FALSE.


Include mathjax. The "default" option uses an https URL from the official MathJax CDN. The "local" option uses a local version of MathJax (which is copied into the output directory). You can pass an alternate URL or pass NULL to exclude MathJax entirely.


R Markdown output format to pass to render


You can provide a custom HTML template to be used for rendering. The syntax for templates is described in the documentation on pandoc templates. You can also use the basic pandoc template by passing template = NULL.

Note however that if you choose not to use the "default" reveal.js template then several aspects of reveal.js presentation rendering will behave differently:

  • The center parameter does not work (you'd need to set this directly in the template).

  • The built-in template includes some additional tweaks to styles to optimize for output from R, these won't be present.

  • MathJax will not work if self_contained is TRUE (these two options can't be used together in normal pandoc templates).


In reveal.js presentations you can use level 1 or level 2 headers for slides. If you use a mix of level 1 and level 2 headers then a two-dimensional layout will be produced, with level 1 headers building horizontally and level 2 headers building vertically.

For more information on markdown syntax for presentations see producing slide shows with pandoc.


Run this code

# simple invocation
render("pres.Rmd", revealjs_presentation())

# specify an option for incremental rendering
render("pres.Rmd", revealjs_presentation(incremental = TRUE))
# }

Run the code above in your browser using DataLab