Introduction

This document allows you to create a book in PDF format (and ePub format) at the same time as an HTML version to be published on the web. The syntax is that of Markdown with some extensions.

The bookdown package must be installed from CRAN or GitHub:

install.packages("bookdown")
# or the development version
# devtools::install_github('rstudio/bookdown')

The book is organized in chapters. Each chapter is an Rmd file, whose name normally begins with its number (e.g. 01-intro.Rmd). All Rmd files in the project folder are actually treated as chapters, sorted by filename. The index.Rmd file is special: it contains the document header and the first chapter.

This first chapter is placed in the foreword of the printed book: it should not be numbered (hence the {-} code next to the title) in the HTML version. It must end with the LaTeX command \mainmatter which marks the beginning of the body of the book.

The outline levels start with # for chapters (only one per file), ## for sections, etc.

Compilation in PDF format is done by XeLaTeX, which must be installed.

While writing, it is strongly advised to create only the HTML file, which is much faster than a LaTeX compilation. Each chapter can be viewed very quickly by clicking on the Knit button above the source window. The entire book is created by clicking on the Build Book button in the RStudio Build window. The button’s drop-down list allows you to create all documents or limit yourself to one format.