The possibility to include mathematical expressions is really important for scientists. Some computer formats, such as LaTeX, already allows it for documents whose purpose is being visually rendered, especially printed. Nevertheless, including mathematical formulae in web pages is much more difficult. People generally use images generated from LaTeX sources: they get a longer loading time, a layout not adapted with the rounded text, a bad print quality... Moreover, Internet is supposed to be a universal way to share informations and a more powerful mathematical language than LaTeX is required in order to make the formulae understandable by speech synthesizers (for visually impaired), mathematical softwares, search engines...
For all these reasons, the W3C created the MathML (Mathematical Markup Language) and indicates that, because of its complexity, it should not be edited by hand. Consequently, Amaya proposes a Wysiwyg interface where mathematical expressions are handled as structured components, in the same way as HTML elements. Therefore, you can manipulate math expressions in the same way you manipulate other parts of HTML documents. All editing commands provided by Amaya for handling text are also available for math. In addition, there are some other 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 softwares.
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 New formula from the XML menu. Here are examples with a formula inserted directly in the XHTML document or inside a SVG image :
The XML/Basic math Elements menu contains elements which
are not available from the palette. The first items create new elements of a
given type in a mathematical expression : Plain text (mtext
),
Identifier (mi
), Number (mn
), Operator
(moĹ
). These commands can also change the type of a single
element or a sequence of elements.
The next command, Space (mspace
), allows you to add space in
a formula. To change its size, you have to modify its attribute. See .
The next item, Character (&xxx;
), enables you to enter a
character that is not available on the keyboard. It displays a dialog where
you have to enter the character name (for instance alpha
for the
Greek character α).
The two last commands InvisibleTimes and ApplyFunction are used to enter the corresponding invisible characters. See the Special Characters section.
The XML/Math Constructions menu enables 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
: mmultiscripts
: Finally, the XML/Matrices menu allows you to create and edit MathML tables:
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 XML/Matrices menu.
Clicking on a button in the Math palette inserts the mathematical construction represented on its icon. Parts in black are really inserted, parts in red represent placeholder, parts in blue are asked thanks to a dialog. Green parts are simply additional informations that are not inserted.
The palette contains all constructions 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 contructions 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 constructionmphantom
: 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 menus or the Math palette to create and edit mathematical expressions. You can enter mathematical constructs directly from the keyboard because each item in the Math menus 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 enter greek letters with the following shortcuts : (Ctrl) g (Ctrl) [letter] and (Ctrl + Shift) G (Ctrl + Shift) [letter].
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 in a not already completed construction, 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
x=2a+b
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
)
from the Basic math elements submenu of the
XML menu.
The row construction 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 construction. You can also directly get the expected
mrow
if you choose Math Constructs/Parentheses
from the XML menu or select the Parentheses button on the
Maths 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 Basic math elements/Space (mspace) from the XML menu. 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 XML/Basic math Elements menu 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 palette. The first two rows of buttons allow you to choose a group of characters, which are then available in the pull down below. Choose a character in the list and insert it in the formula by clicking the insertion button
Also, the MathML specification says to add invisible characters in order to make easier the reading of formula by speech synthesizers. They are automatically inserted in constructions from the palette but sometimes you have to do it by yourself. You can use the XML menu 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 palette, the XML/Math Constructs menu or the keyboard. You can also use Transform on the Edit 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 move the selected expression in the more natural placeholder.
Changing an expression structure 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.
MathML structure in a document can be viewed by choosing Show Structure from the Views menu. Choosing this option opens 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 main 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 Link button from the XHTML palette (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.
Firefox or other Gecko-based browsers support MathML wheras Internet Explorer needs a plugin.
It is necessary to use the .xml
suffix to make sure that
XHTML document are managed as an XML format. Without this suffix some
browsers don't display included mathematical expressions correctly.
It's 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: File>Change the Document Type>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
think to 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 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).