E Quick start

Although this section might not be the latest version, the general idea won’t change. Please see R bookdownplus Textbook to keep up with the update.

E.1 Preparation

Before starting, you have to install R, RStudio, bookdown package, and other software and packages (i.e. Pandoc, LaTeX, rmarkdown, rticle, knitr, etc.) which bookdown depends on. See the official manual of bookdown for details. Additionally, if you want to produce a poster, phython must be installed before using, and the path of phython might have to be added to the environmental variables for Windows users.

E.2 Installation

install.package("bookdownplus")
# or
devtools::install_github("pzhaonet/bookdownplus")

E.3 Generate demo files

Run the following codes, and you will get some files (e.g. index.Rmd, body.Rmd, bookdownplus.Rproj) and folders in your working directory.

getwd() # this is your working directory. run setwd() to change it.
bookdownplus::bookdownplus()

E.4 Build a demo book

Now open bookdownplus.Rproj with RStudio, and press ctrl+shift+b to compile it. Your will get a book file named *.pdf in _book/folder.

E.5 Write your own

Write your own text in index.Rmd and body.Rmd, and build your own lovely book.

E.6 More outputs

By default, the book is in a pdf file. From ‘bookdownplus’ 1.0.3, users can get more output formats, including ‘word’, ‘html’ and ‘epub’. Run:

bookdownplus::bookdownplus(template = 'article', more_output = c('html', 'word', 'epub'))

E.7 Recommendations

I have been developing some other packages, which bring more features into ‘bookdown’, such as:

  • mindr (Zhao P, 2017b), which can extract the outline of your book and turn it into a mind map, and

  • pinyin (Zhao P, 2017c), which can automatically generate ‘{#ID}’ of the chapter headers even if there are Chinese characters in them.

Both of them have been released on CRAN and can be installed via:

install.packages('mindr')
install.packages('pinyin')

Enjoy your bookdowning!

E.8 Models

Eq. (E.1) is an equation.

\[\begin{equation} E = mc^2 \tag{E.1} \end{equation}\]

It can be written as \(E = mc^2\).

References

Zhao P. mindr: Convert Files Between Markdown or Rmarkdown Files and Mindmaps[M]., 2017b.
Zhao P. pinyin: Convert Chinese Characters into Pinyin[M]., 2017c.