Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert HTML with mathjax into Latex using Pandoc?

I have some HTML documents with MathJax equations, and I want to convert them to Latex, and then to pdf. I'd like to use Pandoc.

However, Pandoc replaces $ with \$ and it replaces \ in formulas with \textbackslash{}.

Is it possible to get Pandoc to pass MathJax formulas literally from HTML to Latex?

like image 445
Jeromy Anglim Avatar asked Jul 05 '12 05:07

Jeromy Anglim


1 Answers

With the latest version of pandoc (1.12.2), you can do this:

pandoc -f html+tex_math_dollars+tex_math_single_backslash -t latex

Much nicer! If you don't want to convert math delimited by \( and \), just do

pandoc -f html+tex_math_dollars -t latex
like image 55
John MacFarlane Avatar answered Sep 20 '22 07:09

John MacFarlane