MathML - Long Division


<mlongdiv> tag is used to draw long divisions.


Here is the simple syntax to use this tag −

<mlongdiv> divisor dividend result expression </mlongdiv>


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

  • divisor − divisor of the long division.

  • dividend − dividend of the long division.

  • result − result of the long division.

  • expression − mstack element or children of mstack.


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

  • longdivstyle − to control the style of the long division layout. Valid values are lefttop, stackedrightright, mediumstackedrightright, shortstackedrightright, righttop, left/\right, left)(right, :right=right, stackedleftleft, stackedleftlinetop. Default is lefttop.


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

Live Demo
<math xmlns = "">
   <mlongdiv longdivstyle = "lefttop">
      <mn> 3 </mn>
      <mn> 435.3</mn>
      <mn> 1306</mn>
      <msgroup position = "2" shift = "-1">
            <mn> 12</mn>
            <msline length = "2"/>
            <mn> 10</mn>
            <mn> 9</mn>
            <msline length = "2"/>
            <mn> 16</mn>
            <mn> 15</mn>
            <msline length = "2"/>
            <mn> 1.0</mn>           
         <msgroup position='-1'>   
            <mn> 9</mn>
            <msline length = "3"/>
            <mn> 1</mn>


3 435.3 1306 12 10 9 16 15 1.0 9 1