MathJax in Matlab Help Browser

2 Ansichten (letzte 30 Tage)
Carl Banks
Carl Banks am 6 Aug. 2024
Kommentiert: Shubham am 22 Aug. 2024
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.
  1 Kommentar
Carl Banks
Carl Banks am 7 Aug. 2024
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.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Shubham
Shubham am 20 Aug. 2024
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.
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:
  1. Download MathJax locally from the official site: https://github.com/mathjax/MathJax/archive/refs/tags/3.2.0.zip
  2. Unzip it and place it in a directory accessible to your HTML file.
  3. 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 Kommentare
Carl Banks
Carl Banks am 20 Aug. 2024
Thanks for the answer but this flat out doesn't work; it behaves no differently than linking to the Internet MathJax. I was already using a local copy of MathJax.
Shubham
Shubham am 22 Aug. 2024
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?

Melden Sie sich an, um zu kommentieren.

Produkte


Version

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by