A Minimal Book Example
2020-08-25
Chapter 1 Prerequisites
This is a sample book written in Markdown. You can use anything that Pandoc’s Markdown supports, e.g., a math equation \(a^2 + b^2 = c^2\).
The bookdown package can be installed from CRAN or Github:
install.packages("bookdown")
# or the development version
# devtools::install_github("rstudio/bookdown")
Remember each Rmd file contains one and only one chapter, and a chapter is defined by the first-level heading #
.
To compile this example to PDF, you need XeLaTeX. You are recommended to install TinyTeX (which includes XeLaTeX): https://yihui.org/tinytex/.
By default, tutorial
will convert all R chunks.
Reference a figure by its code chunk label with the fig:
prefix, e.g., see Figure ??. Similarly, you can reference tables generated from knitr::kable()
, e.g., see Table ??.
You can write citations, too. For example, we are using the bookdown package [@R-bookdown] in this sample book, which was built on top of R Markdown and knitr [@xie2015].