Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trailing period after section number in Rmd notebook

I have an R notebook like the following:

---
title: "R Notebook"
output: 
  html_notebook:
    number_sections: true
    toc: true
---
# First section   
## Subsection
Some text

# Second section

When rendered to Preview Notebook in RStudio, it generates numbered section titles like 1 First section, 1.1 Subsection etc. What if I want it to add a dot at the end of the number, i.e. produce 1. First section, 1.1. Subsection etc.?

like image 850
Vasily A Avatar asked Oct 30 '25 10:10

Vasily A


1 Answers

You can use CSS for styling these numbers.

For instance, these notebook has dot after header numbers as you want:

---
title: "R Notebook"
output: 
  html_notebook:
    number_sections: true
    toc: true
---

```{css, echo=FALSE}
.header-section-number::after {
  content: ".";
}
```

# First section   
## Subsection
Some text

# Second section
like image 107
RLesur Avatar answered Nov 02 '25 02:11

RLesur