English 中文(简体)
MathML - Fractions
  • 时间:2024-12-22

MathML - Fractions


Previous Page Next Page  

<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 −

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

    numapgn − to specify apgnment of numerator. values are left, right or center.

    denomapgn − to specify apgnment of denominator. values are left, right or center.

    bevelled − to specify whether the fraction should be displayed vertically or inpne. 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 pnethickness =  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