1

I would like to export mathematical text to HTML with org-mode. The final output should be pure HTML with equation as images, preferrably svg. However, I would like to use MathJax instead of dvisvgm for its ability to interpret command definition such as

\( 
\newcommand{\glonk}{\int f(x)^\alpha} 
\)

How could I have MathJax calle by org-mode generate svg images?

  • 3
    Not really a proper answer, as this is side-stepping the question (and isn't complete), but I'd recommend just exporting to HTML without any processing of the equations and then passing the result through "server-side" MathJax, rather than trying to develop an Org-specific solution. – aplaice Nov 16 '18 at 12:56
  • Perhaps some custom javascript like this SO post or this other SO post embedded inside your org file in #+BEGIN_EXPORT html ... #+END_EXPORT is a first step. This will tell MathJax to use SVG output. If you just want HTML file, this will do it. Are you asking how to get all math extracted into separate SVG files? – Stefan Avey Nov 16 '18 at 21:42
  • @StefanAvey: yes, I am asking how to get all math extracted into separate SVG files – Alfred M. Nov 19 '18 at 11:37
2
+25

Here is a partial answer.

If you have the org file below, you can export to HTML via ox-pandoc using the org-pandoc-export-to-html5-and-open function.

#+TITLE: Test Export using ox-pandoc
#+PANDOC_OPTIONS: mathjax:t

#+BEGIN_EXPORT html
<!-- https://stackoverflow.com/questions/45774826/svg-output-of-mathjax -->
<script type="text/x-mathjax-config">
    MathJax.Hub.Config({
        extensions: ["tex2jax.js", "TeX/AMSmath.js"],
        jax: ["input/TeX", "output/SVG"],
    })
</script>
#+END_EXPORT

* Equation

\( 
\newcommand{\glonk}{\int f(x)^\alpha} 
\)

\(
\glonk
\)

I am not sure how to extract those formulas rendered as SVG images into separate files which is the crux of the question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.