## Mathjax for equations rendering

Post here questions and problems related to editing and publishing DITA content.
gbv34
Posts: 38
Joined: Thu Jan 20, 2022 12:36 pm

### Mathjax for equations rendering

Hello,
Eureka, I finally succeed in displaying equations in a project. However, they remain unstyled.
I can use mathjax to render them, but for that I have to insert in every HTML page a javascript call with this script:

Code: Select all

<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
Would you have any suggestion or plugin to use, knowing that I can't define a publishing parameter in Oxygen itself because my client will use the DITA-OT out of Oxygen.

Thanks a lot for your kind help.
Posts: 8010
Joined: Fri Jul 09, 2004 5:18 pm

### Re: Mathjax for equations rendering

Hi,

Create somewhere on disk an XML file containing this:

Code: Select all

<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
If you publish to WebHelp responsive output, there is a transformation parameter named "webhelp.fragment.head" and for other HTML based outputs there is a parameter named "args.hdf" which need to point to the XML file containing the script.
https://www.oxygenxml.com/doc/versions/ ... bhelp.html

Regards,
<oXygen/> XML Editor
http://www.oxygenxml.com
gbv34
Posts: 38
Joined: Thu Jan 20, 2022 12:36 pm

### Re: Mathjax for equations rendering

- I must stick to an HTML scenario, meaning webhelp is not considered as a publishing scenario
- I can't use a parameter because the DITA-OT is externalized on a server.

A potential solution would consist in developing a plugin that automatically inserts a footer like described here: https://www.dita-ot.org/3.6/topics/html ... eader.html. However, my previous attempt remained unsuccessful and I didn't explore it further because we solved the problem of including the mathJax library, not with the js call, but only the relevant CSS in our style management system.

So far, this solution seems okayish. I wanted to share potential answers with the community.
Posts: 8010
Joined: Fri Jul 09, 2004 5:18 pm

### Re: Mathjax for equations rendering

Hi,

I understand the situation, I do not quite understand how you made MathJax work only with CSS changes, changes which also need to be propagated to the publishing engine using parameters.
Also if at some point you create a DITA OT plugin which attempts to add a custom header and it does not work you can zip it, send it to us (support@oxygenxml.com) and I can try to take a look at it.

Regards,
<oXygen/> XML Editor
http://www.oxygenxml.com
chrispitude
Posts: 470
Joined: Thu May 02, 2019 2:32 pm

### Re: Mathjax for equations rendering

Hi gbv34,

I am glad you have something that works!

I am not sure if this is interesting to you, but I posted an idea here:

post65647.html#p65647

that maybe Oxygen's publishing engine could support a generalized MathML-to-SVG conversion at transformation time, so that the end-user's reliance on MathJax would be removed. This could be useful for firewalled or embedded systems, or to speed up the loading of pages with many equations.
gbv34
Posts: 38
Joined: Thu Jan 20, 2022 12:36 pm

Hi Chris,