## 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):

---
title: "Habits"
author: John Doe
date: March 22, 2005
output: beamer_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}
plot(cars)


## Going to sleep

- Get in bed
- Count sheep

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:

---
output:
beamer_presentation:
theme: "AnnArbor"
colortheme: "dolphin"
fonttheme: "structurebold"
---

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/.

### 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:

---
output:
beamer_presentation:
slide_level: 2
---

### 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.