简体   繁体   English

Bookdown:带有html_document2的TOC

[英]Bookdown: TOC with html_document2

How can I create a single output document with bookdown , eg using its bookdown::html_document2 format, and still have a Table of Contents somewhere in the output document? 如何使用bookdown创建单个输出文档,例如使用bookdown::html_document2格式,并且在输出文档中的某个位置仍然有一个目录?

For example, I check out the content from https://github.com/tidyverse/style , and run 例如,我查看来自https://github.com/tidyverse/style的内容,然后运行

Rscript -e "bookdown::render_book('index.Rmd', 'bookdown::html_document2')"

Then I get a _main.html as desired, with all the text from all chapters, but no TOC is present. 然后根据需要得到一个_main.html ,包含所有章节中的所有文本,但不存在TOC。

您可以使用bookdown::html_document2的dots( ... )参数将toc = TRUE传递给rmarkdown::html_document

Rscript -e "bookdown::render_book('index.Rmd', bookdown::html_document2(toc = TRUE))"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM