I am using several Rmd files to produce different books based on my requirements. I am using render_book command to pass the _bookdown.yml file I want to use. I can define and reuse my compositions. That's working fine.
My question is: how can I do the same for _output.yml file?
I would like to be able to select different configs for using different template.tex or preamble.tex. I search the doc and the code but found nothing going in that direction.
Am I missing something here? Should I use file rename code before calling render_book?
render_book has a output_format argument. You can pass here any output_format object that you would have a put into _output.yml, like bookdown::gitbook() or bookdown::pdf_book() with any argument you need as you would define them in output.yml.
Note also that _output.yaml is a rmarkdown feature not a bookdown one like _bookdown.yml. Output format and options are read from yaml front matter, from _site.yml and _output.yml and merge all together. Currently there is no way to change the name of those file read by any configuration. You would need to open a feature request, or use a renaming mechanism just before building to activate the one you want to use.
Thank you for your explanation. It does help to understand the mechanism behind the render option. I will use so file renaming code for the time being.
Where are request features open? As an issue on the GitHub?
For this one, the use case is bookdown but the feature is in Rmarkdown where _output.yml is from. I would suggest there.
The impact can be non negligeable for this and output can already be pass to render_book as object in argument of the function. Maybe a function to help transform an output format stored in yaml to an object would be enough in your case
This is a different approach but could be easier to implement... We will see what they say.
Doing what you do (renaming to activate), is also a good way. You can use a Makefile or other workflow tool (like drake R package) to help automate this. Or just a wrapper aroung render_book