Section 3.2 LaTeX/PDF
We strongly recommend that you use an HTML output format instead of LaTeX when you develop a book, since you will not be too distracted by the typesetting details, which can bother you a lot if you constantly look at the PDF output of a book. Leave the job of careful typesetting to the very end (ideally after you have really finished the content of the book).
The LaTeX/PDF output format is provided by
pdf_book() in bookdown. There is not a significant difference between pdf_book() and the pdf_document() format in rmarkdown. The main purpose of pdf_book() is to resolve the labels and cross-references written using the syntax described in Section 2.4, Section 2.5, and Section 2.6. If the only output format that you want for a book is LaTeX/PDF, you may use the syntax specific to LaTeX, such as \label{} to label figures/tables/sections, and \ref{} to cross-reference them via their labels, because Pandoc supports LaTeX commands in Markdown. However, the LaTeX syntax is not portable to other output formats, such as HTML and e-books. That is why we introduced the syntax (\#label) for labels and \@ref(label) for cross-references.
---
documentclass: book
bibliography: [book.bib, packages.bib]
biblio-style: apalike
---
There are a large number of other YAML options that you can specify for LaTeX output, such as the paper size, font size, page margin, line spacing, font families, and so on. See http://pandoc.org/MANUAL.html#variables-for-latex for a full list of options.
The
pdf_book() format is a general format like html_book(), and it also has a base_format argument:
bookdown::pdf_book(
toc = TRUE, number_sections = TRUE, fig_caption = TRUE, pandoc_args = NULL,
..., base_format = rmarkdown::pdf_document, toc_unnumbered = TRUE,
toc_appendix = FALSE, toc_bib = FALSE, quote_footer = NULL,
highlight_bw = FALSE
)
The
pdf_book() format is a general format like html_book(), and it also has a base_format argument. You can change the base_format function to other output format functions, and bookdown has provided a simple wrapper function tufte_book2(), which is basically pdf_book(base_format = tufte::tufte_book), to produce a PDF book using the Tufte PDF style.
