Creating MathML Web Pages
You have a number of options for creating MathML web pages. Design Science's
MathType and WebEQ products both contain MathML authoring capabilities, and
several other vendors also provide MathML authoring tools. Web programmers also
have the option of generating MathML web pages programmatically using the
technical information below.
There are two ways to work with MathML using our
MathType product:
From a Microsoft Word document:
If you have a Microsoft Word document containing MathType and/or Equation
Editor equations, you can generate a web page using MathType 5's
MathPage feature. Just
choose the "XHTML+MathML" or "MathPlayer (IE behavior)" target in the MathPage
dialog. The "MathPlayer (IE behavior)" target creates a standard HTML
page viewable by Internet Explorer with MathPlayer. To create XHTML pages
that are also viewable in Netscape and Mozilla, choose the "XHTML+MathML"
target. See Making Your Pages
Work with Netscape and Mozilla for more information about the differences
between HTML and XHTML pages.
With your favorite HTML editor:
If you normally author web pages using an HTML editor, such as Adobe's GoLive
or Macromedia's Dreamweaver, you can use MathType to create equations
one-by-one and paste them into the web page you are editing. First, go to
MathType 5's Translator facility and choose the translator named "MathML 2.0 (m
namespace)". Then, when you copy an equation from MathType's editing window, it
will be automatically translated to MathML. Just bring your HTML editor to the
front, place the insertion point where you want the equation and paste.
You will also need to make sure the head section of your HTML page contains
the proper MathPlayer declaration statements. The easiest way to ensure your
page is set up correctly is to start with one of the templates provided below
in the Anatomy of a MathPlayer-enabled Web
Page section.
You can also use this technique to create XHTML pages that are viewable in
Netscape and Mozilla as well as Internet Explorer. In this case, you will
need to be sure your HTML editor can generate XHTML. Recent versions of
Microsoft FrontPage and Dreamweaver both have this capability. In
addition, you will also need to set your MathType translator to "MathML 2.0
(namespace attr)" and use different declarations in the head section of your
page. As with HTML pages, the easiest way to ensure your page is set up
correctly is to start with the appropriate template provided below in the
Anatomy of a MathPlayer-enabled Web Page
section.
With our WebEQ Developers Suite, you also
have two choices.
Using WebEQ Editor:
You can use the WebEQ Editor together with your favorite HTML editor, just as
you would use MathType. For authoring HTML pages, set your MathML Export
preferences to generate markup using an "m:" namespace prefix, and then cut and
paste from WebEQ Editor into your HTML source. For XHTML pages, make sure your
HTML editor is set to generate XHTML, and set your WebEQ MathML Export
preferences to include a namespace declaration and not to use a namespace
prefix.
You will also need to make sure the head section of your HTML page contains
the proper declaration statements as described in the
Anatomy of a MathPlayer-enabled Web Page
section. To place the MathPlayer declaration statements in the head of your
page, you can either use the WebEQ Editor's Copy Special command to
place the necessary header statements on the clipboard, and paste into your
page. Or, start your web page using one of the page templates provided below.
Using WebEQ Publisher:
To create a MathML Web page with WebEQ Publisher, author your HTML or XHTML
page as you normally would. For the mathematics, you can either paste in MathML
markup using the WebEQ Editor or write WebTeX by hand at the appropriate
places in your page source. When the page is finished, run the WebEQ Publisher
to add the MathPlayer declarations to the head of your document and translate WebTeX into MathML as necessary. Choose the "MathPlayer namespace declaration"
option from the Translation Options dialog for HTML pages and the "Mozilla
namespace declaration" option for XHTML pages.
There are a number of other editors and converters available to help you
author MathML Web pages. See the
MathML Software list
maintained by the World Wide Web Consortium (W3C).
MathPlayer 2.1 has added support for XHTML + MathML documents. Earlier
versions of MathPlayer could only display MathML embedded in HTML documents.
This caused interoperability problems with the Netscape and Mozilla browsers
which only have support for MathML in XHTML documents. XHTML is a new,
XML-based version of HTML with much stricter syntax rules.
Browsers mostly rely on the MIME type of a document to determine whether to
treat it as HTML or XHTML. The MIME type is set by the web server and sent
along as part of the data in the HTTP response. While MathPlayer can render
MathML in both HTML and XHTML pages, unfortunately Netscape and Mozilla can
only display MathML in XHTML document. Thus, for maximum interoperability, you
will want to generate XHTML pages. For a brief summary of the differences
between HTML and XHTML, see
Authoring
MathML for Mozilla.
To support MathML in XHTML, MathPlayer 2.1 monitors incoming XML documents.
When it detects an XHTML + MathML document, it automatically processes it to
add the necessary MathPlayer declarations to the head of the document and to
properly format any embedded MathML markup for display with MathPlayer. For MathPlayer's automatic processing of XHTML + MathML documents to be triggered
for a page, it must satisfy the following conditions:
- The document must have a complete, valid XHTML + MathML DOCTYPE
declaration, OR the document must declare the MathML namespace on the <html>
element. In either case, the declaration must be contained within the first 2000 characters of the document.
- There can be no XSL stylesheet directive within the first 2000 characters of
the page. If the author has specified XSL
processing, automatic processing by MathPlayer will interfere.
- Documents served from a web server should be served with the MIME type
IETF (Internet Engineering Task Force ), the standards organization in charge of MIME types, has issued new
rules that make application/xhtml+xml the preferred MIME type for XHTML
pages and that deprecate the use of text/xml. However, for
backward compatibility, MathPlayer will continue to support XHTML
documents served by a web server with MIME types
- 'text/xml'
- 'text/xml; charset=utf-8',
- 'text/xml; charset=iso-8859-1'
Note, however, on some systems, MathPlayer processing may fail for these
MIME types due to low-level conflicts in the handling of text/xml
documents. Such conflicts were an important factor in IETF's decision
to deprecate text/xml.
For documents viewed from the local file system, and not through a web
server, documents should be given the extension .xht rather than .xml to
insure proper processing by MathPlayer.
See Server Setup and Configuration
for more details on setting MIME types.
The universal math style sheet
Using an XSL stylesheet is another method for creating MathML web pages that
are interoperable between Internet Explorer and MathPlayer, Netscape and
Mozilla. Before MathPlayer 2.1 added direct support for XHTML, this was the
only method to create interoperable web pages and it is still in common usage.
The W3C provides a universal
XSL Math stylesheet, along with
instructions for its use.
MathPlayer 2.1 is backward compatible with the Universal Math Style Sheet. As
noted above, XHTML + MathML pages that contain a link to a stylesheet will not
be processed by MathPlayer, and will continue to function as they did with
earlier versions of MathPlayer. Since XSL stylesheets are somewhat tricky to
use, and lead to slower display, we do not recommend the use of the W3C Math
style sheet for new pages.
If you want to create a web page by hand, the following outlines what needs
to be in an HTML or XHTML page for MathPlayer to work in Internet Explorer. For
more in depth discussion of the meaning and syntax of the relevant declaration
statements in both formats, see the
Introduction to Using
MathML tutorial.
For HTML:
<HTML XMLNS:m="http://www.w3.org/1998/Math/MathML">
<HEAD>
<OBJECT
ID=MathPlayer
CLASSID="clsid:32F66A20-7614-11D4-BD11-00104BD3F987"
>
</OBJECT>
<?IMPORT NAMESPACE="m" IMPLEMENTATION="#MathPlayer" ?>
</HEAD>
<BODY>
...
<p>Here is some math:
<m:math>
<m:msup>
<m:mi>x</m:mi>
<m:mn>2</m:mn>
</m:msup>
<m:mo>+</m:mo>
<m:mn>9</m:mn>
<m:mi>x</m:mi>
<m:mo>+</m:mo>
<m:mn>9</m:mn>
<m:mo>=</m:mo>
<m:mn>0</m:mn>
</m:math>
</p>
</BODY></HTML>
|
Here are some details:
- The XMLNS:M attribute in the HTML tag establishes that any element name in
the document prefixed by "m" refers to MathML 2.0.
- In the HEAD element:
- The OBJECT element attaches the "MathPlayer" ID to the MathPlayer
software itself.
- The CLASSID names MathPlayer's unique GUID that tells Internet
Explorer (via the Windows Registry) where MathPlayer is installed on the
local computer.
- The IMPORT processing instruction says that elements whose namespace is
indicated by the "m" prefix are to be displayed using the software whose ID
is "MathPlayer".
- Internet Explorer requires that MathML (or any XML fragment) embedded in
the HTML document have each element name preceded by a namespace prefix, "m"
in this case.
The above HTML code is available as an HTML Page
Template. To get your own copy of this file, right-click on the link in the
previous sentence and choose the Save Target As command. WARNING: The
file menu Save and Save As commands will not properly save the
file. Internet Explorer will remove the processing instruction. This is a known
bug in Internet Explorer.
For XHTML
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
"http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
...
<p>Here is some math:
<math xmlns="http://www.w3.org/1999/xhtml">
<msup>
<mi>x</mi>
<mn>2</mn>
</msup>
<mo>+</mo>
<mn>9</mn>
<mi>x</mi>
<mo>+</mo>
<mn>9</mn>
<mo>=</mo>
<mn>0</mn>
</math>
</p>
</body></html>
|
Here are some details:
- XHTML files must begin with an <?xml ... ?> processing instruction
- The page must contain a valid XHTML + MathML DOCTYPE declaration before
the start of the document markup as shown.
- In XTHML all tag names are lower case.
- The <html> element and each <math> element must have a namespace attribute
(xmlns) with the values shown.
The above code is available as a XML Page Template.
To get your own copy of this file, right-click on the link in the previous
sentence and choose Save Target As. Doing View Source on the actual page will
only get you what MathPlayer transforms the page into.
|