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

mml3 extension not compatible [was: syntax for mml3 extension in config] #193

Open
corinnaSchultz opened this issue Mar 11, 2016 · 7 comments

Comments

@corinnaSchultz
Copy link

I'm trying to figure out how to enable mml3.js. It's unclear to me from the documentation what to put in my config object. Can someone help me out?

mathJaxApi.config({
MathJax: {
    SVG: {
        font: "TeX"
    },
    styles: {
        '.mfrac': {
            'font-size': '92.1%'
        }
    },
    extensions: "MathML/mml3"
}
});
@pkra
Copy link
Contributor

pkra commented Mar 11, 2016

Untested, just off the top of my head.

mathJaxApi.config({
MathJax: {
    SVG: {
        font: "TeX"
    },
    styles: {
        '.mfrac': {
            'font-size': '92.1%'
        }
    },
    extensions: "MathML/mml3.js"
}
});

or following the documentation.

mathJaxApi.config({
MathJax: {
    SVG: {
        font: "TeX"
    },
    styles: {
        '.mfrac': {
            'font-size': '92.1%'
        }
    },
    MathML: {extensions: ["mml3.js"] } 
}
});

@corinnaSchultz
Copy link
Author

Neither of those works, unfortunately. By which I mean, when I put in some mathml, I don't get a response at all from my server. No error, or anything. I assume that means the config isn't in the right format.

I tried this:

mathJaxApi.config({
MathJax: {
    SVG: {
        font: "TeX"
    },
    styles: {
        '.mfrac': {
            'font-size': '92.1%'
        }
    },
    MathML: {extensions: "mml3.js"}
}
});

And I gave it some mathml, a vertical addition problem, and got the error message:

"unknown node type: mstack"

Which is the same message I get when I don't try to load mml3 at all, so I can't tell whether the extension was actually loaded, or if it did load, and it doesn't like my mathml. :(

@corinnaSchultz
Copy link
Author

example mathML:

<math xmlns="http://www.w3.org/2010/Math/MathML"><semantics><mstyle scriptsizemultiplier="0.715"><mstack charalign="center" stackalign="right"><mn>1</mn><msrow><mo>+</mo><mn>3</mn></msrow><msline/><msrow/></mstack></mstyle><annotation encoding="text/plain">one plus three</annotation></semantics></math>

@dpvc
Copy link
Member

dpvc commented Mar 12, 2016

There are two things going on here. First, it looks like the mml3 extension expects you to use the m: namespace; @pkra, do you know a reason for that, or is it just that that is how David's code came to us? So you would have to use <m:math> and so on, and would also need to specify xmlns: "m" in your data being sent to the MathJax Typeset() call.

The other, and more serious, issue is that jsdom doesn't seem to implement the XSLTProcessor object on which the mml3 extension is based. Without that, the mml3 extension can't run. So even with the needed namespace, mml3 won't work in mathjax-node. I see no immediate work-around for this.

@pkra
Copy link
Contributor

pkra commented Mar 14, 2016

@pkra, do you know a reason for that, or is it just that that is how David's code came to us?

Just the way David's code is set up.

The other, and more serious, issue is that jsdom doesn't seem to implement the XSLTProcessor object on which the mml3 extension is based.

Oh, right, I forgot about that part. @corinnaSchultz sorry for writing replies on the go.

I see no immediate work-around for this.

Agreed.

@corinnaSchultz your best bet is probably to take the underlying xslt and run it over your MathML before passing it to mathjax-node.

@pkra pkra added the Accepted label Mar 14, 2016
@pkra pkra added this to the Once upon a v3.0 milestone Mar 14, 2016
@corinnaSchultz
Copy link
Author

I'll hunt down an xslt transformer then, that seems like the best option.

@pkra pkra added the Upstream label Mar 21, 2016
@pkra
Copy link
Contributor

pkra commented Mar 21, 2016

Thanks, @corinnaSchultz. I'm marking this upstream as we want to implement a pure JS version of this extension in core MathJax anyway (which would fix this).

@pkra pkra changed the title syntax for mml3 extension in config mml3 extension not compatible [was: syntax for mml3 extension in config] Apr 13, 2016
@pkra pkra removed this from the After MathJax v3.0 milestone Jan 8, 2018
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

3 participants