5

I am writing a manuscript with rmarkdown.

If I want to number all sections, I can use YAML like this

---
title: "My Report"
output: 
  html_document:
    number_sections: true
---

See Automatically number sections in RMarkdown

But I only want to number some sections, so my document looks like

Abstract
1. Introduction
2. Methods
3. Results
References

Is there anyway to do this?

Richard Telford
  • 9,558
  • 6
  • 38
  • 51

1 Answers1

8

From the Pandoc User Guide you want to add the .unnumbered attribute to the header. This is done using:

# My header {.unnumbered}

or the shortcut

# My header {-}

For example, using the following document

---
title: "My Report"
output: 
  html_document:
    number_sections: true
---

# Abstract {-}

# Introduction

# Methods

# Results

# References {-}

The HTML produced renders as:

enter image description here

Gavin Simpson
  • 170,508
  • 25
  • 396
  • 453