4.3 Beamer presentation

To create a Beamer presentation from R Markdown, you specify the beamer_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.3 for two sample slides):

Two sample slides in a Beamer presentation.Two sample slides in a Beamer presentation.

FIGURE 4.3: Two sample slides in a Beamer presentation.

Within R Markdown documents that generate PDF output, you can use raw LaTeX and even define LaTeX macros. See Pandoc’s manual for details.

4.3.1 Themes

You can specify Beamer themes using the theme, colortheme, and fonttheme options. For example:

Figure 4.4 shows two sample slides of the AnnArbor theme in the above example. You can find a list of possible themes and color themes at https://hartwork.org/beamer-theme-matrix/.

Two sample slides with the AnnArbor theme in Beamer.Two sample slides with the AnnArbor theme in Beamer.

FIGURE 4.4: Two sample slides with the AnnArbor theme in Beamer.

4.3.2 Slide level

The slide_level option defines the heading level that defines individual slides. By default, this is the highest header level in the hierarchy that is followed immediately by content, and not another header, somewhere in the document. This default can be overridden by specifying an explicit slide_level:

4.3.3 Other features

Refer to Section 3.1 for the documentation of other features of Beamer presentations, including table of contents (Section 3.1.1), figure options (Section 3.1.5), appearance and style (Section 3.1.4), data frame printing (Section 3.1.6), Markdown extensions (Section 3.1.10.4), header and before/after body inclusions (Section 3.1.10.2), custom templates (Section 3.1.10.3), Pandoc arguments (Section 3.1.10.5), and shared options (Section 3.1.11).

Beamer presentations have a few features in common with ioslides presentations in Section 4.1 and PDF documents in Section 3.3. For incremental bullets, see Section 4.1.2. For how to keep the intermediate LaTeX output file, see Section 3.3.7.2.