【问题标题】:Table of content for Rpresentation演示文稿目录
【发布时间】:2016-01-13 21:13:00
【问题描述】:

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

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

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

  • 一些东西 1
    • 关于内容 1 的更多详细信息
  • 东西 2

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

【问题讨论】:

    标签: r shiny knitr r-markdown


    【解决方案1】:

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

    但是,这只会生成一个 html 文档。如果您想要一个带有单个幻灯片的类似 Latex 的演示文稿,您可以将 html_document 替换为 beamer_presentation。在投影仪演示中,目录中仅列出了 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.htmlhere已经回答了一个类似的问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-02
      • 1970-01-01
      相关资源
      最近更新 更多