Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatically number sections in RMarkdown

Tags:

r-markdown

I am trying to create a report in R markdown that has sections ordered

  1. Section 1 Header

    1.1 sub section 1

    1.2 sub section 3

  2. Section 2 Header

    2.1

    2.2 sub section

      2.2.1 another sub section 

Is there a way get R markdown to generate an ordered list like this?

like image 896
H.Bananas Avatar asked Oct 19 '16 00:10

H.Bananas


1 Answers

Add the option number_sections: true to your YAML header:

--- title: "My Report" output:    html_document:     number_sections: true ---  # Main Section  ## 2nd Level  ### 3rd Level 

And voilá, your sections are numbered:

The above text in an image with numbered sections

like image 80
Martin Schmelzer Avatar answered Oct 10 '22 15:10

Martin Schmelzer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!