Convert MathML/LaTeX equations to SVG files during HTML transformations

Are you missing a feature? Request its implementation here.
chrispitude
Posts: 915
Joined: Thu May 02, 2019 2:32 pm

Convert MathML/LaTeX equations to SVG files during HTML transformations

Post by chrispitude »

This is a follow-up to the discussion here:

MathML rendering for PDF

We need a way to publish MathML/LaTeX equations to SVG files during html5 and webhelp-responsive transformations, instead of relying on MathJax to do dynamic rendering at viewing time. This is a requirement for the new project I am working on. The HTML content is used by a large language model (LLM) AI chatbot as input, and this flow does not allow the dynamic MathJax rendering via JavaScript that a web browser does.

This feature would be enabled by a new DITA-OT parameter. Ideally, the SVG rendering would be done with MathJax, which seems to be the best choice for a complete and well-supported equation renderer these days.

Could you please let us know the issue ID for this request? Thanks!
chrispitude
Posts: 915
Joined: Thu May 02, 2019 2:32 pm

Re: Convert MathML/LaTeX equations to SVG files during HTML transformations

Post by chrispitude »

Here's a testcase:

mathml.zip
(998 Bytes) Downloaded 441 times
Radu
Posts: 9174
Joined: Fri Jul 09, 2004 5:18 pm

Re: Convert MathML/LaTeX equations to SVG files during HTML transformations

Post by Radu »

Hi Chris,
In general modern versions of the web browsers including Chrome, Firefox should support embedded MathML equations without the need to refer to MathJax.
Ideally the AI Engine should also support feeding it directly with MathML equations.
Other than that how about if you do some kind of post processing of the WebHelp output folder after the regular Oxygen DITA to WebHelp publishing and find some kind of third party library which can convert MathML to SVG? For example using NodeJS with MathJax?
https://github.com/openstax/mathify
I see that Norm Walsh implemented for XProc a Mathml to SVG step which uses Apache JEuclid for the conversion:
https://github.com/ndw/xmlcalabash1-mat ... toSVG.java
so it would probably not be impossible for someone to create a Saxon XSLT extension function in Java which would use JEuclid for the conversion.
But this does not seem something which would benefit other Oxygen users as they usually consume the MathML either in PDF or in a web browser..
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
chrispitude
Posts: 915
Joined: Thu May 02, 2019 2:32 pm

Re: Convert MathML/LaTeX equations to SVG files during HTML transformations

Post by chrispitude »

Jason Coleman created an open-source DITA-OT plugin for rendering MathML equations to SVG images. You can find it here:

super-structure/com.bentley.math-content (Github repo)

super-structure/com.bentley.math-content (Github release page for v0.9.0-beta)

There is discussion in this DITA-OT enhancement request:

#1774: 1.3: Support MathML and Equation domains
Post Reply