It would be useful to have a RMarkdown template for typical (academic) reports such as class assigments and bachelor/master thesises. The LaTeX class “report” provides a suitable format for that. This package provides a simple wrapper around this class built on the standard pandoc template.
Thanks to
Yart, ie, this package leans on earlier work by Aaron Wolen in his pandoc-letter repository, and extends it for use from R via the rmarkdown package. The structure of this package is heavily inspired by Dirk Eddenbuettel’s nice tamplate package linl.
The bulk of the work has been done by John McFarlane’s pandoc, Donald Knuth’s LaTeX, and Yihui Xie’s knitr, along with the earlier work of many.
What is yart?
Yart is a R package that provides a RMarkdown template suitable for (academic) reports. Users write basically only content with a few metadata (such as title, school’s name etc), and the template translates all that to LaTeX which is then being rendered to a PDF file.
The following screenshot shows on the left hand side the raw markdown file and on the right hand side the compiled pdf paper.
Features
Being built on Pandoc, yart provides the typical features of Pandoc’s Markdown, inculding citation, figures, tables and references thereto – and basically, via a template, the fully featured LaTeX beauty. Being built on RMarkdown/knitr, R can be knitted into the text document.
The specific add-on of this template is that it configurates a LaTeX template suitable for (academic) reports so that the user does not have to deal with the LaTeX peculiarities and can focus on writing/contents. There are a number of levers which can be adapted by the used in the yart template including author name, title, subtitle, address, date, referee’s name, assignment name, school’s name, due date.
Installation
Install via R from Github:
devtools::install_github("sebastiansauer/yart")
LaTeX needs to be installed.
Example
Skeleton
The skeleton creates a very simple letter.
Several formatting defaults are in use. See help(yart)
for a
complete list and default values.
Vignette
The vignette example is a little more featureful and shows how to include a letterhead on-demand, a signature, and a few formatting settings.
Usage
First, open as a Markdown template via RStudio via File > New File > RMarkdown > From Template > YART. The template list or Rmarkdown should feature the YART template upon the package installation:
Second, “knit” to document to pdf:
or use code such as
library(rmarkdown)
draft("my_report.Rmd", template="pdf", package="yart", edit=FALSE)
render("my_report.Rmd")
to create a first draft of a new my_report.Rmd
.
Demo video
Bugs, Feedback, Issues
Please report issues here along with a reproducible example if possible.
Related work
A number of R packages for RMarkdown templates for PDF documents are available including
Author
Sebastian Sauer
License
GPL-3 for this package, the work in pandoc-letter, as well as underlying Pandoc template.