MathML – Fractions


MathML – Fractions


”;


<mfrac> tag is used to draw fractions.

Syntax

Here is the simple syntax to use this tag −

<mfrac> numerator denominator </mfrac>

Parameters

Here is the description of all the parameters of this tag −

  • numerator − numerator of the fraction.

  • denominator − denominator of the fraction.

Attributes

Here is the description of all the attributes of this tag −

  • linethickness − to specify the stroke width of the fraction bar. values are measured in px, pt, em etc.

  • numalign − to specify alignment of numerator. values are left, right or center.

  • denomalign − to specify alignment of denominator. values are left, right or center.

  • bevelled − to specify whether the fraction should be displayed vertically or inline. values are true or false.

Example

Let”s draw a simple fraction for 1/x.

<math xmlns = "http://www.w3.org/1998/Math/MathML">
   <mfrac>
      <mn>1</mn>
      <mi>x</mi>
   </mfrac>
</math>

Output

1 x

Let”s build a complex fraction.

<math xmlns = "http://www.w3.org/1998/Math/MathML">
   <mfrac linethickness = ''3px''>
      <mfrac bevelled = ''true''>
         <mn>1</mn>
         <mi>x</mi>
      </mfrac>
      
      <mrow>
         <mi>y</mi>
         <mo>-</mo>
         <mn>2</mn>
      </mrow>
   </mfrac>
</math>

Output

1 x y 2

Advertisements

”;

Leave a Reply

Your email address will not be published. Required fields are marked *