Day84: Bookdown

Posted by csiu on May 19, 2017 | with: 100daysofcode

Today is going to be simple.

I want to generate an eBook for documenting knowledge in a aesthetically pleasing and readable format.

The R Markdown for this little project is found here.

What is Bookdown?

Source: https://bookdown.org/yihui/bookdown/

  • is a package built on top of R Markdown
  • inherits the simplicity of the Markdown syntax
  • has added features like multi-page HTML output, numbering and cross-referencing figures/tables/sections/equations, and inserting parts/appendices
  • imports the GitBook style to create elegant and appealing HTML book pages
  • you can see additional examples at https://bookdown.org.

Using bookdown

  1. install.packages("bookdown")
  2. Define header to be documentclass: book
---
title: "A Book"
author: "csiu"
site: bookdown::bookdown_site
documentclass: book
output:
  bookdown::gitbook: default
  bookdown::pdf_book: default
---

Once the header is defined, the rest of the script needs to be defined.

  • A section (#) refers to a chapter in the book
  • A subsection (##) refers to a section in the chapter of the book