r - Bookdown:设置分页符

标签 r bookdown

我不知道如何在 R bookdown 中进行分页。
分页是指一页内的内容显示为一个网站。

默认情况下,每个新部分的前面总是有一个分页符(如 # Chapter 1 )。
所以,如果我运行 render_book,每个部分都会变成一个 html 文件。
但是,如果我有很多小节,那么这些网站就会变得很长。

我希望在每个小节之前都有分页符(例如 ## Chapter 1.1 )。

到目前为止,我尝试将 \newpage\pagebreak--------------- 添加到 .Rmd 或仅提供与我希望将它们作为 .html 文件具有相同结构的 .Rmd 文件。
无论哪种方式,.html 文件始终是根据部分创建的。

最佳答案

我认为这是由 split_by as documented heregitbook 参数指定的。

听起来您正在使用 chapter 但您想使用 section

The split_by argument specifies how you want to split the HTML output into multiple pages, and its possible values are:

  • rmd: use the base filenames of the input Rmd files to create the HTML filenames, e.g., generate chapter3.html for chapter3.Rmd;
  • none: do not split the HTML file (the book will be a single HTML file);
  • chapter: split the file by the first-level headers;
  • section: split the file by the second-level headers;
  • chapter+number and section+number: similar to chapter and section, but the files will be numbered;

关于r - Bookdown:设置分页符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39966944/

相关文章:

html - 希望在 R Shiny 中自定义按钮的外观

latex - knitr/rmarkdown/ latex : How to cross-reference figures and tables in 2 different pdf files?

r - 使用紧凑数字引用样式时显示所有使用的引用文献

r - 限制函数在 R for 循环中处理的时间

r - 将多组 jpg 图像组合成一个 jpg/png r

r - 将数据转换为 R 中 xgboost 的格式?

r - 使用 bookdown 时在 rmarkdown 文档中包含 git 代码

r - 无法在 kable 表中呈现引文

r - bookdown:自定义输出文件名

r - 在 mouse r 包中实现随机森林时出错