mathjax / MathJax

Beautiful and accessible math in all browsers
http://www.mathjax.org/
Apache License 2.0
10.02k stars 1.16k forks source link

Math input error when trying to render MathML #3245

Open tomas-bocanera-lrn opened 2 weeks ago

tomas-bocanera-lrn commented 2 weeks ago

Issue Summary

Following up this conversation https://groups.google.com/g/mathjax-users/c/DyJLJhiJO00 here, since all my messages are getting automatically deleted in Google Groups for some unknown reason.

I'm trying to render these 2 MathML:

<math>
    <mstack>
          <msrow>
               <mo>+</mo>
               <mn>100</mn>
          </msrow>
          <msline></msline>
          <mn>110</mn>
     </mstack>
</math>
<math>
    <mstack>
        <mscarries crossout=\"updiagonalstrike\">
            <mn>2</mn>
            <mn>12</mn>
            <mscarry crossout=\"none\">
                <none></none>
            </mscarry>
         </mscarries>
         <mn>2,327</mn>
         <msrow>
             <mo>-</mo>
             <mn> 1,156</mn>
         </msrow>
         <msline> å</msline>
         <mn>1,171</mn>
     </mstack>
</math>

But I keep getting "Math input error" for both of them in both Chrome and Safari. In Firefox is rendering as intended and working fine 👍

I'm loading the experimental loader: {load: ['[mml]/mml3']} to add experimental support for these tags.

Would you happen to know what could be the issue with rendering the above? And how to solve it?

I don't have any other config on my app for Mathjax and I don't actually get any console errors.

Steps to reproduce

JSbin as an example to reproduce the issue: https://jsbin.com/hujocigeba/edit?html,output You can see that it is working as intended in Firefox but not in Chrome and Safari.

Technical details:

MathJax Version: 3.2.2 Combined component being used: tex-mml-chtml.js Client OS: Mac OS Sonoma14.5 (23F79) Browser: Chrome Version 126.0.6478.115 (Official Build) (arm64) & Safari Version 17.5 (19618.2.12.11.6)

I am using the following MathJax configuration:

                    window.MathJax = {
                        loader: {load: ['[mml]/mml3']},
                        options: {
                            enableMenu: false,
                            ignoreHtmlClass: 'noMath'
                        },
                        tex: {
                            inlineMath: [['\\(', '\\)'], ['$$', '$$']],
                            displayMath: [['\\[', '\\]']],
                            macros: {
                                abs: ['{|#1|}', 1],
                                degree: ['°'],
                                longdiv: ['{\\enclose{longdiv}{#1}}', 1],
                                atomic: ['{_{#1}^{#2}}', 2],
                                polyatomic: ['{_{#2}{}^{#1}}', 2],
                                circledot: ['{\\odot}'],
                                parallelogram: ['\\unicode{x25B1}'],
                                ngtr: ['\\unicode{x226F}'],
                                nless: ['\\unicode{x226E}'],
                                MathQuillVarField: ['#1', 1],
                                overarc: ['{\\overparen{#1}}', 1]
                            }
                        },
                        chtml: {
                            minScale: 1,
                            matchFontHeight: false
                        }
                    };

Supporting information:

No console errors

Chrome (throwing error): Screenshot 2024-06-24 at 1 10 02 PM Firefox (rendering ok): Screenshot 2024-06-24 at 1 10 06 PM

dpvc commented 2 weeks ago

It turns out that this the same issue as #3030, and the patch listed there resolves it (if you switch inputJax[0] to inputJax[1] to accommodate the fact that you are using tex-mml-chtml.js rather than mml-svg.js that was used in #3030).

tomas-bocanera-lrn commented 2 weeks ago

Thanks Davide that fixes it. Do you know if this fix will be included in future versions of Mathjax?

dpvc commented 2 weeks ago

Do you know if this fix will be included in future versions of Mathjax?

Yes, it is already included in v4.