1

Using pandoc, what is the command to process a Markdown document with LaTeX to HTML?

The LaTeX needs to be converted into SVG and placed inline with HTML.

Example: Markdown content...

$$
\lim_{x \to \infty} \ \frac{x + \sin x}{x}
$$

The above is used in a markdown document, which needs to be converted using pandoc to an HTML document and the math to SVG.

I tried converting the above using pandoc lwl-limits.md -f markdown -t html -o lwl-limits.html but this is not converting the latex to svg though the page is converted to HTML.

Santosh S Kumar
  • 469
  • 1
  • 6
  • 30

1 Answers1

1

Use the --webtex option with a custom URL to get equations converted to SVG:

pandoc --webtex 'https://latex.codecogs.com/svg.latex?' ...

Images will be created on the fly by the codecogs web service whenever the resulting HTML document is opened in a browser. To download the images ahead of time and including the images directly, combine it with the --self-contained option.

tarleb
  • 19,863
  • 4
  • 51
  • 80
  • Instead of webtex can we use MathJax, to convert LaTeX to SVG – Santosh S Kumar Sep 06 '20 at 14:25
  • @SantoshSKumar Not as easily, no. MathJax requires JavaScript to be executed, for which you'd need other tools than pandoc. – tarleb Sep 06 '20 at 17:38
  • Understood. I am looking into 2 options: 1. Using https://hackage.haskell.org/package/latex-svg-pandoc which I haven't been able to figureout how to install and use it with pandoc. 2. MathJax released SVG support from 3.0. Trying to figure out if there is a way to use the new feature of MathJax – Santosh S Kumar Sep 07 '20 at 03:25