Modern Statistics for Modern Biology is a text book by Susan Holmes and Wolfgang Huber that is due to be published in the near future. The print version has been written in a literate programming style using LaTeX/Sweave and uses many of the design principles found in Tufte Handouts. Although not currently publicly available, but the general layout of the print edition can be seen in this screen shot:
To accompany the book we have used R Markdown & bookdown to create a freely available HTML version of the book hosted at https://www-huber.embl.de/msmb/
Our intention was to maintain a similar style to the print version, with heavy use of the margin for additional information, along with consistent styling for headings etc. To achieve this we have created the package msmbstyle, which can be found at GitHub - grimbough/msmbstyle: Tufte inspired bookdown template
You can view an example website at https://www-huber.embl.de/users/msmith/msmbstyle/ ; the R Markdown documents used to create it are available in the /inst/extdata/
directory of the package
Technical Details
Given the influence of the Tufte Handout styling on the printed copy of the book, msmbstyle relys heavily on the tufte package to provide notes and figures in the margin. Where possible it reuses tufte code (including via tufte:::
if the required function is not exported). This means that all formatting options provided by tufte can also be used within an R Markdown document styled using msmbstyle.
We include the functions msmb_html
and msmb_html_book
(adapted from corresponding functions in tufte) that can be set in the output
field of the YAML header. These apply additional modifications to the HTML to provide the header bar and drop-down navigation menu.
msmbstyle also provides additional functions for including 'Questions' and 'Solutions' within the document. These can be used inline within the Rmd document to demarcate the region that should be included in the question. The resulting HTML output includes appropriate <div>
tags to indicate these regions, and javascript is used to allow the reader to toggle their visibility.
Questions can optionally be labelled, numbered, and referenced within the main text. This is done within the internal function msmb_build_chapter
(based on bookdown::html_build_chapter
). This functionality is similar to using one of the 'Theorem' environments, but with the option to mark the start and end within the document, rather than putting content within a single code-chunk.
These additions are styled, along with some more minor tweaks from to the tufte formatting, using an additional CSS file distributed with the msmbstyle. This also attempts to provide a coherent experience when using mobile devices, modifying the layout and navigation options appropriately e.g.
orTo further experiment the layout across different devices, there is a developmental version using Bootstrap for the layout that can be seen at https://www-huber.embl.de/users/msmith/msmbstyle/bootstrap/