我不知道如何在 R bookdown 中进行分页。
分页是指一页内的内容显示为一个网站。
默认情况下,每个新部分的前面总是有一个分页符(如 # Chapter 1
)。
所以,如果我运行 render_book
,每个部分都会变成一个 html 文件。
但是,如果我有很多小节,那么这些网站就会变得很长。
我希望在每个小节之前都有分页符(例如 ## Chapter 1.1
)。
到目前为止,我尝试将 \newpage
、 \pagebreak
、 ---------------
添加到 .Rmd 或仅提供与我希望将它们作为 .html 文件具有相同结构的 .Rmd 文件。
无论哪种方式,.html 文件始终是根据部分创建的。
最佳答案
我认为这是由 split_by
as documented here 的 gitbook
参数指定的。
听起来您正在使用 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., generatechapter3.html
forchapter3.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
andsection+number
: similar tochapter
andsection
, but the files will be numbered;
关于r - Bookdown:设置分页符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39966944/