Skip NavigationDesign Science: How Science Communicates
Products Solutions Store Support Reference Company View Cart
 
 

MathType Works With MathML

Authoring MathML with MathType 

As stated in the original MathML Specification, Mathematical Markup Language (MathML) is an Extensible Markup Language (XML) vocabulary with the goal of "enabling mathematics to be served, received, and processed on the Web, just as HTML has enabled this functionality for text." One tool for authoring MathML is MathType. In this AppNote, we describe how to use MathType to create MathML.

Contents

Introduction

Most of the time when people create an expression with MathType, they intend for the output to be some sort of graphic format, such as an embedded object in Word or PowerPoint, an EPS in QuarkXPress or Adobe InDesign, or a GIF on a web page. MathType also has the ability to translate into several text markup languages: TeX, LaTeX, Texvc (for Wikipedia) and MathML. This article outlines the use of MathType for Windows and Macintosh as it pertains to MathML markup. We assume the reader is familiar with the MathType user interface and its basic usage. Some background in XML and MathML syntax could be useful but is not necessary. For introduction in how to use MathType itself, please refer to the MathType documentation.

There are two main scenarios that are common when saving mathematical & scientific web pages with MathML equations. We will consider both of these situations in this article:

  1. You are creating the web page with web page authoring software (such as Adobe Dreamweaver or Microsoft FrontPage) or a text editor (such as Notepad). When using this method, you will create the equation in MathType, then copy it from MathType and paste it into your document. If using web page authoring software, the MathML must be pasted into the Code View, not the Design View. We have more information on how to do this at the resources listed in the next paragraph.
  2. You are either writing your document in Microsoft Word, or are working with an existing Word document. In this case, the best route to the completed web page is to use the "Export to MathPage" option. We discuss this in more detail later in the article.
  3. Regardless of which of the above 2 scenarios applies to you, there are different "flavors" of MathML, and different choices to make during the conversion or export process. We deal with all of this below.

This AppNote will not be a complete guide for authoring web pages with MathML. For assistance with this, please see our other articles and Application Notes on the subject:

Advantages of MathType when creating MathML

MathType offers several advantages to the author:

  • MathType is an established commercial-quality editor, developed and marketed by a company with over 20 years in business. MathType is robust and has various interface features that are expected from a comprehensive formula editor.
  • MathType makes the work of creating and including mathematical expressions very convenient. Its MathML translation process is simple. The markup works well with MathPlayer, Maple, Mathematica and other standard math and science software.
  • Much more! For additional features and advantages of MathType, see the MathType Complete Features List.

MathML environment of MathType

Once you have launched MathType and have created an expression in the workspace, you are ready to translate it into MathML markup. You do this by selecting Translators from the Preferences menu.

preferences-translators

When the mouse is over the Translators submenu, you will notice the following message in the status bar:

Set the type of data MathType will place on the clipboard.

Such useful cues to the user are provided for all the palettes, symbols, templates, and menus in MathType and can help in the authoring process.

Choosing the Translators submenu opens up the Translators dialog, as shown below:

Relevant items in the dialog are:

  • Translation to other language (text) which needs to be checked.

  • Include translator name in translation and Include MathType data in translation which are optional. The effect of each is somewhat clear from its description; what's not clear is why you might want to check or uncheck these boxes.

    • Include translator name. This option is never required, but is useful for debugging situations later where what you see on the web page may not be what you thought you created in MathType.
    • Include MathType data. This option is also never required in a generic sense, but it does have a very practical use. MathType does not have the capability of importing a block of MathML markup. By including the "MathType data" (also referred to as MTEF), you include the capability for the MathML equation to be edited in MathType later on, or used in another document. This can be done either by copy & paste or, if you're using the IE/MathPlayer combination, there's an option in MathPlayer's contextual menu to "Open with MathType":

When you click OK and close MathType, your settings are saved. Although you do not have to change the Translators options each time you start a MathType session, it's not a bad idea to check the settings once in a while.

MathML translators in MathType

Since version 4.0, MathType has provided output translators for MathML. MathML has evolved significantly since its inception in 1998, and MathType's ability to create MathML markup has kept pace. MathType currently includes 4 MathML translators:

  1. MathML 1.0
  2. MathML 2.0 (m namespace)
  3. MathML 2.0 (namespace attr)
  4. MathML 2.0 (no namespace)

The MathML 1.0 translator is included for legacy purposes. The last 3 translators are used in various scenarios, as described below. As a MathType customer, it is also possible for you to create your own translator, or to modify an existing translator. The translator definition language is documented as part of the MathType Software Development Kit (SDK).

Choosing a translator

This AppNote will not discuss using the MathML 1.0 translator, as it is included only to provide support for documents that may have been created under that early standard.

Deciding between the three MathML 2.0 translators is generally a matter of what software the MathML will be processed with later on.

  • MathPlayer, for example, is a high-performance MathML display engine distributed at no charge by Design Science in order to enable Microsoft Internet Explorer (IE) to display MathML, which IE cannot do natively. MathPlayer requires an "m namespace prefix", so the "MathML 2.0 (m namespace)" translator would be used when authoring web pages intended to be rendered by MathPlayer in IE. Here's an example of some MathML markup that MathPlayer could display properly in IE 7:

<m:math><m:mi>x</m:mi><m:mo>+</m:mo><m:mi>y</m:mi></m:math>

  • Netscape (and other "Gecko-powered" browsers, such as Firefox) require the MathML namespace to be specified as an attribute on the <math> element, so the "MathML 2.0 (namespace attr)" translator would be used in this case. Here's an example of some MathML markup that Firefox could display correctly:

<math xmlns='http://www.w3.org/1998/Math/MathML'>
<mi>x</mi><mo>+</mo><mi>y</mi>              
</math>                                          

Indented markup as you see here is optional in MathML, but it helps readability. With or without the indent, the expression would be rendered the same way: x + y.

  • Some MathML-savvy software, such as WebEQ, will accept any "flavor" of valid MathML, so it doesn't really matter which of the MathML 2.0 translators you use for products such as this. Even so, the "MathML 2.0 (no namespace)" translator produces cleaner markup code, so it's probably a good idea to use that one. Here's an example that could be pasted into WebEQ, Maple, or Mathematica:

<math><mi>x</mi><mo>+</mo><mi>y</mi></math>

We have a separate AppNote that discusses how to incorporate MathML into web pages created with Dreamweaver 8 and Dreamweaver CS3. The AppNote, Authoring Web Pages with MathML and Dreamweaver, was written with the Dreamweaver user in mind, but it contains some good tips for anyone using MathML on the web. This is important, because in order for browsers to display MathML correctly, the page must have the proper declarations and other statements, and the file name must end with the proper extension (such as htm or xht). The AppNote referenced above discusses the required statements and declarations, and even makes a template available to use when authoring pages with MathML.

Using the "Export to MathPage" command in Word

"MathPage" is a feature introduced into MathType with version 5. In Word versions 2002 (Office XP), X, 2003, and 2004, MathPage is activated either via a toolbar icon (see below) or menu command in Word (MathType > Export to MathPage).


"Export to MathPage" icon on MathType's toolbar in Word

In Word 2007, you'll find the "Publish to MathPage" command in the Publish group of the MathType tab on Word's Ribbon:


Word 2007 Ribbon (click for larger image)

The Export to MathPage command will convert the Word document to a web page. The equations will be converted either to GIF images or to MathML, depending on the choice you make on the Export to MathPage dialog:

MathML "targets" in the MathPage dialog

The Export to MathPage dialog gives the user the option of three "MathML targets". The names of these three targets should help you decide when to use one instead of another, but the following explanations should help further.

  • XHTML+MathML. This is the target we recommend using most, if not all, of the time because it will allow you to author a web page as if the target browser were Firefox, and the page will be readable in the latest versions of all Gecko browsers (i.e., Netscape, Firefox, Mozilla, SeaMonkey, and Camino), as well as Internet Explorer 6.0 (or later) with MathPlayer 2 (or later) installed. There are certain lines of code that must be included in your document in order for this universality to be effected, but that's one of the beauties of using MathPage — this is all taken care of automatically for you by MathPage. Here is an example of a MathPage created with this target (opens in separate window or tab). When using this target, your MathPage will be the only file you need to upload to your server. In the screen shot above, this file is titled final-exam-practice.xht.
  • MathPlayer (IE behavior). This target is the one to use when you know your audience will be using Internet Explorer 6 or later, and MathPlayer 2 or later. A MathPage created with this target will not display properly in other browsers. Here is an example of a MathPage created with this target (opens in separate window or tab). Like the XHTML+MathML target, using the MathPlayer (IE behavior) target only requires you to upload one file to your server. In this case, it will have an htm extension, such as final-exam-practice.htm.
  • Multi-browser (UMSS). This target gives you the absolute greatest variety of target browsers within which people can view your page. "UMSS" stands for "Universal MathML Stylesheet", and you can read more about the UMSS at the W3C web site. This W3C page may be a bit out of date, but it still gives a rather complete description of the UMSS and how to use it. When using MathType to create a MathPage though, you don't really need a high degree of understanding of the UMSS. If you want to use it, all you need to do is select the proper target and upload the proper files (explained below). Here is an example of a MathPage created with this target (opens in separate window or tab). When using this target you need to upload both the web page and the stylesheet. MathPage saves the stylesheet for you in the same folder as your web page. For example in the screen shot example above, you'd upload final-exam-practice.xht and the stylesheet pmathml.xsl.

Limitations of MathType

Note that not all the characters available with MathType can be translated into MathML. For example, using the symbol "Does not equal to or precede" (), results in the following error dialog when translating to MathML:

Translation Error: Character not currently supported.

The current version of MathML is complete enough that this sort of translation error is rare, and should occur for you only occasionally, if at all.

MathType is an extremely powerful and robust authoring environment. However, there are certain minor caveats:

  • MathType does not offer a "complete" package on its own. MathType is able to author the MathML, but you need other software to "do something with it".
  • Even though MathType is a formula editor, it does not offer a WYSIWYG solution in the following sense: What You See In The Editor Is Not Necessarily What You Will See in the Web Browser. This is due to the differences in the way different products render the same expression. This can lead to a few surprises but, like the above error, this should be infrequent as well.
  • MathType does not support MathML Content markup, intended to add a lot "more" semantics to markup of mathematical objects than the Presentation markup.

Conclusion

MathML syntax is verbose and was never intended by its creators to be authored manually. MathType greatly simplifies the task of authoring MathML by letting you create the equation graphically, then export to MathML. With its multiple export facility and the incorporation of MathPage into Word, MathType supports the standard well.

References

- top of page -
Copyright © 1996-2009 Design Science. All rights reserved.   Contact us | Privacy statement