Bookdown: TOC with html_document2

一笑奈何 提交于 2019-12-23 12:05:36

问题


How can I create a single output document with bookdown, e.g. using its bookdown::html_document2 format, and still have a Table of Contents somewhere in the output document?

For example, I check out the content from https://github.com/tidyverse/style, and run

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.


回答1:


You can use the dots (...) argument of bookdown::html_document2 to pass toc = TRUE to rmarkdown::html_document:

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


来源:https://stackoverflow.com/questions/48796293/bookdown-toc-with-html-document2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!