RMarkdown:开头的浮动目录和目录

新手上路,请多包涵

我想知道是否可以在文档开头有一个浮动目录和另一个目录。我目前的前事看起来像这样:

 ---
title: "TEST"
author: brettljausn
date: January 15, 2018
output:
  html_document:
    toc: true
    toc_float:
      toc_collapsed: true
    toc_depth: 3
    number_sections: true
    theme: lumen
---

# Rest of the sample document: --------

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

# R Markdown

This is an R Markdown document. 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. You can embed an R code chunk like this:

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

## Including Plots

You can also embed plots, for example:

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

Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.

我试过添加另一个 toc: true ,但这只会给我一条错误消息。提前致谢!

原文由 brettljausn 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 764
1 个回答

你只需要在 toc_float 前面添加 true :

 ---
title: "TEST"
output:
  html_document:
  toc: true
  toc_float: true
  toc_collapsed: true
  toc_depth: 3
  number_sections: true
  theme: lumen
---

另请注意,您的 rmarkdown 文件中有一条评论,该评论将被解释为标题:

示例文档的其余部分:——–

原文由 Dan 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
logo
Stack Overflow 翻译
子站问答
访问
宣传栏