Mathjax for equations rendering
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 105
- 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:
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.
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>
Thanks a lot for your kind help.
------
Gaspard
Gaspard
-
- Posts: 9436
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Mathjax for equations rendering
Hi,
Create somewhere on disk an XML file containing this:
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,
Radu
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>
https://www.oxygenxml.com/doc/versions/ ... bhelp.html
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 105
- Joined: Thu Jan 20, 2022 12:36 pm
Re: Mathjax for equations rendering
Hello, Radu!
Thanks for your answer.
Unfortunately, I had two constraints:
- 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.
Thanks for your answer.
Unfortunately, I had two constraints:
- 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.
------
Gaspard
Gaspard
-
- Posts: 9436
- 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,
Radu
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,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: Mathjax for equations rendering
Post by chrispitude »
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.
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.
-
- Posts: 105
- Joined: Thu Jan 20, 2022 12:36 pm
Re: Mathjax for equations rendering
Hi Chris,
Thanks for your answer and the complementary info.
For sure, converting the equations in svg and getting rid of mathJax call would be a good idea. I'll try to stay informed about this potential new feature. Meanwhile, thanks to Radu's help, I succeeded in creating a plugin that inserts a script in the header directly.
For people like me who are slowly getting acquainted with the creation of plugins, here it is attached
Thanks for your answer and the complementary info.
For sure, converting the equations in svg and getting rid of mathJax call would be a good idea. I'll try to stay informed about this potential new feature. Meanwhile, thanks to Radu's help, I succeeded in creating a plugin that inserts a script in the header directly.
For people like me who are slowly getting acquainted with the creation of plugins, here it is attached
com.xxx.html5-javascript.zip
You do not have the required permissions to view the files attached to this post.
------
Gaspard
Gaspard
Return to “DITA (Editing and Publishing DITA Content)”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service