I would like to convert math.stackexchange style plain text markdown with embedded latex equations to PDF and Doc formats. I've tried using pandoc, but keep getting bad PDF's.

For example, if I type pandoc mmn11 -o mmn11.pdf, I get an output file that looks allot like html when I open it in a text editor and when I try and open it with Document Viewer in Ubuntu, I get an error that it doesn't support plain text.

Any ideas what's going on?


Pandoc does the conversion to ODT, but doesn't seem to understand simple latex tags like \frac. Some of the latex tags get rendered, but other's don't. I'm pulling my hair out. If I cut and paste the text into cs.stackexchange, everything renders perfectly.

2 Answers 2


I suspect you're using a very old version of pandoc, which doesn't support pdf output. So it's defaulting to HTML and using the filename you specify. Upgrade.

As for math: there's no way to get nice math in ODT. Pandoc (recent versions) will give you nice math in docx and of course tex/pdf. You can also get nice math in HTML if you use an option like --mathjax or --mathml. For other formats, pandoc will do its best to fake it using unicode, but there's no way to do fractions that way, so it will fall back to using raw TeX if you use \frac{..}.

Hope that clarifies things.

  • I'm on Ubuntu 10.04 and typed: mmn11$ pandoc -v and got: pandoc Commented Mar 27, 2013 at 6:08
  • OK, I was able to convert it using markdown2pdf, I guess I'll have to install something recent to get docx. Thanks. Commented Mar 27, 2013 at 12:19

pandoc and mathjax (as used on the other stackexchnge sites) are not really on topic for this site however the example page on the pandoc site suggests that that you need to be careful in the positioning of $ delimiters:


Extension: tex_math_dollars

Anything between two $ characters will be treated as TeX math. The opening $ must have a character immediately to its right, while the closing $ must have a character immediately to its left. Thus, $20,000 and $30,000 won't parse as math. If for some reason you need to enclose text in literal $ characters, backslash-escape them and they won't be treated as math delimiters.

TeX math will be printed in all output formats. How it is rendered depends on the output format:


Docx : It will be rendered using OMML math markup.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .