A Quarto Page Layout Example

Inspired by Tufte Handout, Using Quarto

2022-01-23

Introduction

This document demonstrates the use of a number of these page layout features to produce an attractive and usable document inspired by the Tufte handout style and the use of Tufte’s styles in RMarkdown documents (Xie, Allaire, and Grolemund 2018). The Tufte handout style is a style that 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. Quarto1 supports most of the layout techniques that are used in the Tufte handout style for both HTML and LaTeX/PDF output.

  • 1 To learn more, you can read more about Quarto or visit Quarto’s Github repository.

  • Xie, Yihui, J. J. Allaire, and Garrett Grolemund. 2018. “Tufte Handouts.” In, 137–46. Chapman; Hall/CRC. https://doi.org/10.1201/9781138359444-6.
    ---
    title: "An Example Using the Tufte Style"
    author: "John Smith"
    format:
      html: default
      pdf: default
      
    # places footnotes and cited sources in the margin
    # other layout options (for example placing a 
    # figure in the margin)  will be set on per element
    # in examples below
    reference-location: margin
    ---

    These layout features are designed with two important goals in mind:

    1. To produce both PDF and HTML output with similar styles from the same Quarto document;
    2. To provide simple syntax to write elements of the Tufte style such as side notes and margin figures. If you’d like a figure placed in the margin, just set the option fig-column: margin for your code chunk, and we will take care of the details for you2.
  • 2 You never need to think about \begin{marginfigure} or <span class="marginfigure">; the LaTeX and HTML code under the hood may be complicated, but you never need to learn or write such code.

  • If you have any feature requests or find bugs in this capabilities, please do not hesitate to file them to https://github.com/quarto-dev/quarto-cli/issues.

    Figures

    Margin Figures

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

    library(ggplot2)
    Warning: replacing previous import 'lifecycle::last_warnings' by
    'rlang::last_warnings' when loading 'tibble'
    mtcars2 <- mtcars
    mtcars2$am <- factor(
      mtcars$am, labels = c('automatic', 'manual')
    )
    ggplot(mtcars2, aes(hp, mpg, color = am)) +
      geom_point() + geom_smooth() +
      theme(legend.position = 'bottom')

    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.

    Arbitrary Margin Content

    You can include anything in the margin by places the class .column-margin on the element. See an example on the right about the first fundamental theorem of calculus.

    We know from the first fundamental theorem of calculus that for \(x\) in \([a, b]\):

    \[\frac{d}{dx}\left( \int_{a}^{x} f(u)\,du\right)=f(x).\]

    Full Width Figures

    You can arrange for figures to span across the entire page by using the chunk option fig-column: page-right.

    ggplot(diamonds, aes(carat, price)) + geom_smooth() +
      facet_grid(~ cut)