I use pandoc to render .pdf files from markdown. Example input:

#Fudamental matrix
##Epipolar constraint in pixels

(@) $$(K_{0}^{-1}x)^{T}E(K_{1}^{-1}x')=0$$

(@) $$x^{T}((K_{0}^{-1})^{T}EK_{1}^{-1})x'=0$$

(@fundam) $$x^{T}F x'=0$$

Which renders my equations with the following numbers: (1), (2), (3). I would like to have: (1.1), (1.2), (1.3), where the first number is the chapter nr, or even (1.1.1), (1.1.2), etc. with subchapters numbers as well.

I have a file templateAdd.tex with:


I have tried adding the following to the file:


as described here, but this does not change the number rendering at all- it's still (1), (2), etc.

My pandoc call:

pandoc -s --mathjax --highlight-style pygments --number-sections --include-in-header   templateAdd.tex -o output\output.pdf -c style_print.css background.md 
  • "It does not seem to work"... What do you get as output? – Werner Nov 14 '14 at 20:02
  • I just get the regular pandoc numbering like (11), as if it does not change anything in the settings – 4gn3s Nov 14 '14 at 20:19
  • Is it possible to supply the community with a complete, minimal working example (MWE) of your pandoc input file, together with the command-line operation you use to compile the input? – Werner Nov 14 '14 at 20:30
  • Done my best to be as detailed as possible, thank you. – 4gn3s Nov 15 '14 at 7:26

This is happening because pandoc is interpreting (@) signs as list markers, specifically an ordered list enclosed in parentheses. As can be seen if you inspect the latex output of pandoc:


(@) $$(K_{0}^{-1}x)^{T}E(K_{1}^{-1}x')=0$$



To get your desired numbering you will have to turn your formulas into latex equations. You can achieve this by using some inline latex in your markdown like this:


and in your templateAdd.tex add the line:


you can change section to subsection or subsubsection to get (1.1) (1.1.1) or ( numbering style.


An alternative is to use the pandoc-eqnos filter, which processes attributed formulas. e.g.,

$$ (K_{0}^{-1}x)^{T}E(K_{1}^{-1}x')=0 $$ {#eq:foo}

When pandoc's output format is set to LaTeX or pdf, attributed formulas are converted by pandoc-eqnos to numbered LaTeX equations. The equation may be referenced as Eq. @eq:foo.

To get the numbering style you want, you still need to put


in your LaTeX template and change section to subsection or subsubsection to get (1.1) (1.1.1) or ( numbering style.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.