4.1 ioslides presentation

To create an ioslides presentation from R Markdown, you specify the ioslides_presentation output format in the YAML metadata of your document. You can create a slide show broken up into sections by using the # and ## heading tags (you can also create a new slide without a header using a horizontal rule (---). For example here is a simple slide show (see Figure 4.1 for two sample slides):

title: "Habits"
author: John Doe
date: March 22, 2005
output: ioslides_presentation

# In the morning

## Getting up

- Turn off alarm
- Get out of bed

## Breakfast

- Eat eggs
- Drink coffee

# In the evening

## Dinner

- Eat spaghetti
- Drink wine


```{r, cars, fig.cap="A scatterplot.", echo=FALSE}

## Going to sleep

- Get in bed
- Count sheep
Two sample slides in an ioslides presentation.Two sample slides in an ioslides presentation.

FIGURE 4.1: Two sample slides in an ioslides presentation.

You can add a subtitle to a slide or section by including text after the pipe (|) character. For example:

## Getting up | What I like to do first thing

4.1.1 Display modes

The following single character keyboard shortcuts enable alternate display modes:

  • 'f': enable fullscreen mode

  • 'w': toggle widescreen mode

  • 'o': enable overview mode

  • 'h': enable code highlight mode

  • 'p': show presenter notes

Pressing Esc exits all of these modes. See the sections below on Code Highlighting and Presenter Mode for additional detail on those modes.

4.1.2 Incremental bullets

You can render bullets incrementally by adding the incremental option:

    incremental: true

If you want to render bullets incrementally for some slides but not others you can (ab)use this syntax for blockquotes:

> - Eat eggs
> - Drink coffee

4.1.3 Visual appearance Presentation size

You can display the presentation using a wider form factor using the widescreen option. You can specify that smaller text be used with the smaller option. For example:

    widescreen: true
    smaller: true

You can also enable the smaller option on a slide-by-slide basis by adding the .smaller attribute to the slide header:

## Getting up {.smaller} Transition speed

You can customize the speed of slide transitions using transition option. This can be "default", "slower", "faster", or a numeric value with a number of seconds (e.g., 0.5) . For example:

    transition: slower
--- Build slides

Slides can also have a .build attribute that indicate that their content should be displayed incrementally. For example:

## Getting up {.build}

Slide attributes can be combined if you need to specify more than one. For example:

## Getting up {.smaller .build} Background images

You can specify a background image for a slide using the attribute data-background, and use other attributes including data-background-size, data-background-position, and data-background-repeat to tweak the style of the image. You need to be familiar with CSS to fully understand these four attributes, and they correspond to the CSS properties background, background-size, background-position, and background-repeat, respectively. For example:

## Getting up {data-background=foo.png data-background-size=cover} Custom CSS

You can add your own CSS to an ioslides presentation using the css option:

    css: styles.css

You can also target specific slides or classes of slice with custom CSS by adding IDs or classes to the slides headers within your document. For example the following slide header:

## Future Steps {#future-steps .emphasized}

Would enable you to apply CSS to all of its content using either of the following CSS selectors:

#future-steps {
  color: blue;

.emphasized {
  font-size: 1.2em;

4.1.4 Code highlighting

It is possible to select subsets of code for additional emphasis by adding a special “highlight” comment around the code. For example:

### <b>
x <- 10
y <- x * 2
### </b>

The highlighted region will be displayed with a bold font. When you want to help the audience focus exclusively on the highlighted region press the h key and the rest of the code will fade away.

4.1.6 Tables

The ioslides template has an attractive default style for tables so you should not hesitate to add tables for presenting more complex sets of information. Pandoc Markdown supports several syntaxes for defining tables, which are described in the Pandoc Manual.

4.1.7 Advanced layout

You can center content on a slide by adding the .flexbox and .vcenter attributes to the slide title. For example:

## Dinner {.flexbox .vcenter}

You can horizontally center content by enclosing it in a div tag with class centered. For example:

<div class="centered">
This text is centered.

You can do a two-column layout using the columns-2 class. For example:

<div class="columns-2">

  - Bullet 1
  - Bullet 2
  - Bullet 3

Note that content will flow across the columns so if you want to have an image on one side and text on the other you should make sure that the image has sufficient height to force the text to the other side of the slide.

4.1.8 Text color

You can color content using base color classes red, blue, green, yellow, and gray (or variations of them, e.g., red2, red3, blue2, blue3, etc.). For example:

<div class="red2">
This text is red

4.1.9 Presenter mode

A separate presenter window can also be opened (ideal for when you are presenting on one screen but have another screen that is private to you). The window stays in sync with the main presentation window and also shows presenter notes and a thumbnail of the next slide. To enable presenter mode add ?presentme=true to the URL of the presentation. For example:


The presenter mode window will open and will always re-open with the presentation until it is disabled with:


To add presenter notes to a slide, you include it within a “notes” div. For example:

<div class="notes">
This is my *note*.

- It can contain markdown
- like this list

4.1.10 Printing and PDF output

You can print an ioslides presentation from within browsers that have good support for print CSS (as of this writing, Google Chrome has the best support). Printing maintains most of the visual styles of the HTML version of the presentation.

To create a PDF version of a presentation, you can use the menu Print to PDF from Google Chrome.

4.1.11 Custom templates

You can replace the underlying Pandoc template using the template option:

title: "Habits"
    template: quarterly-report.html

However, please note that the level of customization that can be achieved is limited compared to the templates of other output formats, because the slides are generated by custom formatting written in Lua, and as such the template used must include the string RENDERED_SLIDES as can be found in the default template file with the path rmarkdown:::rmarkdown_system_file("rmd/ioslides/default.html").

4.1.12 Other features

Refer to Section 3.1 for the documentation of other features of ioslides presentations, including figure options (Section 3.1.5), MathJax equations (Section 3.1.8), data frame printing (Section 3.1.6), Markdown extensions (Section, keeping Markdown (Section, document dependencies (Section 3.1.9), header and before/after body inclusions (Section, Pandoc arguments (Section, and shared options (Section 3.1.11).