Table 的演示内容

Table of content for Rpresentation

我正在使用 knitr 使用 Rstudio 创建演示文稿,我想使用幻灯片的类型在开头生成 table 内容幻灯片。所以如果我有以下代码:

Some fun lecture
========================================================
author: some guy
date: in the future

Table of content slide
========================================================
Here I want the table of content based on the following slide types

Some stuff 1
========================================================
type:section
Some very important stuff

More detail on stuff 1
========================================================
type:subsection
Did not get enough of stuff 1!? Here is more :D

Stuff 2
========================================================
type:section
There are other kinds of stuff?

Prompt slide
========================================================
type:prompt
Do not display prompt or alert types in TOC

所以基本上我想要 table 在标题幻灯片之后的内容幻灯片看起来像:

这是默认可用的还是我需要一些额外的 CSS 样式来处理这个问题?

要生成 table 内容,请在文档开头包含一个带有选项 "toc:true" 的文档 header。一级标题用#表示,二级标题用##表示,依此类推。下面是一个例子。 "prompt" 选项仅与 R 代码块相关。 R 代码块未在 table 目录中列出。

但是,这只会生成一个 html 文档。如果您想要 Latex-like 演示文稿和单独的幻灯片,您可以将 html_document 替换为 beamer_presentation。在 beamer 演示文稿中,table 目录中仅列出了 1 级标题。

---
title: "Sample Document"
author: "Author"
output:
  html_document:
    toc: true
---

# Some stuff 1
Some very important stuff

## More detail on stuff 1
Did not get enough of stuff 1!? Here is more :D

# Stuff 2
There are other kinds of stuff?

```{r, prompt=TRUE}
summary(iris[, "Sepal.Length"])
```

有关 Rmarkdown 中 Beamer 演示的更多信息,请参阅 http://rmarkdown.rstudio.com/beamer_presentation_format.html. A similar question has been answered here