Experimentation reveals that Matlab Help Browser does run inline scripts, but fails to run externally defined scripts. Also does not seem ot call window.load event which is when MathJax starts running.
MathJax in Matlab Help Browser
92 views (last 30 days)
Show older comments
Anyone know if it's possible to do this?
Matlab's web viewer (using web command on local file) shows HTML files that use MathJax just fine. However, when I index the HTML file in a helptoc.xml, so that the file can be viewed in the Help Browser, the MathJax rendered equations are not shown. I assume the javascript that loads MathJax isn't even being run when viewing the file in the Help Browser, but perhaps there is a way.
MathML would be acceptible (and probably superior) but the Help Browser does not seem to support MathML at all.
I no interest in using Live Script or any other publishing solution built into Matlab. The HTML is coming from a source external to Matlab.
Answers (1)
Shubham
on 20 Aug 2024 at 10:19
Hi Carl,
As per my understanding, the issue is caused by the HTML renderer used by MATLAB to view the Help Browser. Since R2021a, CEF(Chromium) is the only supported renderer for MATLAB and Help Browser.
For more information, refer to the following MATLAB Answers post: https://mathworks.com/matlabcentral/answers/385268-how-do-i-change-the-renderer-for-the-help-browser
It is possible that JavaScript that loads MathJax may not be running while viewing the file in Help Browser. I tried reproducing the issue and MathJax was not rendering the equations.
A possible workaround can be achieved using the following steps:
- Download MathJax locally from the official site: https://github.com/mathjax/MathJax/archive/refs/tags/3.2.0.zip
- Unzip it and place it in a directory accessible to your HTML file.
- Update the script tag to load MathJax locally in your HTML file.
<script type="text/javascript" async
src="path/to/your/local/mathjax/es5/tex-mml-chtml.js">
</script>
This enables you to render mathematical equations present in your HTML file in the MATLAB Help Browser.
Hope this helps.
2 Comments
Shubham
on 22 Aug 2024 at 8:28
I did not quite understand your comment. The approach described above functions correctly on my end and successfully renders the mathematical equations in the Help Browser. Could you please provide further clarification?![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1757564/image.gif)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1757564/image.gif)
See Also
Categories
Find more on Assembly in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!