MathJax in Matlab Help Browser

2 次查看(过去 30 天)
Carl Banks
Carl Banks 2024-8-6
评论: Shubham 2024-8-22
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 个评论
Carl Banks
Carl Banks 2024-8-7
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.

请先登录,再进行评论。

回答(1 个)

Shubham
Shubham 2024-8-20
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 个评论
Carl Banks
Carl Banks 2024-8-20
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 2024-8-22
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?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Assembly 的更多信息

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by