[Tex/LaTex] Pandoc equation numbering style

equationsnumberingpandoc

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 

Best Answer

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:

\begin{equation}
(K_{0}^{-1}x)^{T}E(K_{1}^{-1}x')=0
\end{equation}

and in your templateAdd.tex add the line:

\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.

Related Question