Installation

This template can be installed into your R-library with:

devtools::install_github("tufterhandout", "sachsmc")

After installation, open a Tufte .Rmd template, then modify the YAML header to read as :

output: tufterhandout::html_tufte_handout

Introduction

The Tufte- 1 document classes define a style similar to the style Edward Tufte uses in his books and handouts. Tufte’s style is known for its extensive use of sidenotes, tight integration of graphics with text, and well-set typography.

Headings

This style provides a- and b-heads (that is, # and ##), demonstrated above. An error is emitted if you try to use ### and smaller headings.

2, Tufte starts each section with a bit of vertical space, a non-indented paragraph, and sets the first few words of the sentence in small caps. To accomplish this using this style, use the \newthought command as demonstrated at the beginning of this paragraph.

Figures

Margin Figures

Images and graphics play an integral role in Tufte’s work. To place figures or tables in the margin you can use the fig.margin knitr chunk option. For example:

# https://github.com/sachsmc/tufterhandout
# https://nsaunders.wordpress.com/2012/08/27/custom-css-for-html-generated-using-rstudio/
# http://rmarkdown.rstudio.com/html_document_format.html#creating-a-website
# http://www.techrepublic.com/article/build-full-featured-sites-with-jekyll-bootstrap-and-github/
# http://ialsa.github.io/tutorials/ # supports commenting
library(ggplot2)
qplot(Sepal.Length, Petal.Length, data = iris, color = Species)

Note the use of the fig.cap chunk option to provide a figure caption. You can adjust the proportions of figures using the fig.width and fig.height chunk options. These are specified in inches, and will be automatically scaled down to fit within the handout margin.

Equations

You can also include  equations in the margin by explicitly invoking the marginfigure environment.

Note the use of the \caption command to add additional text below the equation.

Full Width Figures

You can arrange for figures to span across the entire page by using the fig.fullwidth chunk option.

qplot(wt, mpg, data=mtcars, colour=factor(cyl))

Note the use of the fig.width and fig.height chunk options to establish the proportions of the figure. Full width figures look much better if their height is minimized.

Main Column Figures

Besides margin and full width figures, you can of course also include figures constrained to the main column.

qplot(factor(cyl), mpg, data = mtcars, geom = "boxplot")

Sidenotes

One of the most prominent and distinctive features of this style is the extensive use of sidenotes. There is a wide margin to provide ample room for sidenotes and small figures. Any use of a footnote will automatically be converted to a sidenote. 3

If you’d like to place ancillary information in the margin without the sidenote mark (the superscript number), you can use the \marginnote command.

Note also that the two footnote references (tufte_latex and books_be, both defined below) were also included in the margin on the first page of this document.

Tables

You can use the xtable package to format  tables that integrate well with the rest of the Tufte handout style. Note that it’s important to set the xtable.comment and xtable.booktabs options as shown below to ensure the table is formatted correctly for inclusion in the document.

library(xtable)
options(xtable.comment = FALSE)
options(xtable.booktabs = TRUE)
xtable(head(mtcars[,1:6]), caption = "First rows of mtcars")

  1. https://code.google.com/p/tufte-latex/

  2. http://www.edwardtufte.com/tufte/books_be

  3. This is a sidenote that was entered using a footnote.