[Tex/LaTex] Pandoc cannot parse equation with a fraction

conversionequationspandoc

Pandoc is having a lot of trouble with this:

> pandoc -f latex -t html -s -o test2.html
$$
\frac{1}{2}
$$

Outputs:

[WARNING] Could not convert TeX math '\frac{1}{1}', rendering as TeX

LaTeX compiles it just fine, of course. It seems ridiculous that pandoc would not be able to handle this.

Best Answer

Beside that $$...$$ syntax is not recommended in LaTeX, it is unclear what are you doing really.

There are not an input latex file in the command line, but guessing that is

$$
\frac{1}{2}
$$

Saving this as test.tex, then:

pandoc -f latex -t html  test.tex

Producing this output:

<p><br /><span class="math display">$$\frac{1}{2}$$</span><br /></p>

Adding -s -o test.html only will save this inside a complete XHTML file, but of course, without rendering in any way.

Guessing that you want really is render the math display class with Mathjax in a browser, then you should run:

pandoc -f latex  --mathjax  -t html test.tex -s -o test.html

firefox test.html

Output in Firefox:

mwe