Bookdown:设置分页符

Bookdown: Set Page Breaks

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

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

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

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

我认为这是由 gitbook as documented heresplit_by 参数指定的。

听起来您正在使用 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;