tlnagy tlnagy - 2 months ago 25
YAML Question

How to specify numbered sections in Pandoc's front matter?

I would like to specify numbered sections via Pandoc's support for YAML front matter. I know that the flag for the command-line usage is

--number-sections
, but something like

---
title: Test
number-sections: true
---


doesn't produce the desired result. I know that I am close because you can do this with the geometry package (e.g.
geometry: margin=2cm
). I wish there was a definitive guide on how Pandoc YAML front matter handling. For example, the following is very useful (avoids templates), but its discoverability is low:

header-includes:
- \usepackage{some latex package}

dfc dfc
Answer

In order to turn on numbered-sections in latex output you need to use numbersections in your YAML block. If you ever want to "discover" things like this with pandoc just poke around the templates:

 $ grep -i number default.latex
 $if(numbersections)$
 $ grep -i number default.html*
 $

As you can see this option does not work with html.

Markdown and YAML I tested with:

 ---
 title: Test
 numbersections: true
 ---


 # blah

 Text is here.

 ## Double Blah

 Twice the text is here

If you need it to work with more than beamer,latex,context,opendoc you will need to file a bug at github.