Learn R Programming

bookdown

A open-source (GPL-3) R package to facilitate writing books and long-form articles/reports with R Markdown. Features include:

  • Generate printer-ready books and ebooks from R Markdown documents
  • A markup language easier to learn than LaTeX, and to write elements such as section headers, lists, quotes, figures, tables, and citations
  • Multiple choices of output formats: PDF, LaTeX, HTML, EPUB, and Word.
  • Possibility of including dynamic graphics and interactive applications (HTML widgets and Shiny apps)
  • Support for languages other than R, including C/C++, Python, and SQL, etc.
  • LaTeX equations, theorems, and proofs work for all output formats
  • Can be published to GitHub, bookdown.org, and any web servers
  • Integrated with the RStudio IDE
  • One-click publishing to https://bookdown.org

Book

Installation

You can install the package from CRAN as follows:

install.packages("bookdown")

If you want to use the development version of the bookdown package, you can install the package from GitHub via the pak package:

# install.packages("pak")
pak::pak('rstudio/bookdown')

Usage

The easiest way to start a new Bookdown project is from within RStudio IDE. Go to File > New Project > New Directory > Book project using bookdown.

This will create a new directory with an example book as template. You can build the HTML version of this example book without doing any modification:

  • Go into the Build Pane in the RStudio IDE
  • Click on Build Book > bookdown::gitbook

You can also run bookdown::render_book() in the R console.

Learn more about using bookdown in the Getting started section.

Getting help

There are two main places to get help:

  1. The RStudio community is a friendly place to ask any questions about bookdown. Be sure to use the bookdown tag.

  2. Stack Overflow is a great source of answers to common bookdown questions. Use the tags [r][bookdown] if you ask a question.

Code of Conduct

Please note that the bookdown project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Copy Link

Version

Install

install.packages('bookdown')

Monthly Downloads

74,770

Version

0.41

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Last Published

October 16th, 2024

Functions in bookdown (0.41)

bs4_book

HTML book built with bootstrap4
build_chapter

Combine different parts of an HTML page
epub_book

The EPUB e-book format
fence_theorems

Convert the syntax of theorem and proof environments from code blocks to fenced Divs
clean_book

Clean up the output files and directories from the book
gitbook

The GitBook output format
bookdown_site

R Markdown site generator for bookdown
create_book

Create a bookdown project
calibre

A wrapper function to convert e-books using Calibre
serve_book

Continuously preview the HTML output of a book using the servr package
pdf_book

Convert R Markdown to a PDF book
render_book

Render multiple R Markdown documents into a book
html_document2

Output formats that allow numbering and cross-referencing figures/tables/equations
publish_book

Publish a book to the web
html_chapters

Build book chapters into separate HTML files
resolve_refs_html

Resolve figure/table/section references in HTML
bookdown-package

Authoring Books and Technical Documents with R Markdown