This is a follow up to an earlier question I asked here: creating accompanying slides for bookdown project
Bookdown
allows compiling the file to various format, including multiple pdf
. The issue is therefore to give the output different names. If not, the second pdf
compile overwrites the first one!
In the comments to my earlier question, I wrote: "I just need to understand how to change the file name - because bookdown::pdf_book
and bookdown::pdf_document2
output to the same file - which gets therefore overwritten! I know how to change filenames and locations for all files at once using _bookdown.yml
, but I do not know how to do it for individual files.... i will search more online, but did not see anything so far - do I need to post another question for this if I cannot find anything?"
YiHui Xie responded: "Unfortunately you cannot customize the output filename through any YAML
options"
I suggested: "i guess the only option if so would be to hope for a future version of bookdown
to allow for some extra options such as bookdown::slides
for instance?"
and added "I tried to pass "-o", "FILE.pdf"
and variations to pandoc
, but that did not seem to work"
Throwing this did not work either: pandoc_args: [ "--output", "slides.pdf" ]
but I do not think anyone noticed this question anymore and therefore, I am throwing this as an actual question, please, with the hope of finding a solution! many thanks in advance. thomas
For those who might be interested in an answer, I asked the question directly on (GitHub), and the package author Xie YiHui kindly responded:
The only way at the moment is to render (bookdown::render_book()) to the default output filename, rename it (file.rename()), then render the next output format, and also rename the output file to your desired filename. This process could be automated via an R script. I don't have time for a more detailed answer. Sorry.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With