# The EPUB e-book format

Convert a book to the EPUB format, which is is an e-book format
supported by many readers, such as Amazon Kindle Fire and iBooks on
Apple devices.

## Usage

``` r
epub_book(
  fig_width = 5,
  fig_height = 4,
  dev = "png",
  fig_caption = TRUE,
  number_sections = TRUE,
  toc = FALSE,
  toc_depth = 3,
  stylesheet = NULL,
  cover_image = NULL,
  metadata = NULL,
  chapter_level = 1,
  epub_version = c("epub3", "epub", "epub2"),
  md_extensions = NULL,
  global_numbering = !number_sections,
  pandoc_args = NULL,
  template = "default"
)
```

## Arguments

- fig_width, fig_height, dev, fig_caption:

  Figure options (width, height, the graphical device, and whether to
  render figure captions).

- number_sections:

  Whether to number sections.

- toc, toc_depth:

  Whether to generate a table of contents, and its depth.

- stylesheet:

  A character vector of paths to CSS stylesheets to be applied to the
  eBook.

- cover_image:

  The path to a cover image.

- metadata:

  The path to the EPUB metadata file.

- chapter_level:

  The level by which the e-book is split into separate “chapter” files.

- epub_version:

  Whether to use version 3 or 2 of EPUB. This correspond to [Pandoc's
  supported output format](https://pandoc.org/MANUAL.html#option--to).
  `"epub"` is an alias for `"epub3"` since Pandoc 2.0 and `"epub2"` for
  earlier version.

- md_extensions:

  A character string of Pandoc Markdown extensions.

- global_numbering:

  If `TRUE`, number figures and tables globally throughout a document
  (e.g., Figure 1, Figure 2, ...). If `FALSE`, number them sequentially
  within sections (e.g., Figure 1.1, Figure 1.2, ..., Figure 5.1, Figure
  5.2, ...). Note that `global_numbering = FALSE` will not work with
  `number_sections = FALSE` because sections are not numbered.

- pandoc_args:

  A vector of additional Pandoc arguments.

- template:

  Pandoc template to use for rendering. Pass `"default"` to use Pandoc's
  built-in template; pass a path to use a custom template. The default
  pandoc template should be sufficient for most use cases. In case you
  want to develop a custom template, we highly recommend to start from
  the default EPUB templates at
  <https://github.com/jgm/pandoc-templates/>.

## Note

Figure/table numbers cannot be generated if sections are not numbered
(`number_sections = FALSE`).
