473,811 Members | 2,851 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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"><s pan id="d0e3" class="mrow">
<table class="munderov er">
<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"><s pan id="d0e22" class="mo">(</span><span
class="mi1">x</span><span id="d0e26"
class="mo">)</span></span><script>
var mrowH = d0e20.offsetHei ght;

mrowStretch(d0e 22,"æ","ç","à §","è");
mrowStretch(d0e 26,"ö","÷","à ·","ø");</script><span id="d0e30"
class="mo">ⅆ</span><span class="mi1">x</span></span></span>
Jul 20 '05 #1
4 1805
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
4968
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 webserver runs that part of the script (see attached file, snippet.php), though, it doesn't go through. I don't get an error message or anything...it just returns a "1" (whereas it should return a "0") as far as I can tell. I have read the PHP...
2
6870
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 SIGNATURE-----
0
1269
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 programs on the MathML page, just not that. Soren --
2
2008
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 bottom of this posting, but my quations is:
2
1729
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 validating mode both complain that math doesn't have an xmlns attribute. If I leave out the attribute, then the Mathml stylesheet doesn't format the Mathml content using either
7
1864
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 fine in FireFox. However, if I change an entire math element, as in the following: eqElement = document.getElementById("equation");
3
1437
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"> <head> <title>Minimum Document with MathML</title> <script> var pi=Math.PI function JUMPING()
3
1417
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> <mi>z</mi> <mn>2</mn>
5
13389
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 http://mghospedagem.com/images/controlpanel.jpg instead of http://mghospedagem.comhttp://mghospedagem.com/images/controlpanel.jpg As u see, there's the website URL before the image URL.
0
9722
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9603
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9200
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7664
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6882
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4334
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.