$title$
47 | $if(subtitle)$ 48 |$subtitle$
49 | $endif$ 50 | $if(date)$ 51 | 52 | $else$ 53 | $if(author)$ 54 | 55 | $endif$ 56 | $endif$ 57 |├── docs ├── .nojekyll ├── tufte-md │ ├── img │ │ ├── rhino.png │ │ ├── exports-imports.png │ │ ├── napoleons-march.png │ │ ├── imagequilt-animal-sounds.png │ │ ├── table-example-be-page-159.png │ │ └── imagequilt-chinese-calligraphy.png │ ├── et-book │ │ ├── et-book-bold-line-figures │ │ │ ├── et-book-bold-line-figures.eot │ │ │ ├── et-book-bold-line-figures.ttf │ │ │ └── et-book-bold-line-figures.woff │ │ ├── et-book-roman-line-figures │ │ │ ├── et-book-roman-line-figures.eot │ │ │ ├── et-book-roman-line-figures.ttf │ │ │ └── et-book-roman-line-figures.woff │ │ ├── et-book-roman-old-style-figures │ │ │ ├── et-book-roman-old-style-figures.eot │ │ │ ├── et-book-roman-old-style-figures.ttf │ │ │ └── et-book-roman-old-style-figures.woff │ │ ├── et-book-semi-bold-old-style-figures │ │ │ ├── et-book-semi-bold-old-style-figures.eot │ │ │ ├── et-book-semi-bold-old-style-figures.ttf │ │ │ └── et-book-semi-bold-old-style-figures.woff │ │ └── et-book-display-italic-old-style-figures │ │ │ ├── et-book-display-italic-old-style-figures.eot │ │ │ ├── et-book-display-italic-old-style-figures.ttf │ │ │ └── et-book-display-italic-old-style-figures.woff │ ├── latex.css │ ├── tufte-extra.css │ ├── pandoc.css │ ├── pandoc-solarized.css │ ├── tufte.css │ ├── index.md │ └── index.html ├── et-book │ ├── et-book-bold-line-figures │ │ ├── et-book-bold-line-figures.eot │ │ ├── et-book-bold-line-figures.ttf │ │ └── et-book-bold-line-figures.woff │ ├── et-book-roman-line-figures │ │ ├── et-book-roman-line-figures.eot │ │ ├── et-book-roman-line-figures.ttf │ │ └── et-book-roman-line-figures.woff │ ├── et-book-roman-old-style-figures │ │ ├── et-book-roman-old-style-figures.eot │ │ ├── et-book-roman-old-style-figures.ttf │ │ └── et-book-roman-old-style-figures.woff │ ├── et-book-semi-bold-old-style-figures │ │ ├── et-book-semi-bold-old-style-figures.eot │ │ ├── et-book-semi-bold-old-style-figures.ttf │ │ └── et-book-semi-bold-old-style-figures.woff │ └── et-book-display-italic-old-style-figures │ │ ├── et-book-display-italic-old-style-figures.eot │ │ ├── et-book-display-italic-old-style-figures.ttf │ │ └── et-book-display-italic-old-style-figures.woff ├── tufte-extra.css ├── pandoc.css ├── pandoc-solarized.css ├── index.md ├── tufte.css └── index.html ├── .gitignore ├── .gitmodules ├── latex.css ├── Makefile ├── tufte-extra.css ├── tufte.html5 ├── pandoc-solarized.css ├── pandoc.css └── README.md /docs/.nojekyll: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .*.sw[nop] 2 | tags 3 | -------------------------------------------------------------------------------- /docs/tufte-md/img/rhino.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/tufte-md/img/rhino.png -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "tufte-css"] 2 | path = tufte-css 3 | url = https://github.com/edwardtufte/tufte-css.git 4 | -------------------------------------------------------------------------------- /docs/tufte-md/img/exports-imports.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/tufte-md/img/exports-imports.png -------------------------------------------------------------------------------- /docs/tufte-md/img/napoleons-march.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/tufte-md/img/napoleons-march.png -------------------------------------------------------------------------------- /docs/tufte-md/img/imagequilt-animal-sounds.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/tufte-md/img/imagequilt-animal-sounds.png -------------------------------------------------------------------------------- /docs/tufte-md/img/table-example-be-page-159.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/tufte-md/img/table-example-be-page-159.png -------------------------------------------------------------------------------- /docs/tufte-md/img/imagequilt-chinese-calligraphy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/tufte-md/img/imagequilt-chinese-calligraphy.png -------------------------------------------------------------------------------- /docs/et-book/et-book-bold-line-figures/et-book-bold-line-figures.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/et-book/et-book-bold-line-figures/et-book-bold-line-figures.eot -------------------------------------------------------------------------------- /docs/et-book/et-book-bold-line-figures/et-book-bold-line-figures.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/et-book/et-book-bold-line-figures/et-book-bold-line-figures.ttf -------------------------------------------------------------------------------- /docs/et-book/et-book-bold-line-figures/et-book-bold-line-figures.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/et-book/et-book-bold-line-figures/et-book-bold-line-figures.woff -------------------------------------------------------------------------------- /docs/et-book/et-book-roman-line-figures/et-book-roman-line-figures.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/et-book/et-book-roman-line-figures/et-book-roman-line-figures.eot -------------------------------------------------------------------------------- /docs/et-book/et-book-roman-line-figures/et-book-roman-line-figures.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/et-book/et-book-roman-line-figures/et-book-roman-line-figures.ttf -------------------------------------------------------------------------------- /docs/et-book/et-book-roman-line-figures/et-book-roman-line-figures.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/et-book/et-book-roman-line-figures/et-book-roman-line-figures.woff -------------------------------------------------------------------------------- /docs/tufte-md/et-book/et-book-bold-line-figures/et-book-bold-line-figures.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/tufte-md/et-book/et-book-bold-line-figures/et-book-bold-line-figures.eot -------------------------------------------------------------------------------- /docs/tufte-md/et-book/et-book-bold-line-figures/et-book-bold-line-figures.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/tufte-md/et-book/et-book-bold-line-figures/et-book-bold-line-figures.ttf -------------------------------------------------------------------------------- /docs/tufte-md/et-book/et-book-bold-line-figures/et-book-bold-line-figures.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/tufte-md/et-book/et-book-bold-line-figures/et-book-bold-line-figures.woff -------------------------------------------------------------------------------- /docs/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.eot -------------------------------------------------------------------------------- /docs/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.ttf -------------------------------------------------------------------------------- /docs/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.woff -------------------------------------------------------------------------------- /docs/tufte-md/et-book/et-book-roman-line-figures/et-book-roman-line-figures.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/tufte-md/et-book/et-book-roman-line-figures/et-book-roman-line-figures.eot -------------------------------------------------------------------------------- /docs/tufte-md/et-book/et-book-roman-line-figures/et-book-roman-line-figures.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/tufte-md/et-book/et-book-roman-line-figures/et-book-roman-line-figures.ttf -------------------------------------------------------------------------------- /docs/tufte-md/et-book/et-book-roman-line-figures/et-book-roman-line-figures.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/tufte-md/et-book/et-book-roman-line-figures/et-book-roman-line-figures.woff -------------------------------------------------------------------------------- /docs/et-book/et-book-semi-bold-old-style-figures/et-book-semi-bold-old-style-figures.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/et-book/et-book-semi-bold-old-style-figures/et-book-semi-bold-old-style-figures.eot -------------------------------------------------------------------------------- /docs/et-book/et-book-semi-bold-old-style-figures/et-book-semi-bold-old-style-figures.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/et-book/et-book-semi-bold-old-style-figures/et-book-semi-bold-old-style-figures.ttf -------------------------------------------------------------------------------- /docs/et-book/et-book-semi-bold-old-style-figures/et-book-semi-bold-old-style-figures.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/et-book/et-book-semi-bold-old-style-figures/et-book-semi-bold-old-style-figures.woff -------------------------------------------------------------------------------- /docs/tufte-md/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/tufte-md/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.eot -------------------------------------------------------------------------------- /docs/tufte-md/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/tufte-md/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.ttf -------------------------------------------------------------------------------- /docs/tufte-md/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/tufte-md/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.woff -------------------------------------------------------------------------------- /docs/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.eot -------------------------------------------------------------------------------- /docs/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.ttf -------------------------------------------------------------------------------- /docs/tufte-md/et-book/et-book-semi-bold-old-style-figures/et-book-semi-bold-old-style-figures.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/tufte-md/et-book/et-book-semi-bold-old-style-figures/et-book-semi-bold-old-style-figures.eot -------------------------------------------------------------------------------- /docs/tufte-md/et-book/et-book-semi-bold-old-style-figures/et-book-semi-bold-old-style-figures.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/tufte-md/et-book/et-book-semi-bold-old-style-figures/et-book-semi-bold-old-style-figures.ttf -------------------------------------------------------------------------------- /docs/tufte-md/et-book/et-book-semi-bold-old-style-figures/et-book-semi-bold-old-style-figures.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/tufte-md/et-book/et-book-semi-bold-old-style-figures/et-book-semi-bold-old-style-figures.woff -------------------------------------------------------------------------------- /docs/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.woff -------------------------------------------------------------------------------- /docs/tufte-md/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/tufte-md/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.eot -------------------------------------------------------------------------------- /docs/tufte-md/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/tufte-md/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.ttf -------------------------------------------------------------------------------- /docs/tufte-md/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jez/tufte-pandoc-css/HEAD/docs/tufte-md/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.woff -------------------------------------------------------------------------------- /latex.css: -------------------------------------------------------------------------------- 1 | .latex-sub, .latex-sup { text-transform: uppercase; 2 | font-size: smaller; 3 | position: relative; } 4 | 5 | .latex-sub { top: 0.2rem; 6 | margin-left: -0.1667rem; 7 | margin-right: -0.125rem; } 8 | 9 | .latex-sup { top: -0.2rem; 10 | margin-left: -0.36rem; 11 | margin-right: -0.15rem; 12 | text-shadow: none; } 13 | 14 | .latex::selection, .latex span:not(.latex-sup)::selection { text-shadow: 0.03em 0 #b4d5fe, -0.03em 0 #b4d5fe, 0 0.03em #b4d5fe, 0 -0.03em #b4d5fe, 0.06em 0 #b4d5fe, -0.06em 0 #b4d5fe, 0.09em 0 #b4d5fe, -0.09em 0 #b4d5fe, 0.12em 0 #b4d5fe, -0.12em 0 #b4d5fe, 0.15em 0 #b4d5fe, -0.15em 0 #b4d5fe; 15 | background: #b4d5fe; } 16 | 17 | .latex::-moz-selection, .latex span:not(.latex-sup)::-moz-selection { text-shadow: 0.03em 0 #b4d5fe, -0.03em 0 #b4d5fe, 0 0.03em #b4d5fe, 0 -0.03em #b4d5fe, 0.06em 0 #b4d5fe, -0.06em 0 #b4d5fe, 0.09em 0 #b4d5fe, -0.09em 0 #b4d5fe, 0.12em 0 #b4d5fe, -0.12em 0 #b4d5fe, 0.15em 0 #b4d5fe, -0.15em 0 #b4d5fe; 18 | background: #b4d5fe; } 19 | -------------------------------------------------------------------------------- /docs/tufte-md/latex.css: -------------------------------------------------------------------------------- 1 | .latex-sub, .latex-sup { text-transform: uppercase; 2 | font-size: smaller; 3 | position: relative; } 4 | 5 | .latex-sub { top: 0.2rem; 6 | margin-left: -0.1667rem; 7 | margin-right: -0.125rem; } 8 | 9 | .latex-sup { top: -0.2rem; 10 | margin-left: -0.36rem; 11 | margin-right: -0.15rem; 12 | text-shadow: none; } 13 | 14 | .latex::selection, .latex span:not(.latex-sup)::selection { text-shadow: 0.03em 0 #b4d5fe, -0.03em 0 #b4d5fe, 0 0.03em #b4d5fe, 0 -0.03em #b4d5fe, 0.06em 0 #b4d5fe, -0.06em 0 #b4d5fe, 0.09em 0 #b4d5fe, -0.09em 0 #b4d5fe, 0.12em 0 #b4d5fe, -0.12em 0 #b4d5fe, 0.15em 0 #b4d5fe, -0.15em 0 #b4d5fe; 15 | background: #b4d5fe; } 16 | 17 | .latex::-moz-selection, .latex span:not(.latex-sup)::-moz-selection { text-shadow: 0.03em 0 #b4d5fe, -0.03em 0 #b4d5fe, 0 0.03em #b4d5fe, 0 -0.03em #b4d5fe, 0.06em 0 #b4d5fe, -0.06em 0 #b4d5fe, 0.09em 0 #b4d5fe, -0.09em 0 #b4d5fe, 0.12em 0 #b4d5fe, -0.12em 0 #b4d5fe, 0.15em 0 #b4d5fe, -0.15em 0 #b4d5fe; 18 | background: #b4d5fe; } 19 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # What to compile by default? 2 | SOURCES := docs/index.md \ 3 | docs/tufte-md/index.md 4 | TARGETS := $(patsubst %.md,%.html,$(SOURCES)) 5 | 6 | STYLES := tufte-css/tufte.css \ 7 | pandoc.css \ 8 | pandoc-solarized.css \ 9 | tufte-extra.css 10 | 11 | .PHONY: all 12 | all: $(TARGETS) 13 | 14 | # Note: you will need pandoc 2 or greater for this to work 15 | 16 | ## Generalized rule: how to build a .html file from each .md 17 | %.html: %.md tufte.html5 $(STYLES) 18 | pandoc \ 19 | --katex \ 20 | --section-divs \ 21 | --from markdown+tex_math_single_backslash \ 22 | --lua-filter pandoc-sidenote.lua \ 23 | --to html5+smart \ 24 | --template=tufte \ 25 | $(foreach style,$(STYLES),--css $(notdir $(style))) \ 26 | --output $@ \ 27 | $< 28 | 29 | .PHONY: clean 30 | clean: 31 | rm $(TARGETS) 32 | 33 | # The default tufte.css file expects all the assets to be in the same folder. 34 | # In real life, instead of duplicating the files you'd want to put them in a 35 | # shared "css/" folder or something, and adjust the `--css` flags to the pandoc 36 | # command to give the correct paths to each CSS file. 37 | .PHONY: docs 38 | docs: 39 | cp -r $(STYLES) tufte-css/et-book/ docs/ 40 | cp -r $(STYLES) tufte-css/et-book/ tufte-css/img/ tufte-css/latex.css docs/tufte-md/ 41 | -------------------------------------------------------------------------------- /tufte-extra.css: -------------------------------------------------------------------------------- 1 | /* The default x-height for code is slightly too large in side notes */ 2 | .marginnote code, .sidenote code { 3 | font-size: 0.9rem; 4 | } 5 | 6 | /* ... and slightly too small in body text */ 7 | code { 8 | font-size: 1.05rem; 9 | } 10 | 11 | /* Also make the sidenote numbers hang */ 12 | .sidenote { 13 | text-indent: -0.4rem; 14 | } 15 | .sidenote:before { 16 | /* removes trailing space from the counter content */ 17 | content: counter(sidenote-counter); 18 | left: -0.4rem; 19 | } 20 | 21 | /* To get spacing between lists, use paragraphs. 22 | * 0.25rem of spacing between list elements looks bad. */ 23 | li:not(:first-child) { 24 | margin-top: initial; 25 | } 26 | 27 | /* Prevent superscripts and subscripts from affecting line-height */ 28 | sup, sub { 29 | vertical-align: baseline; 30 | position: relative; 31 | top: -0.4em; 32 | } 33 | sub { 34 | top: 0.4em; 35 | } 36 | 37 | /* Replicate styling from sidenote numbers to footnote numbers */ 38 | a.footnote-ref { 39 | background: unset; 40 | text-shadow: unset; 41 | font-size: 1rem; 42 | position: relative; 43 | top: -0.1rem; 44 | left: 0.1rem; 45 | display: inline; 46 | } 47 | .footnote-ref sup { 48 | font-family: et-book-roman-old-style; 49 | font-size: inherit; 50 | vertical-align: inherit; 51 | line-height: inherit; 52 | } 53 | -------------------------------------------------------------------------------- /tufte.html5: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | $for(author-meta)$ 8 | 9 | $endfor$ 10 | $if(date-meta)$ 11 | 12 | $endif$ 13 | $if(keywords)$ 14 | 15 | $endif$ 16 |$subtitle$
49 | $endif$ 50 | $if(date)$ 51 | 52 | $else$ 53 | $if(author)$ 54 | 55 | $endif$ 56 | $endif$ 57 |Starter files for Pandoc Markdown with Tufte CSS
89 | 90 |Tufte Pandoc CSS is an attempt to make it as easy as possible to get started using Tufte CSSIf you’ve never heard of Tufte CSS before, take a second to check it out!
93 |
94 | to write content. It does this by leveraging Pandoc Markdown’s existing features, along with a few new ones implemented as a JSON filter.
100 |105 |Tufte CSS provides tools to style web articles using the ideas demonstrated by Edward Tufte’s books and handouts. Tufte’s style is known for its simplicity, extensive use of sidenotes, tight integration of graphics with text, and carefully chosen typography.
101 | 104 |
Tufte Pandoc CSS aims to be a set of starter files for your next project. What that means is that it provides a number of CSS files, a Pandoc template, a Makefile, and more to make it as easy as possible to write Markdown using Tufte CSS.
107 |The biggest barrier that this project overcomes is that Pandoc Markdown doesn’t support side notes nor margin notes by default. This project adds that functionality.In particular, a separate library called pandoc-sidenote handles the transformation of footnotes into sidenotes.
108 |
109 | Here’s how you can use them:
... In print, Tufte has used the proprietary Monotype
111 | Bembo[^note] font. ...
112 |
113 | [^note]:
114 | See Tufte's comment in the Tufte book fonts thread.By default, if you use the normal Pandoc syntax for creating footnotes, they’ll become Tufte CSS-style side notes. To get margin notes (i.e., side notes without numbers), just include {-} at the beginning of the note:
... If you want a sidenote without footnote-style numberings, then you want a
118 | margin note.[^mn] On large screens, ...
119 |
120 | [^mn]:
121 | {-} This is a margin note. Notice there isn't a number preceding the note.Pandoc Markdown is excellent for styling code blocks. Indeed, you’ve already seen their effect in this document. You can use any of the methods for creating syntax highlighted code blocks Pandoc permits. For example:
127 |# Compute elements of the mandelbrot set
128 | def mandelbrot(a):
129 | return reduce(lambda z, _: z * z + a, range(50), 0)
130 |
131 | def step(start, step, iterations):
132 | return (start + (i * step) for i in range(iterations))
133 |
134 | rows = (("*" if abs(mandelbrot(complex(x, y))) < 2 else " "
135 | for x in step(-2.0, .0315, 80))
136 | for y in step(1, -.05, 41))In this document, you’re also seeing the effect of the Solarized color scheme. You can use any of the color schemes Pandoc ships with by default, or this one.
138 |Another feature Pandoc allows that Tufte Pandoc CSS supports is generating line numbers to accompany a code sample:
139 |merge [] ys = ys
140 | merge xs [] = xs
141 | merge xs@(x:xt) ys@(y:yt) | x <= y = x : merge xt ys
142 | | otherwise = y : merge xs yt
143 |
144 | split (x:y:zs) = let (xs,ys) = split zs in (x:xs,y:ys)
145 | split [x] = ([x],[])
146 | split [] = ([],[])
147 |
148 | mergeSort [] = []
149 | mergeSort [x] = [x]
150 | mergeSort xs = let (as,bs) = split xs
151 | in merge (mergeSort as) (mergeSort bs)Unfortunately, HTML figures and sections don’t have special Markdown syntax. To include them in your document, you’ll have to use the raw HTML. On the bright side, this usually ends up being pretty painless.
156 |In particular for sections, if you’re satisfied with the top-most headings being wrapped in <section> tags, you can use the --section-divs flag to pandoc to automatically wrap sections in divs. This is already enabled in the Makefile we ship with this project. Regardless, if you have any leading text before your first heading, you will need to wrap this text in a <section> tag.
Tufte Pandoc CSS improves support for full-width tables and code blocks. Special attention has been given to ensure that they’re fully responsive at all viewports, just like normal full-width figures. Here’s a sample full-width table:
158 || Talk | 163 |Speaker | 164 |Time | 165 |
|---|---|---|
| HTML/CSS Primer | 170 |Scott Krulcik | 171 |1:30 p.m. – 3:00 p.m. | 172 |
| JavaScript Primer | 175 |Jake Zimmerman | 176 |3:00 p.m. – 4:30 p.m. | 177 |
| UX Prototyping with Framer.js | 180 |Lois Yang | 181 |4:30 p.m. – 6:00 p.m. | 182 |
| Frontend Development with Angular.js | 185 |Sandra Sajeev | 186 |6:30 p.m. – 8:00 p.m. | 187 |
As one last quick note: the original Tufte CSS recommends that you always wrap images in <figure> tags for optimal responsiveness and layout. Depending on your tastes, you can choose to omit this. The differences will only take effect on mobile, where the width of the image will be slightly different from what it would be if it were properly wrapped. Try it both ways and see whether you value the convenience of no wrapping or the proper layout that a <figure> provides.
As mentioned above, Tufte Pandoc CSS is designed to be a collection of starter files to help you with your next Markdown project. You can learn what files and tools are available on the GitHub repository.
196 |As for usage, you are strongly encouraged to look at the source of this document. There’s also an HTML-to-Markdown port of the original Tufte CSS page along with the accompanying source.
197 |One goal of this project is to support as many of the features you’d “expect” to work that are available in Pandoc. If your favorite feature doesn’t work, let us know with an issue.
198 |130 | If you prefer sans-serifs, use the `sans` class. It relies on Gill Sans, 131 | Tufte's sans-serif font of choice. 132 |
133 | 134 | Links in Tufte CSS match the body text in color and do not change on mouseover 135 | or when clicked. Here is a [dummy example](#) that goes nowhere. 136 | These links are underlined, since this is the most widely recognized indicator 137 | of clickable text. [^blue] However, because most browsers' default underlining 138 | does not clear descenders and is so thick and distracting, the underline effect 139 | is instead achieved using CSS trickery involving background gradients instead of 140 | standard `text-decoration`. Credit goes to Adam Schwartz for that technique. 141 | 142 | [^blue]: 143 | {-} Blue text, while also a widely recognizable clickable-text indicator, is 144 | crass and distracting. Luckily, it is also rendered unnecessary by the use of 145 | underlining. 146 | 147 | As always, these design choices are merely one approach that Tufte CSS provides 148 | by default. Other approaches, such as changing color on click or mouseover, or 149 | using highlighting or color instead of underlining to denote links, could also 150 | be made to work. The goal is to make sentences readable without interference 151 | from links, as well as to make links immediately identifiable even by casual web 152 | users. 153 | 154 | 155 | ## Epigraphs 156 | 157 |p tag, as seen to the right of this paragraph.
292 |
293 | [^rhino]:
294 | {-}  F.J. Cole, "The History of Albrecht
295 | Dürer's Rhinoceros in Zooological Literature," *Science, Medicine, and
296 | History: Essays on the Evolution of Scientific Thought and Medical Practice*
297 | (London, 1953), ed. E. Ashworth Underwood, 337-356. From page 71 of Edward
298 | Tufte's *Visual Explanations*.
299 |
300 | If you need a full-width figure, give it the `fullwidth` class. Make sure that's
301 | inside an `article`, and it will take up (almost) the full width of the screen.
302 | This approach is demonstrated below using Edward Tufte's English translation of
303 | the Napoleon's March data visualization. From *Beautiful Evidence*, page
304 | 122-124.
305 |
306 | Dave Liepmann
23 |Tufte CSS provides tools to style web articles using the ideas demonstrated by Edward Tufte’s books and handouts. Tufte’s style is known for its simplicity, extensive use of sidenotes, tight integration of graphics with text, and carefully chosen typography.
26 |Tufte CSS was created by Dave Liepmann and is now an Edward Tufte project. The original idea was cribbed from Tufte-LaTeX and R Markdown’s Tufte Handout format. We give hearty thanks to all the people who have contributed to those projects.
27 |If you see anything that Tufte CSS could improve, we welcome your contribution in the form of an issue or pull request on the GitHub project: tufte-css. Please note the contribution guidelines.
28 |Finally, a reminder about the goal of this project. The web is not print. Webpages are not books. Therefore, the goal of Tufte CSS is not to say “websites should look like this interpretation of Tufte’s books” but rather “here are some techniques Tufte developed that we’ve found useful in print; maybe you can find a way to make them useful on the web”. Tufte CSS is merely a sketch of one way to implement this particular set of ideas. It should be a starting point, not a design goal, because any project should present their information as best suits their particular circumstances.
29 |To use Tufte CSS, copy tufte.css and the et-book directory of font files to your project directory, then add the following to your HTML document’s head block:
<link rel="stylesheet" href="tufte.css"/>
34 | Now you just have to use the provided CSS rules, and the Tufte CSS conventions described in this document. For best results, View Source and Inspect Element frequently.
35 |Organize your document with an article element inside your body tag. Inside that, use section tags around each logical grouping of text and headings.
Tufte CSS uses h1 for the document title, p with class subtitle for the document subtitle, h2 for section headings, and h3 for low-level headings. More specific headings are not supported. If you feel the urge to reach for a heading of level 4 or greater, consider redesigning your document:
43 |48 |[It is] notable that the Feynman lectures (3 volumes) write about all of physics in 1800 pages, using only 2 levels of hierarchical headings: chapters and A-level heads in the text. It also uses the methodology of sentences which then cumulate sequentially into paragraphs, rather than the grunts of bullet points. Undergraduate Caltech physics is very complicated material, but it didn’t require an elaborate hierarchy to organize.
44 | 47 |
As a bonus, this excerpt regarding the use of headings provides an example of block quotes. In Tufte CSS they are just lightly styled, semantically correct HTML using blockquote and footer elements. See page 20 of The Visual Display of Quantitative Information for an example in print.
In his later booksBeautiful Evidence
50 |
51 | , Tufte starts each section with a bit of vertical space, a non-indented paragraph, and the first few words of the sentence set in small caps. For this we use a span with the class newthought, as demonstrated at the beginning of this paragraph. Vertical spacing is accomplished separately through <section> tags. Be consistent: though we do so in this paragraph for the purpose of demonstration, do not alternate use of header elements and the newthought technique. Pick one approach and stick to it.
Although paper handouts obviously have a pure white background, the web is better served by the use of slightly off-white and off-black colors. Tufte CSS uses #fffff8 and #111111 because they are nearly indistinguishable from their ‘pure’ cousins, but dial down the harsh contrast. We stick to the greyscale for text, reserving color for specific, careful use in figures and images.
In print, Tufte has used the proprietary Monotype BemboSee Tufte’s comment in the Tufte book fonts thread.
57 |
58 | font. A similar effect is achieved in digital formats with the now open-source ETBook, which Tufte CSS supplies with a @font-face reference to a .ttf file. In case ETBook somehow doesn’t work, Tufte CSS shifts gracefully to other serif fonts like Palatino and Georgia.
Also notice how Tufte CSS includes separate font files for bold (strong) and italic (emphasis), instead of relying on the browser to mechanically transform the text. This is typographic best practice.
60 |
61 | If you prefer sans-serifs, use the sans class. It relies on Gill Sans, Tufte’s sans-serif font of choice.
62 |
Links in Tufte CSS match the body text in color and do not change on mouseover or when clicked. Here is a dummy example that goes nowhere. These links are underlined, since this is the most widely recognized indicator of clickable text. Blue text, while also a widely recognizable clickable-text indicator, is crass and distracting. Luckily, it is also rendered unnecessary by the use of underlining.
64 |
65 | However, because most browsers’ default underlining does not clear descenders and is so thick and distracting, the underline effect is instead achieved using CSS trickery involving background gradients instead of standard text-decoration. Credit goes to Adam Schwartz for that technique.
As always, these design choices are merely one approach that Tufte CSS provides by default. Other approaches, such as changing color on click or mouseover, or using highlighting or color instead of underlining to denote links, could also be made to work. The goal is to make sentences readable without interference from links, as well as to make links immediately identifiable even by casual web users.
67 |73 |78 | 79 |The English language . . . becomes ugly and inaccurate because our thoughts are foolish, but the slovenliness of our language makes it easier for us to have foolish thoughts.
74 | 77 |
80 |85 | 86 |For a successful technology, reality must take precedence over public relations, for Nature cannot be fooled.
81 | 84 |
87 |92 |I do not paint things, I paint only the differences between things.
88 | 91 |
If you’d like to introduce your page or a section of your page with some quotes, use epigraphs. Modeled after chapter epigraphs in Tufte’s books (particularly Beautiful Evidence), these are blockquote elements with a bit of specialized styling. Quoted text is italicized. The source goes in a footer element inside the blockquote. We have provided three examples in the epigraph of this section, demonstrating shorter and longer quotes, with and without a paragraph tag, and showing how multiple quotes within an epigraph fit together with the use of a wrapper class.
One of the most distinctive features of Tufte’s style is his extensive use of sidenotes.This is a sidenote.
98 |
99 | Sidenotes are like footnotes, except they don’t force the reader to jump their eye to the bottom of the page, but instead display off to the side in the margin. Perhaps you have noticed their use in this document already. You are very astute.
Sidenotes are a great example of the web not being like print. On sufficiently large viewports, Tufte CSS uses the margin for sidenotes, margin notes, and small figures. On smaller viewports, elements that would go in the margin are hidden until the user toggles them into view. The goal is to present related but not necessary information such as asides or citations as close as possible to the text that references them. At the same time, this secondary information should stay out of the way of the eye, not interfering with the progression of ideas in the main text.
101 |Sidenotes consist of two elements: a superscript reference number that goes inline with the text, and a sidenote with content. To add the former, just put a label and dummy checkbox into the text where you want the reference to go, like so:
102 |<label for="sn-demo"
103 | class="margin-toggle sidenote-number">
104 | </label>
105 | <input type="checkbox"
106 | id="sn-demo"
107 | class="margin-toggle"/>
108 | You must manually assign a reference id to each side or margin note, replacing “sn-demo” in the for and the id attribute values with an appropriate descriptor. It is useful to use prefixes like sn- for sidenotes and mn- for margin notes.
Immediately adjacent to that sidenote reference in the main text goes the sidenote content itself, in a span with class sidenote. This tag is also inserted directly in the middle of the body text, but is either pushed into the margin or hidden by default. Make sure to position your sidenotes correctly by keeping the sidenote-number label close to the sidenote itself.
If you want a sidenote without footnote-style numberings, then you want a margin note.This is a margin note. Notice there isn’t a number preceding the note.
111 |
112 | On large screens, a margin note is just a sidenote that omits the reference number. This lessens the distracting effect taking away from the flow of the main text, but can increase the cognitive load of matching a margin note to its referent text. However, on small screens, a margin note is like a sidenote except its viewability-toggle is a symbol rather than a reference number. This document currently uses the symbol ⊕ (&\#8853;), but it’s up to you.
Margin notes are created just like sidenotes, but with the marginnote class for the content and the margin-toggle class for the label and dummy checkbox. For instance, here is the code for the margin note used in the previous paragraph:
<label for="mn-demo" class="margin-toggle">⊕</label>
115 | <input type="checkbox" id="mn-demo" class="margin-toggle"/>
116 | <span class="marginnote">
117 | This is a margin note. Notice there isn’t a number preceding the note.
118 | </span>
119 | Figures in the margin are created as margin notes, as demonstrated in the next section.
120 |Tufte emphasizes tight integration of graphics with text. Data, graphs, and figures are kept with the text that discusses them. In print, this means they are not relegated to a separate page. On the web, that means readability of graphics and their accompanying text without extra clicks, tab-switching, or scrolling.
124 |Figures should try to use the figure element, which by default are constrained to the main column. Don’t wrap figures in a paragraph tag. Any label or margin note goes in a regular margin note inside the figure. For example, most of the time one should introduce a figure directly into the main flow of discussion, like so:
129 |
F.J. Cole, “The History of Albrecht Dürer’s Rhinoceros in Zooological Literature,” Science, Medicine, and History: Essays on the Evolution of Scientific Thought and Medical Practice (London, 1953), ed. E. Ashworth Underwood, 337-356. From page 71 of Edward Tufte’s Visual Explanations.
131 |
132 | But tight integration of graphics with text is central to Tufte’s work even when those graphics are ancillary to the main body of a text. In many of those cases, a margin figure may be most appropriate. To place figures in the margin, just wrap an image (or whatever) in a margin note inside a p tag, as seen to the right of this paragraph.
If you need a full-width figure, give it the fullwidth class. Make sure that’s inside an article, and it will take up (almost) the full width of the screen. This approach is demonstrated below using Edward Tufte’s English translation of the Napoleon’s March data visualization. From Beautiful Evidence, page 122-124.
136 | Technical jargon, programming language terms, and code samples are denoted with the code class, as I’ve been using in this document to denote HTML. Code needs to be monospace for formatting purposes and to aid in code analysis, but it must maintain its readability. To those ends, Tufte CSS follows GitHub’s font selection, which shifts gracefully along the monospace spectrum from the elegant but rare Consolas all the way to good old reliable Courier.
Extended code examples should use a pre tag with class code. This adds control over indentation and overflow as well:
;; Some code examples in Clojure. This is a comment.
143 |
144 | ;; applying a function to every item in the collection
145 | (map tufte-css blog-posts)
146 | ;;;; if unfamiliar, see http://www.lispcast.com/annotated-map
147 |
148 | ;; side-effecty loop (unformatted, causing text overflow) - from https://clojuredocs.org/clojure.core/doseq
149 | (doseq [[[a b] [c d]] (map list (sorted-map :1 1 :2 2) (sorted-map :3 3 :4 4))] (prn (* b d)))
150 |
151 | ;; that same side-effecty loop, formatted
152 | (doseq [[[a b] [c d]] (map list
153 | (sorted-map :1 1 :2 2)
154 | (sorted-map :3 3 :4 4))]
155 | (prn (* b d)))
156 |
157 | ;; If this proselytizing has worked, check out:
158 | ;; http://howistart.org/posts/clojure/1
159 | Tufte CSS provides support for Edward Tufte and Adam Schwartz’s ImageQuilts. See the ET forum announcement thread for more on quilts. Some have ragged edges, others straight. Include these images just as you would any other figure.
This is an ImageQuilt surveying Chinese calligraphy, placed in a full-width figure to accomodate its girth:
164 |
166 | Here is an ImageQuilt of 47 animal sounds over and over, in a figure constrained to the main text region. This quilt has ragged edges, but the image itself is of course still rectangular.
168 |
170 | Many thanks go to Edward Tufte for leading the way with his work. It is only through his kind and careful editing that this project accomplishes what it does. All errors of implementation are of course mine.
175 |