floating TOC in tufte book

540 Views Asked by At

I am trying to do something simple: render the tufte options for a book using the basic bookdown example package. I can make the tufte style book fine, but I want it to have the floating TOC and not the TOC at the top

Following the Definitive Guide bookdown book suggests a modification to the toc specifications. I'm using the stock bookdown-demo-master download.

This yaml makes the example in tufte format, but with an unattractive and not usable header with the toc:

--- 
title: "A Minimal Book Example"
author: "Yihui Xie"
date: "`r Sys.Date()`"
site: bookdown::bookdown_site
output:
  tufte::tufte_html: default
  tufte::tufte_book:
    citation_package: natbib
    latex_engine: xelatex
  bookdown::tufte_html_book:
    toc: true
    css: toc.css
documentclass: book
bibliography: [book.bib, packages.bib]
biblio-style: apalike
link-citations: yes
github-repo: rstudio/bookdown-demo
description: "This is a minimal example of using the bookdown package to write a book. The output format for this example is bookdown::gitbook."
---

But adding the float option:

  bookdown::tufte_html_book:
    toc: true
    toc_float: true
    css: toc.css

gives an error:

Error in rmarkdown::html_document(..., extra_dependencies = c(extra_dependencies,  : 
  You must use a theme when specifying the 'toc_float' option
Calls: <Anonymous> ... html_chapters -> base_format -> html_document2 -> <Anonymous>
Execution halted

Exited with status 1.

I don't see that the need to include a theme is written in the "Definitive Guide" book. In any case, addition of a theme in the normal way doesn't help. Surely this is doable and I'm just missing something fundamental.

For the record, this question was also posted to the Github repository of the tufte package.

0

There are 0 best solutions below