| Type: | Package |
| Title: | Tufte's Styles for R Markdown Documents |
| Version: | 0.15.0 |
| Description: | Provides R Markdown output formats to use Tufte styles for PDF and HTML output. |
| License: | GPL-3 |
| URL: | https://github.com/rstudio/tufte |
| BugReports: | https://github.com/rstudio/tufte/issues |
| Imports: | htmltools, knitr (≥ 1.28), rmarkdown (≥ 2.11), xfun (≥ 0.13) |
| Suggests: | xml2, bookdown, covr, testthat (≥ 3.1.0), tinytex, withr (≥ 2.3.0) |
| Config/testthat/edition: | 3 |
| Config/roxygen2/markdown: | TRUE |
| Config/roxygen2/version: | 8.0.0 |
| Encoding: | UTF-8 |
| NeedsCompilation: | no |
| Packaged: | 2026-05-21 15:08:54 UTC; chris |
| Author: | Yihui Xie |
| Maintainer: | Christophe Dervieux <cderv@posit.co> |
| Repository: | CRAN |
| Date/Publication: | 2026-05-21 16:30:02 UTC |
tufte: Tufte's Styles for R Markdown Documents
Description
Provides R Markdown output formats to use Tufte styles for PDF and HTML output.
Author(s)
Maintainer: Christophe Dervieux cderv@posit.co (ORCID) [contributor]
Authors:
Yihui Xie xie@yihui.name (ORCID)
JJ Allaire
Other contributors:
Andrzej Oles [contributor]
Dave Liepmann (Tufte CSS in inst/rmarkdown/templates/tufte_html/resources) [contributor]
Posit Software, PBC (ROR) [copyright holder, funder]
See Also
Useful links:
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 = "auto",
dev = "pdf",
highlight = "default",
margin_fig_pos = NULL,
...
)
tufte_book(
fig_width = 4,
fig_height = 2.5,
fig_crop = "auto",
dev = "pdf",
highlight = "default",
margin_fig_pos = NULL,
...
)
tufte_handout2(...)
tufte_book2(...)
tufte_html2(...)
tufte_html(
...,
tufte_features = c("fonts", "background", "italics"),
tufte_variant = c("default", "envisioned"),
margin_references = TRUE
)
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
|
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 |
margin_fig_pos |
Default vertical offset for margin figures (a LaTeX
length such as |
... |
Other arguments to be passed to |
tufte_features |
A character vector of style features to enable:
|
tufte_variant |
A variant of the Tufte style. Currently supported styles
are |
margin_references |
Whether to place citations in margin notes. |
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/.
tufte_handout2() and tufte_book2() are wrappers around
bookdown::pdf_book() that use the corresponding tufte format as the
base format. They support bookdown text references ((ref:label)) in
figure and table captions, cross-references, and other bookdown
extensions. Requires the bookdown package to be installed.
tufte_html() provides the HTML format based on the Tufte CSS:
https://edwardtufte.github.io/tufte-css/.
tufte_html2() is a wrapper around bookdown::html_document2()
that uses tufte_html() as the base format, enabling text references
and cross-references. Requires the bookdown package.
newthought() can be used in inline R expressions in R
Markdown
`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 works in
any HTML or LaTeX output format, not only tufte formats, and tries to
render text consistently across formats:
If
textstarts with"---"(or an em-dash), an em-dash + non-breaking space is rendered before the rest of the text in every output. The leading"---"is stripped fromtextto avoid duplication when the destination format would otherwise inject its own em-dash.For tufte HTML,
textis wrapped in a<footer>element styled bytufte.css. For non-tufte HTML (e.g.rmarkdown::html_document(), includingbslibBootstrap 4 and 5 themes),textis wrapped in a<footer class="blockquote-footer">so that Bootstrap's.blockquote-footerstyling (including the::beforeem-dash) applies. An inlinetext-align: rightis added in both cases.For LaTeX output (tufte or non-tufte),
textis prepended with ‘\hfill’ to right-align it. Pandoc's smart-punctuation extension converts a leading"---"to an em-dash glyph.
quote_footer() detects whether the active output is a tufte format via
the tufte.format entry that the tufte output formats register in
knitr::opts_knit.
sans_serif() applies sans-serif fonts to text.
Value
tufte_handout(), tufte_book(), tufte_html(), and the
bookdown wrappers tufte_handout2(), tufte_book2(), and
tufte_html2() return an R Markdown output format object that can
be passed to rmarkdown::render(). The inline helpers
newthought(), margin_note(), quote_footer(), and
sans_serif() return a character string with HTML or LaTeX markup
depending on the active output format.
References
See https://rstudio.github.io/tufte/ for an example.
Examples
library(tufte)
newthought("In this section")