outline/toc on the left and contents on the right layout using rmarkdown
r, r-markdown
Solution
Have you tried this approach? It works for me and it's also on the homepage, you provided:
---
title: "Untitled"
output:
html_document:
toc: true
toc_float: true
---
# header 1
# header 2
# header 3
With a little bit of text, it looks like that:
Problem
I was checking out how to include a nice table of contents / document outline in my `rmarkdown` document (with html output). Well, the "standard" approach: ``` html_document: toc: true ``` It works, but I do not like it (not even tweaking options and themes). But actually, in several pages of the documentation (e.g. http://rmarkdown.rstudio.com/html_document_format.html), they use a very nice layout that includes a table of contents / document outline to the left of the page and the contents of the right (and the outline syncs with the contents part, Highlighting where on the contents you currenly are). This is EXACTLY what I want. And I guess they did it using `rmarkdown`. But I cannot find how to do it. I've check that documentation page, as well as `rmarkdown` gallery, flex dashboard, web sites among others. But I can't seem to figure it out how to do it. Well, using web sites I would be able to do it, but it seems overly complicated for what I want (you need to have several pages, and at least index.Rmd file and the _site.yml file). Instead, I guess there should be an option to simply tell `rmarkdown` to take my single document and put the section headers in a nice frame to the left, as in the example page from RStudio.