bookdown icon indicating copy to clipboard operation
bookdown copied to clipboard

Nested book - use directory as section name and sub file has chapters

Open ghost opened this issue 4 years ago • 3 comments

I managed to organize *.rmd files in many directories, and render the book by including rmd_subdir: yes in _bookdown.yml. However, all *.rmd files are on the same level in epub or HTML format. after rendering I prefer to see directories as sections on ToC. There are chapters under each section, like some compendium books.

ghost avatar Dec 29 '21 04:12 ghost

I confirm that current usage of bookdown does not support this. As explained in the doc (https://bookdown.org/yihui/bookdown/usage.html), sections and chapters are based primarly on headers.

You could probably play with the level of headers within your subfolders, which would probably require to add a first level header with the name of your directory in the first file. (I did not try but this could even be automated using knitr inline code).

Anyway, bookdown doesn't have another way for now to organize the file. I'll make this as a feature request.

Also, note that new ideas and improvement like that have been targeted toward a new tool called Quarto recently. It is still early development and a bit different than bookdown has by design language agnostic (bookdown requires R to build a book). It has a new way to give the structure (see https://quarto.org/docs/books/book-structure.html), but I am not sure it handles subdir as bookdown does. Just pointing this to you for reference in case you want to look into it and play with it.

Thanks for opening the feature request !

cderv avatar Jan 03 '22 18:01 cderv

Thank you.

ghost avatar Jan 03 '22 19:01 ghost

No need to close. I would leave this open so that we remember this feature. Thanks !

cderv avatar Jan 03 '22 20:01 cderv