April 28, 2014

Floating table of contents for your html reports using knitr

If you love knitr and rstudio and use them to produce long reports, you probably know that you can produce a table of contents in your html (and pdf) documents. In the newer rstudio (Version 0.98.801 or later) you do it by requesting a toc in the doc header, something like this.

title: "cssTest"
output:
html_document:
toc: yes

But wouldn’t it be nice if the table of contents, instead of being stuck at the top of the document, was available at the edge of the browser window and doesn’t move when you scroll?

This post shows a live example of a floating toc and also tells you how easily to produce one automatically by adding a custom css file.

Comments and improvements are welcome!


R reproducibleResearch code


Previous post
The Googleverse of Feelings Is the free-text search box the defining invention of the last twenty years? I think it probably is. Now more than half the entire Western world
Next post
GANTT software I quite often get asked (and ask myself) what is the best GANTT software for basic use. Recently we have been comparing a few solutions so here are


This blog by Steve Powell is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License, syndicated on r-bloggers and powered by Blot.
Privacy Policy
.