Install
- R
- RStudio
- Not strictly necessary, but advisable
- Pandoc
- Bundled with RStudio, but also available as a stand alone
- LateX
- Simplest option is to install
Tinytex
package in R, but can be handled separately.
- Simplest option is to install
In RStudio
Install bookdown
install.packages("bookdown")
Install Tinytex
install.packages("tinytex")
tinytex::install_tinytex()
File | Description |
---|---|
index.Rdm | Contains file specific yaml, including document title, authorship, date etc. as well as a default welcome, copyright and conventions section. |
_bookdown.yml | Contains generic yaml, including book file name, output directory, cleaning instructions, language and certain UI elements, such as section breaks. |
_output.yml | Contains output specific yaml, generating html, pdf, and epub formats. |
styles.css | Global css settings. |
google_analytics.html | Copy and paste your google analytics snippet to this document. |
Open the file template.Rproj This will provide you with a workding directory in RStudio with all of the above files.
By default, contains the following two classes to build call out boxes:
note
for notesadvanced
for advanced concepts
Set up (or request) a new project for your book and the code snippet with unique ID. Copy and paste this into your google_analytics.html
file.
Update the toc before text to reflect the title of your book.
Update the book_filename reflect the title of your book. Separate words with hyphens "-" and do not use special characters, including spaces.
- In the yaml, adjust the title, description, and bibliography fields. If not using a bibliography, remove bibliography, biblio-style, and link-citations fields.
- Update the citation in the copyright section.
- Update or remove the conventions section.
.Rmd / .md files should be numbered in the order in which you wish to have them compiled. index.Rmd will be compiled first by default and does not require numbering, subsequent files should look like:
- 01_FirstFile.Rmd
- 02_SecondFile.Rmd
- Chapters are defined by h1 headers (#). This is default behaviour.
- Pagination is defined by h2 headers (##). This is defined in _bookdown.yml split_by: section
- Books may be further broken down into parts if needed using the special header # (PART). See section 2.2.3 Specia Headers
- bookdown files are exported to a
docs/
directory in the project root folder, defined in _bookdown.yml.
GitHub pages uses Jekyll to render markdown to html. We're not using this, so to keep Jekyll out of the way, put a .nojekyll file in the docs/
directory. To this, open a shell, navigate to your docs directory and execute touch .nojekyll
- If including citations, ensure that all bib records have a date field; it may be necessary to manually add "n.d." if no date is available.
- When giving the book a name in _bookdown.yml file, ensure the file name is connected by hyphens "-", and that special charaters are avoided - this includes spaces.
- Create a repository for the project, upload content and set up git hub pages to look in the
docs/
directory.