Creating Accompanying Slides for Bookdown Project

creating accompanying slides for bookdown project

The error was due to the fact that rmarkdown::beamer_presentation() does not have the argument number_sections (you cannot number sections in beamer; at least Pandoc doesn't seem to support it).

To get around this issue, you may use the following hack, which basically defines a base format that throws away the number_sections argument:

---
title: "Using bookdown with Beamer"
output:
bookdown::pdf_book:
base_format: "function(..., number_sections) rmarkdown::beamer_presentation(...)"
number_sections: false
---

## Plot

See Figure \@ref(fig:foo).

```{r, foo, fig.cap='Hi there', fig.height=4}
plot(1:10)
```

Having a beamer_presentation and a pdf_book in the same Bookdown project

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')

bookdown: customize the output filename

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.



Related Topics



Leave a reply



Submit