(Excerpt from "The MathML Handbook" by Pavi Sandhu)
The mfrac element is used to represent fractions and has the following syntax:
<mfrac> numerator denominator </mfrac>
The mfrac element has four attributes: linethickness, bevelled, numalign, and denomalign.
The linethickness attribute specifies the thickness of the line that separates the numerator and denominator. The default setting of 1 causes the line to be drawn in the standard thickness of lines for the font style being used. A setting of 0 causes the line to be invisible and can be used to represent binomial coefficients, as shown here:
When the bevelled attribute is set to false, the numerator is shown above the denominator with a horizontal line between them. When it’s set to true, a slightly raised numerator is shown to the left of a slightly lowered denominator with a diagonal line between them, as shown in the following example:
<mrow> <mfrac bevelled="true"> <mn>1</mn> <mrow> <mi>x</mi> <mo>+</mo> <mi>y</mi> </mrow> </mfrac> </mrow>
The attributes numalign and denomalign specify the horizontal alignment of the numerator and denominator, respectively. They can take values left, right, and center. The default is to be centered, but it may be more appropriate for a very long numerator or denominator that stretches along multiple line to be aligned at left.
In the following example, you can left-align the numerator with the denominator by setting the value of numalign="left":
<mfrac numalign="left"> <mrow> <mi>a</mi><mo>+</mo><mi>b</mi> </mrow> <mrow> <mi>a</mi><mo>+</mo><mi>b</mi><mo>+</mo><mi>c</mi> </mrow> </mfrac>
It is conventional for the numerator and denominator to appear in a smaller font when a fraction is displayed as an inline expression; that is, surrounded by text. To satisfy this convention, the mfrac element automatically changes the value of two attributes of the mstyle element: displaystyle and scriptlevel, which are normally inherited from the environment. The mfrac element sets displaystyle to false, or if it was already set to false, it increments scriptlevel by 1, within numerator and denominator. For more details about the displaystyle and scriptlevel attributes, see the description of the mstyle element under Applying styles later in this section.
|<< 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