473,324 Members | 2,268 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Trouble with mathml (either style or source)

I'm trying to build some mathml for a paper. I've got the mathml2 dtd,
and the style sheets also from the canonical website
http://www.w3.org/Math/. But I'm having some trouble. I've input the
example from page 90 of the mathml handbook, which is a simple bounded
integral. The mathml is as follows, where I've substituted the
numerical values for the named entities:-

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE math SYSTEM "../mathml2/mathml2.dtd">
<math
xmlns="http://www.w3.org/1998/Math/MathML">
<mrow>
<munderover>
<mo>&#x0222B;</mo>
<mi>a</mi>
<mi>b</mi>
</munderover>
<mi>f</mi>
<mo>&#x02061;</mo>
<mrow>
<mo>(</mo><mi>x</mi><mo>)</mo>
</mrow>
<mo>&#x02146;</mo><mi>x</mi>
</mrow>
</math>

The result of applying the mathml.xsl stylesheet, using pmathmlcss.xsl
in place of pmathml.xsl, is given below. However, this doesn't display
as the book shows it. The integral and its limits look fine, but the
function f(x) appears underneath it instead of to the right. IE 6 and
Mozilla 0.9.9 both display it the same way, so I guess there must be
something wrong with the original markup. Any idea what?

<span xmlns:m="http://www.w3.org/1998/Math/MathML" id="d0e1"
class="mrow"><span id="d0e3" class="mrow">
<table class="munderover">
<tr>
<td><span class="mi1">b</span></td>
</tr>
<tr>
<td><span id="d0e7" class="mo">∫</span></td>
</tr>
<tr>
<td><span class="mi1">a</span></td>
</tr>
</table><span class="mi1">f</span><span id="d0e20"
class="mrow"><span id="d0e22" class="mo">(</span><span
class="mi1">x</span><span id="d0e26"
class="mo">)</span></span><script>
var mrowH = d0e20.offsetHeight;

mrowStretch(d0e22,"æ","ç","ç","è");
mrowStretch(d0e26,"ö","÷","÷","ø");</script><span id="d0e30"
class="mo">ⅆ</span><span class="mi1">x</span></span></span>
Jul 20 '05 #1
4 1775
The result of applying the mathml.xsl stylesheet, using pmathmlcss.xsl
in place of pmathml.xsl,


I don't really recommend pmathmlcss except as a last resort if nothing
else is available, but if that is the case here, note that it is
designed to take as input xhtml+mathml documents not just mathml
ones. When processing the <head> of the document it adds some javascript
definitions that are used in the rendering. When you give it (just) a
mathml document it doesn't (currently, although that would be easy to
add) synthesise an <html> element or a <head> element containing the
<scripts that are needed so you end up wuth a document thatjust consists
of an html table with no surrounding document markup, and containing
references to undefined javascript functions.

If your input looks like the following then you do get a more reasonable
result.

David
<?xml version="1.0" encoding="ISO-8859-1"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head/>
<body>
<math
xmlns="http://www.w3.org/1998/Math/MathML">
<mrow>
<munderover>
<mo>&#x0222B;</mo>
<mi>a</mi>
<mi>b</mi>
</munderover>
<mi>f</mi>
<mo>&#x02061;</mo>
<mrow>
<mo>(</mo><mi>x</mi><mo>)</mo>
</mrow>
<mo>&#x02146;</mo><mi>x</mi>
</mrow>
</math>
</body>
</html>
Jul 20 '05 #2
David Carlisle <da****@nag.co.uk> wrote in message news:<yg*************@penguin.nag.co.uk>...
The result of applying the mathml.xsl stylesheet, using pmathmlcss.xsl
in place of pmathml.xsl,


I don't really recommend pmathmlcss except as a last resort if nothing
else is available, but if that is the case here, note that it is
designed to take as input xhtml+mathml documents not just mathml
ones. When processing the <head> of the document it adds some javascript
definitions that are used in the rendering. When you give it (just) a
mathml document it doesn't (currently, although that would be easy to
add) synthesise an <html> element or a <head> element containing the
<scripts that are needed so you end up wuth a document thatjust consists
of an html table with no surrounding document markup, and containing
references to undefined javascript functions.

If your input looks like the following then you do get a more reasonable
result.


-----------snip-------------

Thanks, that's much better. At least I have a better understanding of
what's going on. What I'm actually trying to do is as follows. I have
some text in which I wish to include some mathematical notation. The
text is an xml document, with its own DTD which I created from scratch
(at least part of the task is an xml learning exercise on my part),
and a corresponding styesheet. I'm not using xhtml since as far as I
can see this has all the lack of expression of structure that html had
(it seems to be just an xml conformant version of html, expressing
only presentation). I wish to embed a mathml stylesheet in my
stylesheet, the mathmnl dtd in my dtd, and get both the ordinary text
and the maths to display correctly in some browser. I don't mind
whether that browser is mozilla or IE, and if necessary I can upgrade
mozilla to get better mathml support. My stylesheet outputs html in
which I was hoping the mathml would embed. But the situation I ended
up with was I could either get my document displaying correctly apart
from the maths part, or entirely incorrectly with the exception of the
maths part which was correct. My suspicion is that the way forward is
to go entirely to xml, and let mozila intrepret it. But I can't yet
see how to get the rest of the format (which was added by my
stylesheet and expressed in terms of <H1>, <p> etc) to work properly
in this case.
Jul 20 '05 #3
jg*@pobox.com (Jon Thackray) writes:
Thanks, that's much better. At least I have a better understanding of
what's going on. What I'm actually trying to do is as follows. I have
some text in which I wish to include some mathematical notation. The
text is an xml document, with its own DTD which I created from scratch
(at least part of the task is an xml learning exercise on my part),
and a corresponding styesheet. I'm not using xhtml since as far as I
can see this has all the lack of expression of structure that html had
(it seems to be just an xml conformant version of html, expressing
only presentation). I wish to embed a mathml stylesheet in my
stylesheet, the mathmnl dtd in my dtd, and get both the ordinary text
and the maths to display correctly in some browser. I don't mind
whether that browser is mozilla or IE, and if necessary I can upgrade
mozilla to get better mathml support. My stylesheet outputs html in
which I was hoping the mathml would embed. But the situation I ended
up with was I could either get my document displaying correctly apart
from the maths part, or entirely incorrectly with the exception of the
maths part which was correct. My suspicion is that the way forward is
to go entirely to xml, and let mozila intrepret it. But I can't yet
see how to get the rest of the format (which was added by my
stylesheet and expressed in terms of <H1>, <p> etc) to work properly
in this case.


You will get _much_ better rendering if you just let mozilla render the
mathml directly (and IE render it via MathPlayer) the conversion to
javascript and css done by pmathmlcss is designed to make the
mathematics more or less legible but will never produce anything
approaching typographically acceptable output. (Actually it is possible
to get virtually TeX quality rendering of mathematics using css and
javascript but pmathmlcss is designed to work in "real time" styling the
document on the client so does a more or less naive translation
especially as it was developed some years ago when mozilla's xslt
transformer was still in beta and rather unstable so there was a real
incentive to keep the stylesheet simple.

You just want to make "the rest of your format" be xhtml not html, ie
have the right namespace, and be lowercase h1 not H1 etc.

Have a look at for example at the OpenMath spec:

http://www.openmath.org/standard/om20

it starts off life as a docbook+mathml document and is styled to
xhtml+mathml (and separately to pdf). Source documents, generated final
forms and stylesheets are all available from the above.

David
Jul 20 '05 #4
David Carlisle <da****@nag.co.uk> wrote in message news:<yg*************@penguin.nag.co.uk>...
jg*@pobox.com (Jon Thackray) writes:
snip
You will get _much_ better rendering if you just let mozilla render the
mathml directly (and IE render it via MathPlayer) the conversion to
javascript and css done by pmathmlcss is designed to make the
mathematics more or less legible but will never produce anything
approaching typographically acceptable output. (Actually it is possible
to get virtually TeX quality rendering of mathematics using css and
javascript but pmathmlcss is designed to work in "real time" styling the
document on the client so does a more or less naive translation
especially as it was developed some years ago when mozilla's xslt
transformer was still in beta and rather unstable so there was a real
incentive to keep the stylesheet simple.

You just want to make "the rest of your format" be xhtml not html, ie
have the right namespace, and be lowercase h1 not H1 etc.

Have a look at for example at the OpenMath spec:

http://www.openmath.org/standard/om20

it starts off life as a docbook+mathml document and is styled to
xhtml+mathml (and separately to pdf). Source documents, generated final
forms and stylesheets are all available from the above.


Hmm, I'm still struggling with this, so I guess I must be missing
something. I've now set the output method to be xhtml (which saxon
objects to, but xalan seems happy with). If I write the output to an
file with an xml extension, mozilla renders the maths bit properly,
but ignores all the rest of the document formatting (all the h1s etc),
whereas if I simply change the extension to be html, mozilla now takes
note of all the formatting, but renders the maths incorrectly (it just
renders it as though it had ignored the mathml tags). I have added an
xmlns attribute ("http://www.w3.org/1999/xhtml")to the output html
tag, but this doesn't seem to help. How do I get it to take note of
both the normal xhtml format, and the mathml markup?
Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my...
2
by: Joachim Spoerhase | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, does anybody know a good WYSIWYG MathML Equation Editor for Linux? Many thanks in advance Joachim Spoerhase -----BEGIN PGP...
0
by: Soren Kuula | last post by:
Hi, Does anyone know a (open source) way of transforming MathMl in DocBook documents to PDF, along with the DocBook stuff ? Preferrably not that LaTex back ned hack. I can find loads of...
2
by: Florian Huber | last post by:
Hello! i've got a Problem: I'd like to build a website, which contains HTML and MathML, but it should be readable for most of the site visitors. I know about the ways mentioned at the...
2
by: Jon Thackray | last post by:
I'm trying to use the MathML DTD and stylesheets, but get some problems with xmlns attributes. If I do something like <math xmlns="http://..."> .... </math> then xmllint and xalan in...
7
by: DKM | last post by:
I need an equivalent for the following: document.getElementById('equation').update(); from Mathplayer to use it in Mozilla based browser. When I change any text node, the page updates just...
3
by: dan_andrews | last post by:
<?xml version="1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd" > <html xmlns="http://www.w3.org/1999/xhtml">...
3
by: Fred | last post by:
I'm experimenting with MathML, and have run into difficulty. Given the simple XML: <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE component SYSTEM "mathml2.dtd"> <mathDisplay> <math> <msub>...
5
matheussousuke
by: matheussousuke | last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails. The goal is: Make it send the email with the URL...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.