[Tex/LaTex] How convert HTML to LaTeX or MathML

conversionhtmlmathml

I using KaTeX to render HTML formula display.
How can I convert HTML to LaTeX or KaTeX again?

Best Answer

How can I convert HTML to LaTeX?

You can use Pandoc. It does a good job if your HTML is clean, i.e. doesn't have many div's and span's.

About KaTeX, you first need to understand that KaTeX is only a Javascript library to convert the math subset of LaTeX to something that will be render at web browsers. If you have the original source code of your HTML page that has the LaTeX code instead of the KaTeX output I believe that Pandoc will solve your problem (and if not please report the issue at http://github.com/jgm/pandoc/). If you only have the KaTeX output Pandoc will not solve your problem.