Christoph
Christoph

Reputation: 7063

How to remove a section from the table of contents?

Or in other words: is there something like \tocless for Rmd's? I found something for Latex here, but could not find anything for an Rmd.

Changing toc-depth is not an option:

output:
  html_document:
    toc: true
    toc_float:
      collapsed: false
    toc_depth: 2

Reproducible example:

---
title: "Untitled"
author: "SQC"
date: "7 Juni 2018"
output:
  html_document:
    toc: true
    toc_float:
      collapsed: false
    toc_depth: 2
    theme: yeti
---

## Sec. 1

bla

## Sec. 2 - not part of content

bla

Upvotes: 3

Views: 1215

Answers (1)

qqtim
qqtim

Reputation: 76

Though some years have passed since the post of this question, I still want to respond to this question because others may benefit from the answer. If you do not want certain section headings to be included in the table of contents, you can add two classes to the heading: unlisted and unnumbered. For example:

# Section heading {.unlisted .unnumbered}

See here: https://bookdown.org/yihui/rmarkdown-cookbook/toc-unlisted.html

Upvotes: 6

Related Questions