0

I was looking for a way to change heading format in RMarkdown (pdf) and found this code which works just fine.

---
output: pdf_document
header-includes:
  - \usepackage[tiny]{titlesec}
                  \titleformat*{\section}{\center\bfseries}{}
---

However, the heading are not correct in the bookmarks of the document, i.e., all sections ends up a level lower than the previous (regardless of their actual level).

Here is an example.

---
output: pdf_document
header-includes:
  - \usepackage[tiny]{titlesec}
                  \titleformat*{\section}{\center\bfseries}{}
---


# Level 1

# Level 1

## Level 2

### Level 3

# Level 1

## Level 2

And this is the resulting bookmarks.

enter image description here

Thank you,

POC
  • 268
  • 1
  • 2
  • 7

0 Answers0