Is it possible to split a tufte_html
document from the R tufte package into one file per chapter? I'd like to write a whole book. Bookdown lets me organize the chapters in their own files, and the chapters start new pages in the pdf output, but for the html output, it's just one file.
Here's what I tried that does not work.
index.Rmd
---
title: "Probability and Statistics<br />"
author: "Bob Carpenter"
date: "2018"
output:
tufte::tufte_html
---
```{r setup, include=FALSE}
bookdown::tufte_html_book(split_by = "chapter")
```
# A Chapter
Blah blah blah.
# Another Chapter
Blah blah blah.
```
_bookdown.yml
rmd_files: [
"index.Rmd",
"another_file.Rmd"
]
another_file.Rmd
# Yet another chapter
Foo bar baz.
$ R
> library(bookdown)
> render_book("index.Rmd")
This produces a single html document as output, not one file per chapter. I also tried replacing the split_by call with bookdown::tufte_html_book(split_by = "chapter")
.
Here's my sessionInfo()
> sessionInfo() R version 3.5.0 (2018-04-23) Platform: x86_64-apple-darwin15.6.0 (64-bit) Running under: macOS High Sierra 10.13.6 Matrix products: default BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] bookdown_0.7 loaded via a namespace (and not attached): [1] Rcpp_0.12.18 tufte_0.4 digest_0.6.15 rprojroot_1.3-2 [5] backports_1.1.2 magrittr_1.5 evaluate_0.10.1 stringi_1.2.2 [9] rstudioapi_0.7 rmarkdown_1.10 tools_3.5.0 stringr_1.3.1 [13] xfun_0.1 yaml_2.2.0 compiler_3.5.0 htmltools_0.3.6 [17] knitr_1.20
I don't quite understand what you were trying to do in the setup
chunk in index.Rmd
, but that is not the correct way to specify output formats in R Markdown. Here is the working example:
index.Rmd:
---
title: "Probability and Statistics<br />"
author: "Bob Carpenter"
date: "2018"
output:
bookdown::tufte_html_book:
split_by: chapter
---
# A Chapter
Blah blah blah.
# Another Chapter
Blah blah blah.
another_file.Rmd:
# Yet another chapter
Foo bar baz.
To render the book:
bookdown::render_book('index.Rmd')