我正在尝试做一些简单的事情:使用基本的bookdown示例程序包呈现一本书的tufte选项。我可以将tufte样式书制作得很好,但我希望它具有浮动TOC,而不是顶部具有TOC
按照《最终指南》的书建议对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."
---
但是添加了float选项:
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.
我认为“主题指南”书中没有写出包含主题的需要。无论如何,以常规方式添加主题都无济于事。当然这是可行的,而我只是缺少一些基本知识。
谢谢。