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
Best Way to Replace a Lengthy Ifelse Structure in R
Why Is := Allowed as an Infix Operator
Repeating Rows of Data.Frame in Dplyr
Using R to Read Out Excel-Colorinfo
R Remove Last Word from String
Dplyr Rowwise Sum and Other Functions Like Max
Twitter Data Analysis - Error in Term Document Matrix
How to Calculate Any Negative Number to the Power of Some Fraction in R
How to Put Values on a Boxplot for Median, 1St Quartile and Last Quartile
R Grep Pattern Regex with Brackets
Overlay Grid Rather Than Draw on Top of It
Documentation on Internal Variables in Ggplot, Esp. Panel
Get the Event Which Is Fired in Shiny
How to Output Text to the R Console in Color
Reverse and Change Limit of Axis
How to Add Shaded Confidence Intervals to Line Plot with Specified Values