我正在尝试做一些简单的事情:使用基本的 bookdown 示例包呈现一本书的簇选项。我可以把 tufte 风格的书做得很好,但我希望它有浮动 TOC 而不是顶部的 TOC
遵循权威指南 bookdown book 建议修改 toc 规范。我正在使用股票 bookdown-demo-master 下载。
此 yaml 以 tufte 格式制作示例,但带有一个没有吸引力且不可用的 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."
---
但添加浮动选项:
bookdown::tufte_html_book:
toc: true
toc_float: true
css: toc.css
给出一个错误:
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.
我认为“权威指南”一书中没有写到需要包含主题。在任何情况下,以正常方式添加主题都无济于事。当然这是可行的,我只是缺少一些基本的东西。
作为记录,这个问题也被发布到了tufte包的 Github 存储库。