Skip to content

Monash University Science PhD thesis template using Rmarkdown with the bookdown package

Notifications You must be signed in to change notification settings

zoeseeger/MonashThesisTemplate

Repository files navigation

Monash Science PhD Thesis Rmarkdown Template with Bookdown

This repository provides a template for a Monash University Science PhD thesis using Rmarkdown with the bookdown package. It is designed for PhD students in the Faculty of Science, but can be modified for Masters degrees, other departments and other universities as required.

Requirements

The bookdown package is an open source R package that facilitates writing books and long-form articles/reports with R Markdown. To set up the software, you will need to install the bookdown package and its dependencies in R or RStudio as follows:

options(repos='http://cran.rstudio.com/')
install.packages('rmarkdown')
install.packages('bookdown')

You will also need LaTeX installed. If you don't already have LaTeX, one convenient approach is to install a compact version via R (recommended):

install.packages('tinytex')
tinytex::install_tinytex()

Install knit which is required for excecuting r (or other) code chunks:

install.packages('knitr')
install.packages('knitLatex')

Lastly, install kable extra features to print nice looking latex or html tables:

install.packages('kableExtra')

Getting Started

01-chap1 and 02-chap2 Rmd files outline various syntax and functions useful in creating a thesis. These files can be renamed but remember to also rename them in _bookdown.yml. In _bookdown.yml you can add chapters, order thesis chapters and choose what gets generated upon compilation. This file will keep the matadata for creating the book. In index.Rmd most of the information displayed on the title page can be editted. In monashthesis.tex set or add bibliographies and add any needed latex packages not already in monashthesis.cls which contains the bulk of the formatting including the title page. _output.yaml contains a few more settings for creating the PDF document but should not require changing. Building the book inside RStudio can be done easily by Build Book in the Build section of the Environment window pane. This will build the PDF in a directory called _book.

So after Rstudio and the R packages are installed start with editing the title page data in index.Rmd in RStudio and try Build Book to compile. Note: The first time you build the document, the required LaTeX packages will be installed with tlmgr (tex live manager) and this will take longer than subsequent builds.

Potential Issues When Building For The First Time

Error: trying to use CRAN without setting a mirror

In cases that I have come across this error, removing R, RStudio and reintallation has fixed the issue.

Incompatibility of Biblatex and Biber versions

The solution will depend on the current versions that are compatible but the first port of call is to update the biber version to the latest version and try again.

# from R tex live package use function tlmgr_remove to remove package biber
tinytex::tlmgr_remove('biber')

# from R tex live package use function tlmgr_install to install package biber
tinytex::tlmgr_install('biber')

# print biber package info
tinytex::tlmgr('list biber')

# print biblatex package info
tinytex::tlmgr('list biblatex')

Advantages of RMarkdown

  • Markdown is a very simple and clear language
  • Formatting is visible and doesn't change without warning
  • More sophisticated LaTeX language can be used for precise formatting or for mathematical formula
  • Rendering is done manually which speeds up the writing process i.e. no lagging or crashes in large image-filled Word documents
  • Microsoft is quite slow on Macs
  • Table of contents, tables, figures and bibliography are handled exceptionally well and are automatic
  • Easily add comments to section or comment out whole sections
  • Small .Rmd files can easily be pushed to the cloud (i.e. Git, Google Drive) to backup the latest version and version control
  • RMarkdown can be converted not just to PDF but to many other formats including MS Word documents so you to chang your mind or convert for others to edit
  • Load data in the document and display it as a table straight away
  • Graphs can also be created inplace meaning that any changes can be immediately incorporated rather than resaving the image and reinserting it
  • All formatting options are contained in a file that once in place can be ignored
  • If you are just writing (no compiling) all you need is a simple text editor making the writing process extremely portable

RMarkdown and Bookdown

From https://rmarkdown.rstudio.com/authoring_quick_tour.html:

"Creating documents with R Markdown starts with an .Rmd file that contains a combination of markdown (content with simple text formatting) and R code chunks. The .Rmd file is fed to knitr, which executes all of the R code chunks and creates a new markdown (.md) document which includes the R code and it’s output.

The markdown file generated by knitr is then processed by pandoc which is responsible for creating a finished web page, PDF, MS Word document, slide show, handout, book, dashboard, package vignette or other format.

This may sound complicated, but R Markdown makes it extremely simple by encapsulating all of the above processing into a single render function. Better still, RStudio includes a “Knit” button that enables you to render an .Rmd and preview it using a single click or keyboard shortcut."

Rmd --> knitr --> md --> pandoc --> publishable content

For more information on RMarkdown see: https://rmarkdown.rstudio.com/index.html For more information on bookdown see: https://bookdown.org/yihui/bookdown/

About

Monash University Science PhD thesis template using Rmarkdown with the bookdown package

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages