Rmarkdown 演示文稿幻灯片

Rmarkdown presentation slide tickers

我正在使用 rmarkdown 在 RStudio 中制作 beamer 演示文稿。我想在演示文稿顶部获得幻灯片代码。德累斯顿主题应该支持这些代码Dresden

那么是否可以使用 rmarkdown 获取这些代码?当我编织 pdf 时,我得到的演示文稿没有幻灯片。

示例代码:

---
title: "Example"
output: beamer_presentation
theme: Dresden
---

# R Markdown

This is an R Markdown presentation. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document.

# Slide with Bullets

- Bullet 1
- Bullet 2
- Bullet 3

# Slide with R Code and Output

```{r}
summary(cars)
```

# Slide with Plot

```{r, echo=FALSE}
plot(cars)
```

我认为 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 documentation source

例如 slide_level: 2:

---
title: "Example"
output: 
  beamer_presentation:
    slide_level: 2
theme: Dresden
---

为您提供以下输出

但是您需要为幻灯片标题提供较低级别的标题,例如

# R Markdown

## Description
This is an R Markdown presentation. Markdown is a simple formatting 
syntax for authoring HTML, PDF, and MS Word documents. For more 
details on using R Markdown see <http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be generated that 
includes both content as well as the output of any embedded R code 
chunks within the document.

编辑 要获得与所附图片相同的输出,请按以下方式对演示文稿进行分段:

---
title: "Example"
output: 
  beamer_presentation:
    slide_level: 3
theme: Dresden
---
# Section 1
## Subsection 1
### Title A
### Title B
## Subsection 2
### Title A
## Subsection 3
### Title A
### Title B
### Title C
# Section 2
## Subsection 1
### Title A
### Title B

并生成以下演示文稿标题: