Creating teaching materials with bookdown

Clement Lee · December 8, 2023

I have been quite crazy with Rmarkdown and its upgrade, bookdown. It has helped me create and convert accessible & reproducible teaching materials over the years. This presentation is a summary of the conversion from LaTeX to Rmarkdown, essentially a reminder to myself in the future.

The main idea is that R code and results can be included or excluded by code chunk options, which can be parametrised in the commands via rmarkdown::render() or bookdown::render_book(). What is slightly trickier is doing the same for text and equations, as there’s no default solution environment as far as I know. My workaround is to make them strings in R, then use the same trick with code chunk options and with results = "asis". Experimenting with Python and Quarto would be next.

Twitter, Facebook