In my Bookdown project, I have both a bookdown::pdf_book
and a beamer_presentation
specificed in the _output.yml
. (Why? Here is an example, and here is the explanation.)
The problem is that pdf_book
seems to respect the output_dir
specified in _bookdown.yml
, but not the beamer_presentation
. Thus, when hitting the Build Book
button, the presentation won't get into the docs
directory, it'll appear in the base directory.
Is there any way to make beamer_presentation
respect the output_dir
specification?
(Also, it'll mean that something has to be done with the filenames, as by default the the names would be the same.)
EDIT: I realized that using bookdown::beamer_presentation2
instead of beamer_presentation
will solve the problem, as it'll respect the output_dir
. But I'd call it a partial answer, as my fears in the last sentence realized: this will simply overwrite the pdf_book
(as they'll indeed have the same name), so it is still not really working...
Yes, you need to use bookdown::beamer_presentation2
, which will respect the output_dir
setting in _bookdown.yml
.
Regarding to your second problem (two formats having the same output filename), there isn't a nice solution at the moment if you only want to click the Knit button in RStudio---you have to call rmarkdown::render()
and specify the output filename in the call, e.g.,
rmarkdown::render('file.Rmd', 'bookdown::pdf_book', output_file = 'book.pdf')
rmarkdown::render('file.Rmd', 'bookdown::beamer_presentation2', output_file = 'beamer.pdf')