Math input error

55 views
Skip to first unread message

Tomas Bocanera

unread,
Jun 20, 2024, 12:57:27 AM (10 days ago) Jun 20
to MathJax Users
Hi, 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.

Mathjax version: 3.2.2
Combined component being used: tex-mml-chtml.js
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?

Thanks in advance

Davide Cervone

unread,
Jun 20, 2024, 9:25:57 AM (9 days ago) Jun 20
to mathja...@googlegroups.com
Both expressions work fine for me, so I suspect there is a problem with your configuration that is preventing the mml3 extension from loading.  Do you see any errors in the browser console?

Davide


--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mathjax-users/ac4ab36d-4ec1-4a3a-8945-9ffabfe045d0n%40googlegroups.com.

Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

Tomas Bocanera

unread,
Jun 20, 2024, 8:57:13 PM (9 days ago) Jun 20
to MathJax Users
On a second run, seems to be working in Firefox just fine. But not in Chrome/Safari which are the ones that I'm using to test.

No console errors so far.

I've also tried the config suggestions proposed here https://github.com/mathjax/MathJax/issues/2718 but no luck so far.

This is my current config::
window.MathJax = {
mml: {
forceReparse: true
},
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,
fontURL: config.assetsHost + '/fonts/MathJax/HTML-CSS/TeX/woff'
}
};

I've also tried using this demo https://mathjax.github.io/MathJax-demos-web/input-mml2chtml.html to render but no success. I'm assuming that demo site doesn't have the loader: {load: ['[mml]/mml3']}, bit enabled in the config.

Davide Cervone

unread,
Jun 21, 2024, 10:37:41 AM (8 days ago) Jun 21
to mathja...@googlegroups.com
MathJax v3.2.2, there is no instance of MML.mmlFilter.items, so I'm confused about where this message could be coming from.  MathJax v3 doesn't use MML as a variable for the MathML input jax (one there is only one MML variable usage, outside of the legacy AsciiMath code).  Does this come from within your own codebase somewhere?  I suspect it might be from a code example in issue 3030, but it is not included in what you claim is your configuration below.  Are you sure that this configuration is the one in use?  (For example, could there be a second window.MathJax = {...} somewhere later in the HTML document?)

Note that the examples from #3030 and #2718 (that you cited) both use the mml-svg.js file, not tex-mml-chtml.js as you are using.  In mml-svg.js, inputJax[0] is the MathML input jax, while in tex-mml-chtml.js, inputJax[0] is the TeX input jax, and that doesn't have an mmlFilters property.  That is likely what is leading to your error.  You need to use inputJax[1] in that case (in v4, you will be able to use inputJax.tex or inputJax.mml to be sure to find the correct one).  Also, the fix indicated in #2718 has been merged into v3, so is part of v3.2.2 and you no longer need to include that in your configuration.

It looks like you are using a locally hosted copy of MathJax rather than a CDN, and that you may have migrated from v2, as you seem to be using a v2 fontURL.  Note that the fonts have been updated for v3, so you need to use the v3 fonts, not the v2 versions (e.g., there is a new MathJax_zero.woff font, and the calligraphic fonts have been renamed to fix a typo).

Davide

On Jun 20, 2024, at 8:49 PM, 'Tomas Bocanera' via MathJax Users <mathja...@googlegroups.com> wrote:

Forgot to mention the console.errors

In Safari: 
MathJax(?): undefined is not an object (evaluating 'MML.mmlFilters.items')
In Chrome:
MathJax(?): Cannot read properties of undefined (reading 'items')

On Friday 21 June 2024 at 10:37:45 UTC+10 Tomas Bocanera wrote:
On a second run, seems to be working in Firefox just fine. But not in Chrome/Safari which are the ones that I'm using to test.

I've tried the config suggestions proposed here https://github.com/mathjax/MathJax/issues/2718 but no luck so far.

This is my current config:
window.MathJax = {
startup: {
ready() {
MathJax.startup.defaultReady();
MathJax.startup.document.inputJax[0].preFilters.add(function (data) {
data.data = data.data.replace(/[\s\n]+<math/, '<math')
.replace(/math>[\n\s]+/, 'math>');
}, 10);
}
},
-- 
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

Tomas Bocanera

unread,
Jun 23, 2024, 11:30:54 PM (6 days ago) Jun 23
to MathJax Users

Hi Davide. Thanks for answering. 

Please disregard all my previous messages except for the last one. I don't know why they kept on getting deleted that's why I had to post so many. 

In the process of replying I found out that the MML.mmlFilter.items errors were coming from the config examples I was taking from #3030 and #2718 (which you are right, they are mml-svg so they don't really apply and fixes have been already been merged in 3.2.2 which is the version I'm currently using)

I don't actually get any console errors when using the config posted below, and it does render the MathML when using Firefox but not in Chrome or Safari. If you take any of the MathML examples is it rendering for you in Chrome/Safari?

I don't have any other config set in my app. 

This is my current config (Which doesn't throw any console errors):

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
}
};

Tomas Bocanera

unread,
Jun 23, 2024, 11:30:54 PM (6 days ago) Jun 23
to MathJax Users
I don't get any errors in the console unfortunately.

My current config looks like:
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,
fontURL: config.assetsHost + '/fonts/MathJax/HTML-CSS/TeX/woff'
}
};
}

What is a little confusing to me is that using this demo https://mathjax.github.io/MathJax-demos-web/input-mml2chtml.html won't render the MathML expressions posted above. I'm guessing because that demo site doesn't have the loader: { load: ['[mml]/mml3'] } bit in the configuration?


Tomas Bocanera

unread,
Jun 23, 2024, 11:30:55 PM (6 days ago) Jun 23
to MathJax Users
On a second run, seems to be working in Firefox just fine. But not in Chrome/Safari which are the ones that I'm using to test.

No console errors so far.

I've also tried the config suggestions proposed here https://github.com/mathjax/MathJax/issues/2718 but no luck so far.


This is my current config::
window.MathJax = {
mml: {
forceReparse: true
},

I've also tried using this demo https://mathjax.github.io/MathJax-demos-web/input-mml2chtml.html to render but no success. I'm assuming that demo site doesn't have the loader: {load: ['[mml]/mml3']}, bit enabled in the config.

On Thursday 20 June 2024 at 23:25:57 UTC+10 Davide Cervone wrote:

Tomas Bocanera

unread,
Jun 23, 2024, 11:30:55 PM (6 days ago) Jun 23
to MathJax Users
On a second run, seems to be working in Firefox just fine. But not in Chrome/Safari which are the ones that I'm using to test.

No console errors.

I've tried the config suggestions proposed here https://github.com/mathjax/MathJax/issues/2718 but no luck so far.

Tomas Bocanera

unread,
Jun 23, 2024, 11:31:06 PM (6 days ago) Jun 23
to MathJax Users

Hi Davide. Thanks for answering. 

Please disregard all my previous messages except for the last one. I don't know why my messages keep on getting deleted, that's why I had to post so many. 

In the process of replying I found out that the MML.mmlFilter.items errors were coming from the config examples I was taking from 3030 and 2718 (which you are right, they are mml-svg so they don't really apply) . 

I fixed the font reference. Thank you for that.

I don't have any other config on my app for Mathjax and I don't actually get any console errors when using the config posted in my last message above, and it does render the MathML when using Firefox. If you take my MathML example is it rendering for you in Chrome/Safari?


On Saturday 22 June 2024 at 00:37:41 UTC+10 Davide Cervone wrote:

Tomas Bocanera

unread,
Jun 23, 2024, 11:31:06 PM (6 days ago) Jun 23
to MathJax Users

Hi Davide. Thanks for answering. 

Please disregard all my previous messages except for the last one. I don't know why they keep on getting deleted that's why I had to post so many. 

In the process of replying I found out that the MML.mmlFilter.items errors were coming from the config examples I was taking from #3030 and #2718 (which you are right, they are mml-svg so they don't really apply) . 

I fixed the font reference. Thank you for that.

I don't have any other config on my app for Mathjax and I don't actually get any console errors when using the config posted in my last message above, and it does render the MathML when using Firefox. If you take my MathML example is it rendering for you in Chrome/Safari?

<math>

    <mstack>
          <msrow>
               <mo>+</mo>
               <mn>100</mn>
          </msrow>
          <msline></msline>
          <mn>110</mn>
     </mstack>
</math>


On Saturday 22 June 2024 at 00:37:41 UTC+10 Davide Cervone wrote:
Message has been deleted
Message has been deleted

Davide Cervone

unread,
Jun 24, 2024, 6:51:34 AM (5 days ago) Jun 24
to mathja...@googlegroups.com
Please disregard all my previous messages except for the last one. I don't know why my messages keep on getting deleted, that's why I had to post so many. 

Google is flagging you as potential spam for some reason, and putting them in a pending queue that I have to manually allow or disallow.  But it's not telling me there is anything in the queue, so I didn't know your messages were there  waiting.  I have released them.

In the process of replying I found out that the MML.mmlFilter.items errors were coming from the config examples I was taking from 3030 and 2718 (which you are right, they are mml-svg so they don't really apply) .

They do still apply, but you need to use inputJax[1] rather than inputJax[0], as I mentioned in my previous message.

The 2718 patch has been merged into v3.2.2, so you don't need it, but the 3030 patch is in v4.0.0-beta.3 and above, but not v3.2.2, so you still need that one.  That is the source of the issue.  (Your original message did not mention the Firefox vs Chrome/Safari difference, and I was testing in Firefox, which is why I didn't see the issue.)

So you still want to use the 3030 patch, but just change inputJax[0] to inputJax[1].  That should resolve the problem.  E.g., the following file works for me in Chrome and Safari:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS  Bin</title>
</head>
<body>
  <math>
    <mstack>
          <msrow>
               <mo>+</mo>
               <mn>100</mn>
          </msrow>
          <msline></msline>
          <mn>110</mn>
     </mstack>
</math>
  
<script>
MathJax = {
  loader: {load: ['[mml]/mml3']},
  startup: {
    ready() {
      const {Mml3} = MathJax._.input.mathml.mml3.mml3;
      MathJax.startup.defaultReady();
      const mml3 = new Mml3(MathJax.startup.document);
      const adaptor = MathJax.startup.document.adaptor;
      const processor = new XSLTProcessor();
      const parsed = adaptor.parse(Mml3.XSLT, 'text/xml');
      processor.importStylesheet(parsed);
      mml3.transform = (node) => {
        const div = adaptor.node('div', {}, [adaptor.clone(node)]);
        const dom = adaptor.parse(adaptor.serializeXML(div), 'text/xml');
        const mml = processor.transformToDocument(dom);
        return (mml ? adaptor.tags(mml, 'math')[0] : node);
      };
      const MML = MathJax.startup.document.inputJax[1];
      MML.mmlFilters.items.pop();  // remove old filter
      MML.mmlFilters.add(mml3.mmlFilter.bind(mml3));
    }
  }
};
</script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
</body>
</html>

See if that does it for you.

Davide

On Saturday 22 June 2024 at 00:37:41 UTC+10 Davide Cervone wrote:
Reply all
Reply to author
Forward
0 new messages