Type: | Package |
Title: | 'tint' is not 'Tufte' |
Version: | 0.1.5 |
Date: | 2025-03-27 |
Description: | A 'tufte'-alike style for 'rmarkdown'. A modern take on the 'Tufte' design for pdf and html vignettes, building on the 'tufte' package with additional contributions from the 'knitr' and 'ggtufte' package, and also acknowledging the key influence of 'envisioned css'. |
URL: | https://github.com/eddelbuettel/tint/, https://dirk.eddelbuettel.com/code/tint.html |
BugReports: | https://github.com/eddelbuettel/tint/issues |
Imports: | htmltools, knitr, rmarkdown |
Suggests: | ggplot2 |
VignetteBuilder: | knitr |
License: | GPL-3 |
RoxygenNote: | 6.0.1 |
Encoding: | UTF-8 |
NeedsCompilation: | no |
Packaged: | 2025-03-27 22:46:46 UTC; edd |
Author: | Dirk Eddelbuettel |
Maintainer: | Dirk Eddelbuettel <edd@debian.org> |
Repository: | CRAN |
Date/Publication: | 2025-03-27 23:00:02 UTC |
Custom document templates
Description
Using custom document templates
Details
If you want to make more significant changes to the document styles, you can make custom Pandoc templates, using the examples provided with this package.
You will need to have some expertise with LaTeX to do this, but you
can take the templates, such as tintPdf-template.tex
or tintBook-template.tex
, which you can locate on your computer with
system.file("rmarkdown", "templates", "tintPdf", "resources", "tintPdf-template.tex", package="tint")
and
system.file("rmarkdown", "templates", "tintBook", "resources", "tintBook-template.tex", package="tint")
Copy those files to the folder where your RMarkdown file is located and edit them and then
tell tint to use your custom template instead of its built-in ones by using
the YAML attribute template
in your output
block:
output: tint::tintPdf: template: "my-custom-template.tex"
See Also
Customizing PDF document styles
Description
Using YAML metadata to customize PDF documents.
Details
You can easily customize fonts and a few other style attributes of
PDF documents (tintPdf
and tintBook
) with
YAML metadata
Changing the fonts
You can use the fonts from the default tufte
styles by setting
defaultfonts: true
You can choose custom LaTeX font packages using latexfonts
:
latexfonts: "bera"
will use Bera Serif fonts. You can also specify multiple fonts (for instance serif, sans-serif, and typewriter families)
latexfonts: - "bera" - "FiraSans" - "FiraSansMono"
will use the Bera Serif font for regular text, Fira Sans Regular for sans serif, and Fira Sans Mono for typewriter.
You can also pass options to the packages:
latexfonts: - package: newtxmath options: - cmintegrals - cmbraces - package: ebgaramond-maths - package: nimbusmononarrow
will use EB Garamond, with matching maths fonts from the newtxmath
package, and Nimbus Mono Narrow for the typewriter font.
If you want to specify a sans-serif font for the main text, many packages allow you to do this with options: The default for tint is to use the equivalent of
latexfonts: - package: roboto options: - sfdefault - condensed
where sfdefault
specifies that the default text font should be Roboto.
Other packages use different options, such as Lato, another sans-serif
font, which you would specify as the main font like this:
latexfonts: - package: lato options: default
Link Color
Changing the link color
By default, tint uses a grayish-blue color for hyperlinks. If you want to
change this, you can use the YAML linkcolor
variable either as a
string with three numbers (red, green, and blue) separated by commas:
linkcolor: "0.3,0.3,0.6"
which gives a subtler bluish-gray, or as a list of three colors:
linkcolor: - 0.5 - 0.2 - 0.5
which gives a mauve color.
See Also
A 'Tufte'-inspired 'ggplot2' theme
Description
A 'Tufte'-inspired 'ggplot2' theme for the 'tint' package
Usage
theme_tint(base_size = 11, ticks = TRUE)
Arguments
base_size |
An integer value for the base tick size, default is 11. |
ticks |
A logical value indicating if ticks should be drawn,
default is |
Details
This theme is borrows heavily from a similar theme in ggtufte by Jeffrey Arnold (but removes his font processing as it conflicts with ours).
Value
A modified theme for ggplot2 use
Author(s)
Dirk Eddelbuettel modifying earlier work by Jeffrey Arnold
Tint Is Not Tufte – A Tufte-Inspired HTML Format
Description
A template for creating html reports according to the style of
Edward R. Tufte and Richard Feynman, but with an updated font
choice. The three key functions tintHtml
, tintPdf
and tintBook
offer, respectively, support for html and
pdf-based shorter (“article-length” writeups as well as
support for longer pdf-based content.
Usage
tintHtml(...)
tint(...)
tintPdf(fig_width = 4, fig_height = 2.5, fig_crop = TRUE, dev = "pdf",
highlight = "tango", citation_package = "natbib",
latex_engine = "pdflatex", ...)
tintBook(fig_width = 4, fig_height = 2.5, fig_crop = TRUE, dev = "pdf",
highlight = "tango", citation_package = "natbib",
latex_engine = "pdflatex", ...)
newthought(text)
margin_note(text, icon = "⊕")
quote_footer(text)
sans_serif(text)
Arguments
... |
Other arguments to be passed to
Note: For |
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 |
citation_package |
The LaTeX package to process citations, |
latex_engine |
LaTeX engine for producing PDF output. Options are "pdflatex", "lualatex", "xelatex" and "tectonic". |
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
tintHtml
provides the HTML format based on the Tufte CSS
https://edwardtufte.github.io/tufte-css/ with fonts set according to
https://github.com/nogginfuel/envisioned-css.
tintPdf
provides a similar PDF format using the same font family and
styling applied to the Tufte-LaTeX
https://tufte-latex.github.io/tufte-latex/ class.
tintBook
is a (still somewhat experimental) pdf book variant.
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 https://rstudio.github.io/tufte/ for the tufte package this was initially derived from. See https://eddelbuettel.github.io/tint/ for usage examples from this package.