Borrar filtros
Borrar filtros

MathJax in Matlab Help Browser

92 visualizaciones (últimos 30 días)
Carl Banks
Carl Banks el 6 de Ag. de 2024 a las 10:11
Comentada: Shubham el 22 de Ag. de 2024 a las 8:28
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 comentario
Carl Banks
Carl Banks el 7 de Ag. de 2024 a las 0:37
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.

Iniciar sesión para comentar.

Respuestas (1)

Shubham
Shubham el 20 de Ag. de 2024 a las 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.
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 comentarios
Carl Banks
Carl Banks el 20 de Ag. de 2024 a las 21:40
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 el 22 de Ag. de 2024 a las 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?

Iniciar sesión para comentar.

Categorías

Más información sobre Assembly en Help Center y File Exchange.

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by