【问题标题】:Creating two table of contents with different depths in R Markdown在 R Markdown 中创建两个不同深度的目录
【发布时间】:2021-03-09 18:02:30
【问题描述】:

我使用 RMarkdown 创建了 pdf 格式的讲义,但它有很多子标题。因此,我想创建两个不同的目录:第一个深度为 1 的目录,然后分别为 4 深度的目录。

添加 toc_depth: 1toc_depth: 4 无效。

我的 YAML 标头:

---
title: "Lecture Notes"
author: "x"
output:
  pdf_document:
    highlight: tango 
    toc: true 
    toc_depth: 4 #depth table of contents
    number_sections: true
documentclass: article
classoption: a4paper
fontsize: 12pt 
geometry: "right=1cm, left=1cm, top=1cm, bottom=3cm"
---

【问题讨论】:

    标签: r-markdown tableofcontents


    【解决方案1】:

    据我所知,我认为不可能有两个目录。您可以尝试的一件事是,如果您不想为某个标题编号,您可以这样做

    ## Including Plots {-}
    

    哪些标题有标题,但在 TOC 中没有编号。这是两个输出差异

    没有{-}

    {-}

    这些可以用在前言、关于作者等地方。

    【讨论】:

      猜你喜欢
      • 2021-12-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-28
      • 2012-08-10
      • 2022-09-28
      • 2020-07-06
      相关资源
      最近更新 更多