I am writing markdown in Atom editor and using package markdown-preview-plus for live preview on Windows 10. I have Miktex on my PC.
For the sake of simplicity consider that the .md file contain only one formula
$$
\begin{align}
\sum_{i=0}^n i^2 &= \frac{(n^2+n)(2n+1)}{6} \\
y &= mx+c
\end{align}
$$
I am able to preview it in my editor and also in stackedit.io. But when I try to convert it to a pdf using pandoc test1.md -s -o test1.pdf, I receive the following error:
! Package amsmath Error: Erroneous nesting of equation structures;
(amsmath) trying to recover with `aligned'.
See the amsmath package documentation for explanation.
Type H <return> for immediate help.
...
l.57 \end{align}
pandoc.exe: Error producing PDF
I have two solution to this problem:
- I can remove
$$before and after the equation, but then there is no math rendering in preview pane. - I can use
{aligned}instead of{align}, then pdf will not have equation numbers.
My doubt: Is the above code a legitimate markdown code? And if it is then why pandoc is not converting it?
Is it possible to generate appropriate result using
$$, like passing additional arguments while converting the .md to .pdf OR may be by including some kind of package?
Attaching preview, in case if it helps.
Let me know if I have not made myself clear.
Thanks

$$...$$– pkj Aug 02 '16 at 15:19\[and\]? – wilx Aug 02 '16 at 22:46+raw_latex. – wilx Aug 02 '16 at 22:52\[...\]gives correct preview, but in pdf output it leaves the brackets[and], have a look at the snapshot – pkj Aug 03 '16 at 05:50pandoc test2.md -f markdown+raw_latex -s -o test2.pdfresults inpandoc.exe: Unknown extension: raw_latex– pkj Aug 03 '16 at 05:54raw_texoption, notraw_latex. – wilx Aug 03 '16 at 05:55+raw_texproduces same results as in snapshot – pkj Aug 03 '16 at 06:07pandoc test2.md -f markdown+raw_tex -o test3.texproduces `{[}\begin{align} \sum_{i=0}^n i^2 &= \frac{(n^2+n)(2n+1)}{6} \ y &= mx+c \end{align}
{]}` in tex
– pkj Aug 03 '16 at 06:09