Bookdown contest submission: Gitbook style + tufte style for web-book



github pages website to see the book:
github repo to copy book:

This is the second book I made in bookdown. I originally wrote it in latex, using the tufte style template. I liked the visual style of the margin notes, and the quoted sections at the beginning. But, then I discovered Bookdown a couple years ago, that was a revelation. I was already doing most everything in R (half of the book is about programming in R), being able to write in R, and talk about R at the same time, was truly one of the best things. Thank you for making Bookdown!

There is already an R Markdown tufte style. But, I didn't like the way it looked on the web. I liked the clean gitbook style that we see in so many Bookdown books, but I wanted elements of the tufte style (margin notes, quotes etc.)

So, I hacked the two together, and this was the result. I didn't write any explanation for getting this to work, I should probably to do that. As far as I can tell, anyone could fork the repo, and it should compile in R-Studio.

For quotes and margin notes I embed these into the R Markdown where I want them placed.

<span class="newthought">
quote goes here
---author name

<div class="marginnote">
things you write here go in the margin

All the .css style files are in place for this to work, and those are the result of me tinkering with existing things, and making them play nice.

So, this really isn't much of a big departure from the existing styles. I like the existing styles, and made a few small modifications.

I had this working at one point to compile to all formats...But, really I think that was a hack. I probably compiled the .pdf in latex, then served that through the bookdown link. I think the epub compiles, but it's probably missing the margin notes... Since this time I'm focusing mainly on web-books, and haven't attempted to make my books compile in other formats (they don't support gifs, or quizzes, or shiny apps, or other things).

Thank you all who have made Bookdown, R markdown, R-studio, etc. this whole universe is a fantastic thing. Keep up the great work.


That was a very interesting idea, and I love the hacks for newthought and marginnote. Thanks for sharing!