# Pandoc: How can I get numbered LaTeX equations to show up in both PDF and HTML output

To make a numbered equation in Pandoc, I defer to using pure LaTeX:

$$a^2 + b^2 = c^2$$


In PDF form, it gives a nice numbered equation, however, this equation doesn't show up at all in the HTML output because the equation is within the \begin environment and is ignored. I would like to keep the numbering in the PDF, but would like the equation to show up in the HTML, with or without the numbering.

-

In pandoc you can do:

(@foo)  $a^2 + b^2 = c^2$

As (@foo) says, ...

(@bar)  $e = x + y$


This will give you running equation numbers in both PDF and HTML. However, the equations will not be centered or display-formatted. (You can use  for display math, but then the numbers probably won't be lined up right -- though maybe this can be fixed with CSS.)

-
Doing it this way, the equation ends up being placed on the left and slightly above the equation itself. Is there a way to have the equation number on the right just like in the regular latex format? –  user1027169 May 3 '13 at 20:11
No, there's no way to get the number on the right. You could probably fix alignment issues with display math using CSS. –  John MacFarlane May 4 '13 at 2:06
I meant in the PDF output, the equation number gets moved to the left. As you mentioned, the HTML shouldn't be an issue with some CSS. –  user1027169 May 4 '13 at 16:25
@JohnMacFarlane just wondering if this (displaymath, right-aligned eqs) is something that might be addressed in later pandoc releases, or if explicit LaTeX environment remains the way to go for pdf output? –  cboettig Jun 23 at 18:20
Mathjax supports \ref and \eqref in plain HTML: cdn.mathjax.org/mathjax/latest/test/sample-eqrefs.html --- can Pandoc users get access to this functionality? (I'm converting multimarkdown to html.) –  Ahmed Fasih Jun 29 at 4:26