tufte icon indicating copy to clipboard operation
tufte copied to clipboard

floating TOC in tufte book

Open chipbrock opened this issue 5 years ago • 7 comments

This is a question and issue that has not received an answer on Stackoverflow after a day. floating TOC in tufte book

Since I posted it I've confirmed it in another approach to standing up a stock tufte book. I believe this is real, although I confess that I'm still learning.

Here is a few-line modification to the index.Rmd file for the demo:

--- 
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
    toc_float: 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 f

Inclusion of toc: true works. The top_float: true insertion results in the 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.

This happens with the toc lines where they are shown and also as an argument to the tufte::tufte_html: line.

I don't see that the need to include a theme is included in the toc section in the "Definitive Guide" book. In any case, addition of a theme in what I think is the normal way doesn't help. I'd appreciate some help.

I have written and am currently using a variation of tufte format starting from (the award-winning!) programmingforpsych but I think I'd prefer to stick with the standard tufte package. But only if I can include the floating toc.

Thanks in advance for your help.


By filing an issue to this repo, I promise that

  • [ x] I have fully read the issue guide at https://yihui.name/issue/.
  • [ x] I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('tufte'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('rstudio/tufte').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • [x] I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

chipbrock avatar Sep 10 '19 12:09 chipbrock

Hi, I second the issue: I LOVE the tufte style you guys generated, and it would be great to include floating tocs. Or, probably, write a more informative error message if floating tocs are not supported at all? Thank you, cheers

JanaJarecki avatar Oct 05 '19 09:10 JanaJarecki

Agreed, a floating TOC would be a great feature.

lrdegeest avatar Apr 07 '20 01:04 lrdegeest

Sorry, but floating TOC is not supported in this package. I'll consider it in the future. Thanks!

yihui avatar May 07 '20 20:05 yihui

I would be excited if TOC can be supported in this package.

ghost avatar Mar 17 '21 14:03 ghost

I am wondering the following example would make you (@chipbrock) be satisfied for now.

https://www.crumplab.com/programmingforpsych/index.html

ghost avatar Aug 28 '21 21:08 ghost

@yihui any input on this advance. Thanks.

ogorodriguez avatar Dec 03 '22 16:12 ogorodriguez

A solution seems to have been implemented in the book: "Modern Statistics for Modern Biology", combining the tufte with a floating TOC. Unfortunately, the MSMB Style Package from @grimbough does seem to include the floating TOC solution.

epistecius avatar Oct 09 '23 12:10 epistecius