Reputation: 18918
My browser, Firefox 3.6, seems to display the Mathml equations in the W3C test suite just fine. But if I copy the code into my webpage, like from here, all Firefox produces is something like x y x y
instead of how it correctly rendered the W3C page. What am I missing here>
EDIT: I just tried it in Chrome and Chrome failed the test itself by rendering it as x y x y
. Needless to say, it rendered the math in my own webpage the same.
EDIT 2: I tried it on a new html document. Doesn't work:
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
</head>
<body>
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML" mode="display">
<mfrac>
<mi>x</mi>
<mi>y</mi>
</mfrac>
</math>
<math display="block" xmlns="http://www.w3.org/1998/Math/MathML" mode="inline">
<mfrac>
<mi>x</mi>
<mi>y</mi>
</mfrac>
</math>
</body>
</html>
I swear the W3C equations render just fine though...
Upvotes: 5
Views: 7372
Reputation: 12642
Including
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=MML_HTMLorMML"></script>
and then using
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mroot>
<mrow>
<mi>x</mi>
</mrow>
<mn>4</mn>
</mroot>
</math>
works in Chrome and Firefox
Update:
Since the mathjax cdn is shutting down, change
<script type="text/javascript" async
src="https://cdn.mathjax.org/mathjax/2.7-latest/MathJax.js?...">
</script>
to
<script type="text/javascript" async
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?...">
</script>
Upvotes: 9
Reputation: 21
as others have said you need to serve as xml for FF3, if you want to use mathml-in-html5 served as text/html you need firefox 4 (or webkit nightlies)
Upvotes: 2
Reputation: 28628
Putting your file in a filename named mml-prb.xhtml
works. Note the extension.
Upvotes: 1
Reputation: 5379
You should use xml and serve it as such (i.e. use correct mimetype), which means you have to use xhtml and mathml tags with proper namespaces. Take how W3C serves the example as an example.
Note: HTML5 is NOT xml
Upvotes: 0