MathJax in Matlab Help Browser

4 ビュー (過去 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 Center および File ExchangeAssembly についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by