Chapter 1 Introduction

This book is a guide to authoring books and technical documents with R Markdown (Allaire, Xie, Dervieux, McPherson, et al. 2023) and the R package bookdown (Xie 2024a). It focuses on the features specific to writing books, long-form articles, or reports, such as:

  • how to typeset equations, theorems, figures and tables, and cross-reference them;
  • how to generate multiple output formats such as HTML, PDF, and e-books for a single book;
  • how to customize the book templates and style different elements in a book;
  • editor support (in particular, the RStudio IDE); and
  • how to publish a book.

It is not a comprehensive introduction to R Markdown or the knitr package (Xie 2023), on top of which bookdown was built. To learn more about R Markdown, please check out the online documentation http://rmarkdown.rstudio.com. For knitr, please see Xie (2015). You do not have to be an expert of the R language (R Core Team 2024) to read this book, but you are expected to have some basic knowledge about R Markdown and knitr. For beginners, you may get started with the cheatsheets at https://www.rstudio.com/resources/cheatsheets/. The appendix of this book contains brief introductions to these software packages. To be able to customize the book templates and themes, you should be familiar with LaTeX, HTML and CSS.

References

Allaire, JJ, Yihui Xie, Christophe Dervieux, Jonathan McPherson, Javier Luraschi, Kevin Ushey, Aron Atkins, et al. 2023. Rmarkdown: Dynamic Documents for r. https://github.com/rstudio/rmarkdown.
R Core Team. 2024. R: A Language and Environment for Statistical Computing. Vienna, Austria: R Foundation for Statistical Computing. https://www.R-project.org/.
Xie, Yihui. 2015. Dynamic Documents with R and Knitr. 2nd ed. Boca Raton, Florida: Chapman; Hall/CRC. http://yihui.org/knitr/.
———. 2023. Knitr: A General-Purpose Package for Dynamic Report Generation in r. https://yihui.org/knitr/.
———. 2024a. Bookdown: Authoring Books and Technical Documents with r Markdown. https://github.com/rstudio/bookdown.