(Excerpt from "The MathML Handbook" by Pavi Sandhu)
The W3C's Amaya browser includes native support for displaying MathML equations embedded in an HTML document, as discussed under MathML-enabled browsers: Amaya. Amaya includes limited support for creating and editing presentation MathML. Support for authoring content MathML is yet to be included, but it may be added in a future release. Amaya's authoring features are fairly rudimentary, and it is not an ideal authoring solution for somebody who wants to create a large number of complex technical documents. Its main virtue is that it is a free product and provides an integrated environment for authoring HTML documents containing MathML equations and SVG graphics.
There are two ways of authoring an equation in Amaya: using the menu commands listed in the Math submenu of the Types menu or using the Math palette, which is accessible from the toolbar. All the commands listed in the Math menu also have keyboard shortcuts, and these provide a much faster way of entering equations.
The Math menu
In Amaya, a document can be viewed in two modes: Editor mode, which allows you to edit the document, and Browser mode, which only permits viewing. You can switch between the two modes by clicking a button on the toolbar or by choosing the Editor Mode command under the Edit menu. When you first start Amaya and open a new document, by default the document is shown in Editor mode.
The commands for authoring MathML equations are located in the Types → Math submenu (see the following figure). Most commands in this submenu correspond to a specific presentation tag. There are also commands for entering the commonly used character references ⁢ and ⁡.
Figure: Authoring an equation in Amaya using the Types → Math menu.
To start entering an equation, you must first choose Math → New formula. This creates the top-level math element, where the text you type subsequently is placed. When you type any characters inside a math element, Amaya parses the characters and automatically places the text in mo, mi, mn, and mtext elements, based on the type of characters you enter. Hence, you can create an equation without having to explicitly specify whether you are entering an operator, identifier, number, or literal text.
For example, to enter the expression y = x2, follow these steps:
- From the Types menu, click Math → New formula.
- Type the character "y". Amaya automatically places this in an mi element.
- Type the character "=". Amaya automatically places this in an mo element.
- From the Types menu, click Math → Superscript. Amaya creates an msup element.
- Type "x". Amaya automatically places this in an mo element and interprets it as the base, or first argument, of the msup element.
- Type "2". Amaya automatically places this in an mn element and interprets it as the superscript, or second argument, of the msup element.
The status bar of the browser window displays the structure of the equation based on the current position of the cursor. If any of the elements created automatically by Amaya are not of the type you intended, you can explicitly change the element by selecting the text and then choosing the desired element (such as mtext, mi, mn, or mo) from the Types → Math menu. You can also monitor the nested structure of the elements by viewing your document in the Structures view. This view is displayed in a separate window when you choose Show structure from the Views menu.
Each command listed in the Math submenu also has a keyboard shortcut associated with it. Once you become familiar with the various key combinations, it is much faster to enter an equation by using the keyboard shortcuts. For example, you can type Ctrl-m Ctrl-6 to create a superscript.
The Maths palette
Amaya also provides a Maths palette (see the following figure) for creating equations by clicking buttons. You can access this palette by clicking the button marked on the toolbar.
The Maths palette contains buttons with templates for creating the common types of mathematical notation, such as square roots, fractions, radicals, subscripts, superscripts, limits, tables, and matrices. To start entering an equation, you first click the Math button in the top left corner of the palette. This creates a math element for enclosing the text you enter.
Figure: The Maths palette for entering equations in Amaya.
To enter a specific type of template, you can click any of the buttons and then enter text from the keyboard to fill the placeholders in the template.
To enter extended characters such as Greek letters and technical symbols, you can use the Types → Math → Character menu command (or press Ctrl+m Ctrl+e). This brings up a dialog in which you can enter the keyword for the special character; for example, omega or theta, to enter ω or θ. Alternatively, you can type the Unicode character code for the character in the dialog. For example, to insert the Greek letter α, you can type in either "alpha" or "x3B1" in the dialog and then click OK.
Another way to enter extended characters is by using the Maths palette. Clicking a button at the bottom right corner of the Maths palette brings up a Greek alphabet palette (see the following figure) that shows a collection of special characters. You can click any of the buttons in this palette to paste the corresponding character into the document.
Figure: The Greek alphabet palette for entering special characters.
Amaya's support for displaying extended characters is fairly limited. It does not have any special fonts for mathematical symbols apart from the standard ISO-Latin 1 and Adobe Symbol font. As a result, some values of the mathvariant attribute (script, double-struck and fraktur) cannot be rendered. Amaya displays any character for which the font is not available using a "?" character. However, when creating a document, you can enter extended characters as either numeric or named entity references. These entity references are preserved in the internal representation and can thus be used when you export a document created in Amaya to another application that has better support for fonts.
Linking MathML equations
Amaya supports linking in MathML equations using a draft version of the XML Linking Language (XLink). You can turn any MathML formula or a part of it into a hyperlink by specifying the target of the hyperlink as the value of the xlink:href attribute. For example, the following code defines a fraction that acts as a hyperlink to the W3C Math home page:
<math xmlns="http://www.w3.org/1998/Math/MathML"> <mfrac xmlns="http://www.w3.org/1999/xlink" xlink:href="http://www.w3.org/Math"> <mi>x</mi> <mi>y</mi> </mfrac> </math>
To convert an equation into a hyperlink, follow these steps:
- Select the equation or the part of the equation from which you wish to link.
- Click the Link button on the toolbar and choose Links → Create or change link from the menu.
- Enter the URL you wish to link to and click Confirm.
You can also turn an equation into the target of a link by selecting it, choosing Links → Create target, and then entering a keyword to identify the equation in the dialog. This automatically assigns the id attribute to the equation so it can be the target of another hyperlink.
|<< back||next >>|
Copyright © CHARLES RIVER MEDIA, INC., Massachusetts (USA) 2003
Printing of the online version is permitted exclusively for private use. Otherwise this chapter from the book "The MathML Handbook" is subject to the same provisions as those applicable for the hardcover edition: The work including all its components is protected by copyright. All rights reserved, including reproduction, translation, microfilming as well as storage and processing in electronic systems.
CHARLES RIVER MEDIA, INC., 20 Downer Avenue, Suite 3, Hingham, Massachusetts 02043, United States of America