代码之家  ›  专栏  ›  技术社区  ›  Paul

如何在R bookdown文档中使用toc_float?

  •  0
  • Paul  · 技术社区  · 7 年前

    我一直在写一份报告 r-markdown 这有点长了,想把它分成几个部分 bookdown yaml

    toc: true
    toc_float: true
    

    我的可复制示例产生以下错误:

    指定float主题时必须使用 html_文档

    当我包括 theme: default 我得到这个错误:

    电话:。。。打电话->->基本格式->

    toc_float

    父文档:

    ---
    title: "test doc"
    output:
      bookdown::html_document2:
        # theme: default
        base_format: rmarkdown::html_vignette
        toc: true
        toc_float: true
    
    ---
    
    ```{r child = "chapters/01-child.Rmd"}
    ```
    

    #  Child
    
    Child
    
    0 回复  |  直到 7 年前
        1
  •  2
  •   c0rias    6 年前

    如果我理解正确的话,toc\u float不适用于 rmarkdown::html_vignette 因为你不能设定主题。

    根据 :

    传递给html_文档的其他参数。请注意主题、图视网膜和突出显示是硬编码的。设置其中任何一个都会产生错误。[...]

    与html_文档相比,它:

    • 从不使用主题

    然而,一个可能的解决方案是从 html_vignette html_document

    output:
      html_document:
        toc: true
        toc_depth: 3
        toc_float: true