I know how to indent text such as bullets and numeric lists, but I am also interested in indenting numbered sections and subsections as well. Given the following code, it renders to the screen shot following the code. The table of contents has subsections indented and I would like to indent the content body as well.
Is there a way to indent the subsections in the body of the document as well? See the Desired Output Example item afterwards.
---
title: "R Markdown Example With Numbered Sections"
output:
bookdown::pdf_document2:
toc: true
toc_depth: 6
number_sections: true
---
# Section A
## Level 2 A
### Level 3 A
#### Level 4 A
## Level 2 A
# Section B
## Level 2 B
Rendered without indented subsections
Desired Output Example
... table of contents as above ...
1 Section A
1.1 Level 2 A
1.1.1 Level 3 A
1.1.1.1 Level 4 A
1.2 Level 2 A
2 Section B
2.1 Level 2 B
EDIT: 2021-12-15
The solution for this by @Peter worked for me on the Mac but required a workaround for the Linux system I am using. I found the issue with the solution not working on my Linux machine was the result of a bug in version 2.10 of titlesec (which is what I have). The fix can be either to update titlesec or use a workaround; both are described in this link: titlesec: loss of section numbering with the new update (2016/03/15)


