Amaya proposes a Wysiwyg interface where MathML mathematical expressions are handled as structured components, in the same way as (X)HTML elements. Therefore, you can manipulate math expressions in the same way you manipulate other parts of (X)HTML documents. All editing commands provided by Amaya for handling text are also available for math, but there are some additional controls for entering mathematical constructs. Note that the different browsers don't behave in the same way with MathML: see the browsers compatibility section for more informations.
Generally, mathematical formulae are not alone but included in a document with text, table, images... to do this, you have to create a XHTML document. Otherwise, you can create a MathML document (mml) for instance to use the formulae in other software tools. To do so, use command File / New / New formula or type Ctrl-n Ctrl-m.
To create a new mathematical expression in a document, move the insertion point to the position where you want to insert an expression, and then click the Math button (the first) from the Math palette, or choose Insert a formula from the Insert/Math submenu. Here are examples with a formula inserted directly in the XHTML document or inside an SVG image :
The Insert/Math submenu includes presentation MathML elements.
width
attribute. See spacing.alpha
for the Greek character α).Following entries of the Insert/Math submenu enable you to
create new constructs within a formula. If the insertion point is not in a
formula, Amaya first creates a math
element to accept the new
construct. The available constructs are:
mroot
in MathML:
msqrt
:
menclose
:
mfrac
:
msubsup
:
or msub
:
msup
:
munderover
:
munder
:
mover
:
mrow
:
mmultiscripts
:
You must then choose the number of lines and columns in the new table through a dialog that pops up. You can manipulate it like a HTML table through the commands available from the Tools/Edit table submenu.
Clicking on a button in the Math palette inserts the mathematical construct represented on its icon. Parts in black are really inserted, parts in red represent placeholder, parts in blue are asked through to a specific dialog. Green parts are simply additional information that are not inserted.
The palette contains all constructs described in Content MathML (but the produced code is an equivalent in Presentation MathML, see the known issues section) and even more. You can also save your own constructs in a mml file in order to use them latter. The 6 tabs are :
mrow
: used to group elements. See the section about
the row constructmphantom
: used to hide a piece of formula, can be
used for alignment. The hidden parts can be viewed if you select
the formula :
mtable
:
menclose
:
or You are not required to use the Math submenu or the Math palette to create and edit mathematical expressions. You can enter mathematical constructs directly from the keyboard because each entry of the Math submenu has a keyboard equivalent. These shortcuts are listed on the menu. See the list of current Linux, Mac OS X, and Windows shortcuts.
You can also use the keyboard arrow keys to move the insertion point from one math construct to another. The right and left arrows move the insertion point according to the structure of the mathematical expression. For example, in a fraction when the insertion point is at the end of a numerator, the right arrow key moves the insertion point to the beginning of the denominator. Moreover if you use the right arrow to a construct that is not already completed, the insertion point is directly moved to the nearest placeholder.
When you type a character string in a MathML element, Amaya parses the
string and automatically generates the elements mo
(operator),
mn
(number), mi
(identifier), and
mtext
.
For example, to enter the formula
Use the Structure or Source view to display the following structure generated by Amaya:
<mi>x</mi><mo>=</mo><mn>2</mn><mi>a</mi><mo>+</mo><mi>b</mi>
If the result is not exactly what you want, select the characters that were misinterpreted and change their type with one of the commands such as Plain text (mtext), Identifier (mi), Number (mn), Operator (mo) or Space (mspace).
The row
construct from the palette is the equivalent of the
braces in LaTeX: it allows you to give informations about how the different
part of a formula are grouped together. It does not appear on the screen but
have an indirect effect on the rendering.
For instance, when entering brackets as in the following expression:
typing the sequence f(x)= ...
would lead to:
Here, the (x)
must be contained in a mrow
element.
You can correct the problem by selecting this part of the formula and then
clicking on the row construct. You can also directly get the expected
mrow
if you choose Parentheses from the
Insert/Math submenu or select the button in the Math
palette.
Amaya takes care of spacing within math expressions, but in some cases you
may need to add some additional space. Move the cursor to the position where
you want to insert space and choose Space (mspace) from the
Insert/Math submenu. This creates a default horizontal space.
You can then change its width
attribute to adjust its size or you
can add other attributes (height
, depth
,
linebreak
) to change vertical spacing. Refer to the MathML
specification for more details.
You can use the Character command from the Insert/Math submenu to enter mathematical characters and symbols that are not available on the keyboard. Type in the name of the character, as defined in the MathML specification. You may choose to type the Unicode value of the character instead. For entering this value in decimal, start with a '#'. For entering the value in hexadecimal, start with '#x'. To type faster, you can also enter the hexadecimal value without any leading '#x', but note that this may be ambiguous (like 'af', for instance). In case of ambiguity, the string is interpreted as a character name.
You can also use the Special characters tool. In this tool, the pull-down menu allows you to choose a group of characters, which are then available in the table below. Click a character in this table to insert it in the formula or anywhere else in the document.
Also, the MathML specification recommends to add invisible characters in order to make it easier for a speech synthesizer to read a formula. These characters are automatically inserted from the palette, but sometimes you have to do it by yourself. You can then use the Insert/Math submenu or shortcuts. The three invisible characters are:
You may want to change the structure of an existing expression, such as appending a superscript, putting parentheses around an expression, or turning an expression into the numerator of a fraction. To do that, select the expression and enter the new construct with the Math palette, the Insert/Math submenu or the keyboard.
You can also use Transform from the Tools menu. Select the expression you want to transform and Transform will display a menu with all possible changes. For constructs that are not part of the Presentation MathML markup - i.e. only available from the palette - clicking on the button will put the selected expression in the most natural placeholder.
Changing an expression is useful to keep a recursive structure even when you enter a formula linearly. For instance to enter you can,
Generally, you will use both methods.
A MathML structure in a document can be viewed by choosing Show Structure from the Views menu. Choosing this option opens up the Structure view, which reveals the main structure of the document, the math elements, and their contents.
Math expressions can be edited in the main view or in the structure view.
The structure view is especially helpful to avoid ambiguity. For example, in the equation below, placing the cursor after character , it is not clear whether you wish to add something within the square root or after it.
Selecting (or checking) in the Structure view avoids any misselections. You can also check the status line at the bottom of the window.
You can create and use links in mathematical expressions. These links are represented using the XML Linking Language (XLink). Only simple unidirectional hyperlinks are available in Amaya, but you can associate a link with any part of a formula. For example, the fraction in the formula below is a link to the W3C home page:
Double-clicking or right-clicking any character within the fraction loads the W3C home page.
To create such a link, select a math expression (the fraction in the above example, for instance by clicking on the fraction bar), click the button from the Elements tool, or choose Create or change link from the Links menu, and click the desired target.
If the target is an expression in a formula, you must first turn the
expression into a target. Select the expression and choose Create
target from the Links menu to create an
id
attribute for the target expression.
Several browsers support MathML:
It is necessary to use the .xml
suffix to be sure that XHTML
documents are managed as XML. Without this suffix some browsers do not display
correctly documents that include mathematical expressions. It is also
recommended to use the utf-8 charset for all XML documents.
By default Amaya adds the XHTML 1.1 plus MathML 2.0 doctype at the beginning of the document. This doctype is not mandatory but it is useful:
Unfortunately, this doctype is not supported by many browsers. So it could be necessary to remove this doctype with the Amaya command: Tools/Change doctype/Remove the doctype.
IE uses the pmathml.xsl
transformation style sheet and a plugin
to display the MathML code included in XHTML documents. Amaya adds
automatically a link to that transformation style sheet, but the author must
store a copy of this style sheet (pmathml.xsl) in the local
directory of the document.
mglyph
,
maction
display, alttext,
mathvariant, mathsize, mathcolor, mathbackground, fontsize, fontweight,
fontstyle, fontfamily, color, linethickness, numalign, denomalign,
bevelled, notation, lquote, rquote, lspace, rspace, largeop, movablelimits,
subscriptshift, superscriptshift, form, width
(mspace only),
height
(mspace only), depth
(mspace only),
align, rowalign, columnalign, frame, framespacing, displaystyle,
side, rowspan, columnspan, rowspacing, columnspacing, rowlines,
columnlines
.class
, id
, and
style
attributes are available, with the same semantics as in
(X)HTML: you can associate CSS styles with MathML elements
(class
and style
attributes) and a MathML element
can be the target of a link (id
attribute).