Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown node type "mstack" #2780

Closed
lled0 opened this issue Oct 5, 2021 · 6 comments
Closed

Unknown node type "mstack" #2780

lled0 opened this issue Oct 5, 2021 · 6 comments

Comments

@lled0
Copy link

lled0 commented Oct 5, 2021

Issue Summary

Hi,

I'm trying to parse a mml formula, but show error: Unknown node type "mstack".

I read in documentation that MathML3 is implemented in version 3 and there isn't needed to import the extension.

Steps to Reproduce:

Here is an example.

Must be shown:
Captura de pantalla 2021-10-05 a las 12 55 30

Technical details:

  • MathJax Version: 3

Thank you!

@dpvc
Copy link
Member

dpvc commented Oct 9, 2021

I read in documentation that MathML3 is implemented in version 3 and there isn't needed to import the extension.

You have misread the documentation. In the link you provide there is a pointer to configuring the extension, and that page indicates that you must use

<script>
MathJax = {
  loader: {load: ['[mml]/mml3']}
};
</script>

to activate the extension. There are, however, several issues with the mml3 extension (see #2718). The first, is that you need to also include forceReparse: true in the configuration, as in

<script>
MathJax = {
  loader: {load: ['[mml]/mml3']},
  mml: {forceReparse: true}
};
</script>

and second, there is an issue with Chrome and Safari that you need to work around. This configuration should do it for the MathJax component that you are using:

  <script>
  MathJax = {
    loader: {load: ['[mml]/mml3']},
    mml: {forceReparse: true},
    startup: {
      ready() {
        MathJax.startup.defaultReady();
        MathJax.startup.document.inputJax[1].preFilters.add(function (data) {
          data.data = data.data.replace(/[\s\n]+<math/, '<math').replace(/math>[\n\s]+/, 'math>');
        }, 10);
      }
    }
  };
  </script>

The Chrome/Safari issue should be resolved and the documentation updated in the next release.

@svejdani
Copy link

@dpvc The above filter wasn't working and I believe it was due to inputJax[1]. It should be inputJax[0].

@dpvc
Copy link
Member

dpvc commented May 10, 2022

@svejdani, it depends on the MathJax file that you are loading. If you used tex-mml-chtml.js, then it would be inputJax[1], but if you used mml-chtml.js then it would be inputJax[0]. Sorry for the confusion!

@svejdani
Copy link

Awesome thanks, that makes more sense!

@dpvc dpvc closed this as completed Aug 5, 2022
@chrisooo3
Copy link

@dpvc after adding configuration, that you have mentioned, I am getting following error:

TypeError: Cannot read property 'getElementsByTagName' of null
    at e.tags (mml-svg.js:1)
    at e.transform (mml3.js:1)
    at e.mmlFilter (mml3.js:1)
    at e.execute (mml-svg.js:1)
    at e.t.executeFilters (mml-svg.js:1)
    at e.compile (mml-svg.js:1)
    at e.t.compile (mml-svg.js:1)
    at Object.renderMath (mml-svg.js:1)
    at e.renderConvert (mml-svg.js:1)
    at e.t.convert (mml-svg.js:1)

To reproduce, here you have jsbin: https://jsbin.com/kuwujesure/1/edit?html,console,output

@dpvc
Copy link
Member

dpvc commented Mar 28, 2023

@chrisooo3, only he loader section of the configuration is needed in v3.2.2 of MathJax, and in any case, your jsbin example has the problem that it uses inputJax[1] rather than inputJax[0] (see my previous comment).

I will respond in your new issue #3030 rather than in this older issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants