【问题标题】:How can I add a table of contents in R Markdown?如何在 R Markdown 中添加目录?
【发布时间】:2020-09-22 15:37:03
【问题描述】:


我很难尝试在 R Markdown 中添加目录。
我希望目录位于文档的左侧。
我试过这段代码,但它对我不起作用(当我编织文档时,它工作正常,但目录不可用):

---
title: "Relatório VANT - P&D"
author: "Empresa: XXXX"
date: "Data: 24/05/2020"
output: 
  html_document:
  toc: true
  toc_float: true
---

我该如何解决我的问题?

【问题讨论】:

    标签: r automation r-markdown tableofcontents


    【解决方案1】:

    缩进toc很重要,例如

    ---
    title: "Relatório VANT - P&D"
    author: "Empresa: XXXX"
    date: "Data: 24/05/2020"
    output: 
      html_document:
       toc: true
       toc_float: true
    ---
    
    # h1
    
    # h2
    
    # h2.2
    

    【讨论】:

    • 非常感谢。它对我来说效果很好。我看到的一件事是有一个选项toc_depth。我读到默认是3,但我不太明白它控制什么。你知道吗?再次感谢!
    猜你喜欢
    • 2021-12-17
    • 1970-01-01
    • 1970-01-01
    • 2019-12-03
    • 2020-12-19
    • 2015-05-18
    • 1970-01-01
    • 1970-01-01
    • 2021-12-02
    相关资源
    最近更新 更多