Coder Social home page Coder Social logo

tint's Introduction

tint: Tint is not Tufte

CI Package-License CRAN Dependencies Downloads Last Commit

Motivation

The (html and pdf) styles provided by the tufte package make it very easy and convenient to create documents in the celebrated style of Edward Tufte.

The clear layout, focused use of white space and unparalleled use of the margin for complementary information, including graphs, offer a novel and very valuable resource for typesetting.

Yet at the same time, not everybody is a fan of the yellow tint, and the fonts. I had been looking for a while for an alternative, and came across envisioned css by Jef Lippiat. It gets a few things very right: use of the beautiful Roboto Condensed font along with a closer-to-white background. So I mixed this with the code framework provided by JJ and Yihui to make it an RMarkdown template you can use just by installing this package. Among the small changes I made were the removal of italics in subheaders and the title.

Similarly, LaTeX styles exists and the tufte package supports both pdf handouts and a book format. We first supported the pdf handout output only, and added support for a pdf book format in release 0.1.0.

Example

HTML

A quick screenshot of the html variant is below:

and the full underlying document is available too. Its sources are included in the packages as html/skeleton.Rmd.

PDF

Another screenshot shows the pdf handout variant:

and its underlying sources are included as pdf/skeleton.Rmd.

Here is a screenshot of the book format (which was added with release 0.1.0), showing a chapter-opening page on the left:

PDF Font Variants

Since release 0.1.1 additional fonts can be specified in the YAML header. Using the following lines in the YAML header

latexfonts: 
  - package: newtxmath
    options: 
      - cmintegrals
      - cmbraces
  - package: ebgaramond-maths
  - package: nimbusmononarrow

yields output as in the following screenshot of the first two vignette pages:

A second example is using

latexfonts: 
  - package: lato
    options: default
  - package: FiraMono
linkcolor: "0.3,0.3,0.6"

which also show the linkcolor option resulting in

Status

The package is now on CRAN and supports both pdf and html output for handouts, as well as pdf format for book-length documents. This latter style can be used with rmarkdown or bookdown.

Usage

Install from CRAN as any other package via

R> install.packages("tint")

and then use as a Markdown template via RStudio, or call rmarkdown::render() directly. We have also used the book-length format via bookdown::render_book().

Requirements

Beyond the R package dependencies, a working pandoc binary is needed. RStudio installs its own copy, otherwise do what is needed on your OS (i.e., something like sudo apt-get install pandoc pandoc-citeproc).

The pdf mode requires a fairly complete LaTeX installation. On Debian/Ubuntu, the following packages should provide a working set:

texlive-base
texlive-binaries
texlive-fonts-extra
texlive-fonts-recommended
texlive-generic-recommended
texlive-humanities
texlive-latex-base
texlive-latex-extra
texlive-latex-recommended
texlive-pictures

See Also

Other RMarkdown Packages

  • binb: Binb is not Beamer: Stylish pdf Presentations from RMarkdown
  • linl: Linl is not Letter: LaTeX letters from RMarkdown
  • pinp: Pinp is not PNAS: Snazzy one-or two column short papers or vignettes

and the minm package installing all of them.

Sidenotes

Gwern Branwen has a wide-ranging overview of sidenotes in web design.

Authors

Dirk Eddelbuettel and Jonathan Gilligan, borrowing heavily from JJ and Yihui in tufte, Dave Liepman in the underlying tufte-css, Jef Lippiat in envisioned css and also relying on the work of the Tufte-LaTeX authors.

License

GPL-3 for our parts and the code from tufte, mostly MIT for what comes from Dave Liepman and Jef Lippiat.

tint's People

Contributors

benmarwick avatar eddelbuettel avatar jonathan-g avatar mhenderson avatar rmsharp avatar selbosh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tint's Issues

Re-using Citation

Probably not directly a tint problem/feature, but is it possible to re-use a citation? Right now I'm rendering an Rmd which uses tintPdf as the output. When I cite something a second time, it gets a new number and the full reference is repeated in the margin. Is there a way to get tint to re-use the citation numbers when appropriate? Seems like I need something in the Rmd, maybe the yaml, that tint will pass through to other processors. Thanks for any hints.

Numbering sections error

When I try using number_sections: true in my header to add section numbering and knit I get an error from yaml. Is this because numbered sections aren't allowed in tint, and if so is it possible to override that?

cross references

I really like the look of tint::tintHtml. Is it possible to use cross references for figures and tables like in ?bookdown::tufte_html2 with \@ref(fig:chunk_name)?

Subtitle not working if the output is pdf

Hello,

I noticed that the subtitle is not show if the output is pdf. I tried it with the template provided when I open a new tint pdf rmarkdown document. Is this a known issue?

Thank you,

Claudio

keep_tex: true not supported

There are instances where I would need to integrate this output into latex, and it would be valuable to have an option like

output: tint::tintPdf:
   keep_tex: true

However, it is not supported, and returns:

Error in yaml::yaml.load(..., eval.expr = TRUE) :
Scanner error: mapping values are not allowed in this context at line 5, column 22
Calls: ... parse_yaml_front_matter -> yaml_load ->
Execution halted

If a workaround exists, I can't figure it out.

Book version or bookdown support?

Tint is awesome, thanks for the package.

Is there a way of printing a tufte-book version of tint? Better yet, is there support for bookdown?

Thank you,

toc fonts not the same in pdf handout

Hello -

Here is a screenshot of the pdf output with contents included. Thanks.

---
title: "Tint Is Not Tufte"
subtitle: "An implementation in R Markdown"
author: "JJ Allaire, Yihui Xie, Dirk Eddelbuettel"
date: "`r Sys.Date()`"
output:
  tint::tintPdf :
    toc: yes

---

```{r setup, include=FALSE}
library(tint)
# invalidate cache when the tufte version changes
knitr::opts_chunk$set(tidy = FALSE, cache.extra = packageVersion('tint'))
options(htmltools.dir.version = FALSE)


# Section I
# Section II
## Subsection A
# Section III

PDF

untitled 1

R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods  
[7] base     

Knitting in pdf fail

Hello,

I wanted to use the pdf output format from tint and i cant't figure why pdflatex is failing to generate the pdf.
I tried the default template from the tint 0.0.2 package and hitted the knit button in rstudio (same thing happen when i use rmarkdown::render() ) and got this output :

/usr/lib/rstudio-server/bin/pandoc/pandoc +RTS -K512m -RTS tint_test.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output tint_test.pdf --template /usr/local/lib/R/site-library/tint/rmarkdown/templates/pdf/resources/tintPdf-template.tex --highlight-style pygments --latex-engine pdflatex --variable 'documentclass:tufte-handout' --bibliography skeleton.bib --filter /usr/lib/rstudio-server/bin/pandoc/pandoc-citeproc 
output file: tint_test.knit.md

! Undefined control sequence.
\maketitle ...p \thispagestyle {plain}\tuftebreak 
                                                  \@afterindentfalse \@after...
l.165 \maketitle

pandoc: Error producing PDF from TeX source
Erreur : pandoc document conversion failed with error 43
Exécution arrêtée

The tufte version works (but has horrible font :p ).

Make tint compatible with rmarkdown pages

I'd like to see tint made compatible with rmarkdown pages and their floating TOC, website header, and other features. I wonder if this would be possible? I'm willing to work on this myself but thought I'd check to see if it's already being considered (or whether there are any known major hurdles).

Is there a way to add vertical space between sidenotes

Hello Dirk,
I am working on a PDF using tint using lots of margin notes for figures and text. This is the link to the Rmd file, if you are interested in seeing it.: https://github.com/f0nzie/transcript_interview_john_hopfield_by_lex_fridman/blob/master/John_Hopfield-Physics_View_of_the_Mind_and_Neurobiology-AI_Podcast_76_with_Lex_Fridman-tint.Rmd

What I noticed is that these sidenotes have a small vertical spacing between them. This is an example of one of the pages:

image

I have been exploring ways to add more vertical space but I have not been successful even when adding a custom .tex template; I am able to modify the section titles but could not find a way to make changes to the sidenotes.

Any thoughts?

html format book length needs a new framework

The tufte-book class made the tintBook pdf variant possible.

There is nothing (yet) for html that is really comparable. The gitbook default for bookdown has a tufte variant but I find it lacking. The navigation bar is pretty awful.

We would need some proper js / css / html help, and it may be a fair amount of work. In the meantime, the pdf variant is functional.

Side note with blockquote or table has different alignment

I would like the ability to add side notes from within tables and blockquotes. If I figure out a method that works for either of these options, I'll add it to this request.

I did ask the question, regarding the table and side note on Stack Overflow, but didn't get any answers from the community. I ended up taking the footer out of the table and used inline styling to adjust the margin and line height, so it would look as if it were a part of the table. You can read the question I posed with images of the issue here: https://stackoverflow.com/questions/67310557/table-footer-with-linked-margin-note-creating-large-break-in-text/67317471#67317471

Using blockquotes with a side note created a side note shifted to the left, no longer in line with the other side notes. I tried both the pdf and HTML templates and a lot of different styling methods to make these elements work without success. I ended up using an independent margin note, instead of linking the text to the side note.

The syntax for either of these issues was almost as 'vanilla' as you can get. The SO question depicts coding an image, as it occurs with the table. Below I've provided coding to demonstrate what happens when you use a side note with a block quote.

---
title: "Tint Is Not Tufte"
subtitle: "An example of a blockquote with and without a side note"
date: "`r Sys.Date()`"
output: tint::tintHtml
bibliography: skeleton.bib
link-citations: yes
---
library(tint)
# invalidate cache when the package version changes
knitr::opts_chunk$set(tidy = FALSE, cache.extra = packageVersion('tint'))
options(htmltools.dir.version = FALSE)
This is traditional text.

>"Now I really want to blockquote myself to demonstrate what happens with a side note.[^1]

[^1]: Check out this awesome side note.

Now I really want to demonstrate the difference with a p tagged text element with a side note.[^2]

[^2]: The side notes don't align.

Thanks!

image

pictures inside marginfigure chunk

I love tint, just started using it for a wide variety of documents. However, when I try to insert a figure inside a marginfigure, the html output gets shifted to the right far beyond the remaining margin content. I know the advice is to keep the margingfigure content as simple as possible, but does that necessarily include not adding figures?

My code:

{marginfigure}
![](bulldog.jpg)

`
The output:

screenshot from 2016-10-09 17-05-57

Can't change default font

Hi,

I couldn't find a way to change the default font for both the PDF and html outputs. Is there a way to do this from the Markdown document (YAML header)?

I've tried:
header-includes:

  • \usepackage{fontspec}
  • \renewcommand{\familydefault}{\rmdefault}
  • \setmainfont{Pacetta Pro}

but I get an error when trying to load the "fontspec" package. I get the following error:

"Fatal fontspec error: "cannot-use-pdftex"
!
! The fontspec package requires either XeTeX or LuaTeX."

Any ideas?
Thank you!

\@ref(fig:name) within tintBook

I really like the tintBook setup so far.

It would be great to add the ability to reference tables and figures using the book down syntax \@ref(<type>:<name>) — where <type> is something like fig or tab, and <name> is the R code chunk name — within tintBook.

Package array needed for tables

Re-running an earlier pdf document revealed

! Undefined control sequence.
<argument> @{} >{\raggedright \arraybackslash 
                                              }p{(\columnwidth - 4\tabcolsep...
l.329 ...mnwidth - 4\tabcolsep) * \real{0.30}}@{}}                     

?

which can be fixed via \usepackage{array} which we should probably add.

Side references in pdf

I know it is not implemented in tufte, but I would like to use side references in PDF output as it is in HTML.

Is it at all possible?

I know this is a feature request and not an issue, and I am not even sure this is the place to make a request. If it is not, I will close it right away, just notify me.

Path to skeleton.bib

When I build the template example of tint (Date: 2018-04-08) under Windows and tinytex/texlive, I get

I couldn't open database file skeleton.bib.bib
---line 121 of file aaa.aux
 : \bibdata{skeleton.bib
 :  

Solution: Use bibliography: ./skeleton.bib in YAML

Roberto Condensed a fine sans-serif, but

an option to select a serif font is essential for any application that will have large text blocks. Especially if the hardwired font is so heavy on the page. Also, the text runs off the bottom of the page sometimes.

Like the overall simplification, tho'

pdf header control

Is there a way to control header text on pdf handouts?

Updated to new version 0.1.2 of tint and the pdf header is now lower case instead of small caps as in previous versions.

marginfigure doesn't show when echo=FALSE globally

When reporting to clients, they tend not to care (nor wish) to see the code. This means it's common to set knitr options such that echo=FALSE. With this option set, arbitrary marginfigure chunk content is not shown and this fact is not otherwise documented. However, it's easily fixed by add echo=TRUE to the marginfigure chunk option. I do not know if this effects the LaTeX version, as I don't use latex.

I submitted a PR to rstudio/tufte for this, not sure if your repo will pick it up automatically or not:

rstudio/tufte#24

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.