# Pandoc equation numbering style

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:

\usepackage{titlesec}
\newcommand{\sectionbreak}{\clearpage}


I have tried adding the following to the file:

\usepackage{amsmath}
\renewcommand{\theequation}{\thechapter--\arabic{equation}}


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:

Input:

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


Output:

\begin{enumerate}
\def\labelenumi{(\arabic{enumi})}
\item
$(K_{0}^{-1}x)^{T}E(K_{1}^{-1}x')=0$
\end{enumerate}


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:

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


\numberwithin{equation}{section}


you can change section to subsection or subsubsection to get (1.1) (1.1.1) or (1.1.1.1) 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

\numberwithin{equation}{section}


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