How do I get the "number-sections" argument into rmarkdown::render?

1,026 views
Skip to first unread message

Michael Hannon

unread,
Apr 6, 2014, 5:00:20 PM4/6/14
to kn...@googlegroups.com
Greetings.  I've been using knitr and pandoc separately to produce HTML (sometimes PDF) documents with a numbered table of contents, something like:

    pandoc -s -S --mathjax --toc --number-sections foo.md -o foo.html

I decided to try the rmarkdown::render approach, and I have to say I think it's a very nice idea.  I can easily get a table of contents via the meta data:

    output:
      html_document:
        theme: cosmo
        toc: yes

But I don't see how to get a *numbered* TOC.  Can somebody enlighten me?  Thanks.

-- Mike

Michael Hannon

unread,
Apr 6, 2014, 8:51:39 PM4/6/14
to kn...@googlegroups.com
Never mind.  I found the answer:

output:

  html_document:
    theme: cosmo
    toc: yes
    pandoc_args: [
      "--number-sections"
    ]
---

I found the idea at:


-- Mike
Reply all
Reply to author
Forward
0 new messages