tufte_handout: Tufte handout formats (PDF and HTML)

View source: R/tufte_pdf.R

tufte_handoutR Documentation

Tufte handout formats (PDF and HTML)

Description

Templates for creating handouts according to the style of Edward R. Tufte and Richard Feynman.

Usage

tufte_handout(
  fig_width = 4,
  fig_height = 2.5,
  fig_crop = TRUE,
  dev = "pdf",
  highlight = "default",
  ...
)

tufte_book(
  fig_width = 4,
  fig_height = 2.5,
  fig_crop = TRUE,
  dev = "pdf",
  highlight = "default",
  ...
)

newthought(text)

margin_note(text, icon = "⊕")

quote_footer(text)

sans_serif(text)

Arguments

fig_width

Default width (in inches) for figures

fig_height

Default height (in inches) for figures

fig_crop

Whether to crop PDF figures with the command pdfcrop. This requires the tools pdfcrop and ghostscript to be installed. By default, fig_crop = TRUE if these two tools are available.

dev

Graphics device to use for figure output (defaults to pdf)

highlight

Syntax highlighting style passed to Pandoc.

Supported built-in styles include "default", "tango", "pygments", "kate", "monochrome", "espresso", "zenburn", "haddock", and "breezedark".

Two custom styles are also included, "arrow", an accessible color scheme, and "rstudio", which mimics the default IDE theme. Alternatively, supply a path to a .theme file to use a custom Pandoc style. Note that custom theme requires Pandoc 2.0+.

Pass NULL to prevent syntax highlighting.

...

Other arguments to be passed to pdf_document or html_document (note you cannot use the template argument in tufte_handout or the theme argument in tufte_html(); these arguments have been set internally)

text

A character string to be presented as a “new thought” (using small caps), or a margin note, or a footer of a quote

icon

A character string to indicate there is a hidden margin note when the page width is too narrow (by default it is a circled plus sign)

Details

tufte_handout() provides the PDF format based on the Tufte-LaTeX class: https://tufte-latex.github.io/tufte-latex/.

newthought() can be used in inline R expressions in R Markdown (e.g. `r newthought(Some text)`), and it works for both HTML (<span class="newthought">text</span>) and PDF (\newthought{text}) output.

margin_note() can be used in inline R expressions to write a margin note (like a sidenote but not numbered).

quote_footer() formats text as the footer of a quote. It puts text in <footer></footer> for HTML output, and after \hfill for LaTeX output (to right-align text).

sans_serif() applies sans-serif fonts to text.

References

See http://rstudio.github.io/tufte for an example.

Examples

newthought('In this section')

CenterForAssessment/packagePages documentation built on May 31, 2022, 1:56 p.m.