Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html RMarkdown:浮动TOC和开始时的TOC_Html_R_Knitr_R Markdown - Fatal编程技术网

Html RMarkdown:浮动TOC和开始时的TOC

Html RMarkdown:浮动TOC和开始时的TOC,html,r,knitr,r-markdown,Html,R,Knitr,R Markdown,我想知道是否有可能有一个浮动目录和另一个在文件开头。我当前的前沿问题如下所示: --- 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 --- #

我想知道是否有可能有一个浮动目录和另一个在文件开头。我当前的前沿问题如下所示:

---
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.
---
标题:“测试”
作者:brettljausn
日期:2018年1月15日
输出:
html_文件:
toc:没错
toc_浮动:
toc_崩溃:真的吗
toc_深度:3
节数:真
主题:流明
---
#示例文档的其余部分:--------
```{r设置,include=FALSE}
knitr::opts_chunk$set(echo=TRUE)
```
#降价
这是一份R降价文件。Markdown是一种用于编写HTML、PDF和MS Word文档的简单格式语法。有关使用R标记的更多详细信息,请参阅。
当您单击**Knit**按钮时,将生成一个文档,其中包括文档中任何嵌入的R代码块的内容和输出。您可以像这样嵌入R代码块:
```{r cars}
摘要(车辆)
```
##包括情节
还可以嵌入打印,例如:
```{r压力,回波=假}
绘图(压力)
```
请注意,“echo=FALSE”参数被添加到代码块中,以防止打印生成绘图的R代码。

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

您只需在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文件中有一条注释,该注释将被解释为标题:


示例文档的其余部分:------------似乎可能,但不明显。你试过Javascript吗?@brettljausn如果下面的答案对你有帮助,请告诉我。谢谢。答案似乎对我不起作用:html的开头只有一个浮动的toc,没有toc。你还需要观察yaml中的缩进:toc_深度和数字_部分需要缩进。以及html_文档(主题除外)之后的所有内容都需要进一步缩进。