# Convert R Markdown to a PDF book

Convert R Markdown files to PDF after resolving the special tokens of
bookdown (e.g., the tokens for references and labels) to native LaTeX
commands.

## Usage

``` r
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
)
```

## Arguments

- toc, number_sections, fig_caption, pandoc_args:

  See
  `rmarkdown::`[`pdf_document`](https://pkgs.rstudio.com/rmarkdown/reference/pdf_document.html),
  or the documentation of the `base_format` function.

- ...:

  Other arguments to be passed to `base_format`.

- base_format:

  An output format function to be used as the base format.

- toc_unnumbered:

  Whether to add unnumbered headers to the table of contents.

- toc_appendix:

  Whether to add the appendix to the table of contents.

- toc_bib:

  Whether to add the bibliography section to the table of contents.

- quote_footer:

  If a character vector of length 2 and the quote footer starts with
  three dashes (`---`), `quote_footer[1]` will be prepended to the
  footer, and `quote_footer[2]` will be appended; if `NULL`, the quote
  footer will not be processed.

- highlight_bw:

  Whether to convert colors for syntax highlighting to black-and-white
  (grayscale).

## Details

This function is based on
`rmarkdown::`[`pdf_document`](https://pkgs.rstudio.com/rmarkdown/reference/pdf_document.html)
(by default) with better default arguments. You can also change the
default format to other LaTeX/PDF format functions using the
`base_format` argument.

The global R option `bookdown.post.latex` can be set to a function to
post-process the LaTeX output. This function takes the character vector
of the LaTeX output as its input argument, and should return a character
vector to be written to the `.tex` output file. This gives you full
power to post-process the LaTeX output.

## Note

This output format can only be used with
[`render_book()`](https://pkgs.rstudio.com/bookdown/reference/render_book.md).
