Documentation

  • Demos
  • Visit our website
  • Contact us
  • MathType

    • Wiris Quizzes

      • Learning Lemur

        • CalcMe

          • MathPlayer

            • Store FAQ

              • VPAT for the electronic documentation

                • MathFlow

                  • BF FAQ

                    • Miscellaneous

                      • Home
                      • MathPlayer
                      • MathML 3 linebreaking and indentation examples
                      • MathML 3 linebreaking and indentation examples

                      Controlling indentation

                      Reading time: 4min

                      In the above examples, the indentation is still done automatically. If we want the indentation to be at the first term so that all of the operators align regardless of whether we have automatic or manual line breaks, we can do so by adding an id attribute value to the first operator that we want all subsequent lines to align to, and then setting indentalign to be id and the indenttarget to be that id as follows:

                      <div><tt><math xmlns='http://www.w3.org/1998/Math/MathML'<br></br>      maxwidth='200px' linebreakmultchar='×' linebreakstyle='before'<br></br>      <span>indentalign='id' indenttarget='firstOperator'</span>><br></br>  <mrow><br></br>    <mrow><br></br>      <mo>(</mo><br></br>      <mrow><br></br>        <msup><br></br>          <mi>x</mi><br></br>          <mn>4</mn><br></br>        </msup><br></br>        <mo<span>id='firstOperator'</span>>-</mo><br></br>        …<br></br></math></tt></div>

                      This gives the following result:

                      It is often sufficient to inherit the indentation target, but not where there are multiple indentation levels; in those cases, it is necessary to either wrap a mstyle around the other parts or explicitly set the indentation target on potential break points. The later technique is a good one when a linebreak is forced. Here's an example where we align both the equals sign and the left parentheses:

                      <math xmlns='http://www.w3.org/1998/Math/MathML'
                            maxwidth='300px' linebreakmultchar='×' linebreakstyle='before'>
                       <mrow>
                        <msup>
                         <mrow>
                          <mo>(</mo>
                          <mrow>
                           <msup> <mi>x</mi> <mn>2</mn> </msup>
                           <mo>-</mo>
                           <msup> <mi>y</mi> <mn>2</mn> </msup>
                          </mrow>
                          <mo>)</mo>
                         </mrow>
                         <mn>4</mn>
                        </msup>
                        <mo id='equals'>=</mo>
                        <mrow>
                         <msup>
                          <mrow>
                           <mo>(</mo> <mrow> <mi>x</mi> <mo>-</mo> <mi>y</mi> </mrow> <mo>)</mo>
                          </mrow>
                          <mn>4</mn>
                         </msup>
                         <mo>&#x2062;</mo>
                         <msup>
                          <mrow>
                           <mo>(</mo> <mrow>  <mi>x</mi> <mo>+</mo> <mi>y</mi> </mrow> <mo>)</mo>
                          </mrow>
                          <mn>4</mn>
                         </msup>
                        </mrow>
                        <mo linebreak='newline' indentalign='id' indenttarget='equals'>=</mo>
                        <mrow>
                         <mrow>
                          <mo id='lparen'>(</mo>
                          <mrow>
                           <msup> <mi>x</mi> <mn>4</mn> </msup>
                           <mo>-</mo>
                           <mrow>
                            <mn>4</mn>
                            <mo>&#x2062;</mo>
                            <msup> <mi>x</mi> <mn>3</mn> </msup>
                            <mo>&#x2062;</mo>
                            <mi>y</mi>
                           </mrow>
                           <mo>+</mo>
                           <mrow>
                            <mn>6</mn>
                            <mo>&#x2062;</mo>
                            <msup> <mi>x</mi> <mn>2</mn> </msup>
                            <mo>&#x2062;</mo>
                            <msup> <mi>y</mi> <mn>2</mn> </msup>
                           </mrow>
                           <mo>-</mo>
                           <mrow>
                            <mn>4</mn>
                            <mo>&#x2062;</mo>
                            <mi>x</mi>
                            <mo>&#x2062;</mo>
                            <msup> <mi>y</mi> <mn>3</mn> </msup>
                           </mrow>
                           <mo>+</mo>
                           <msup> <mi>y</mi> <mn>4</mn> </msup>
                          </mrow>
                          <mo>)</mo>
                         </mrow>
                         <mo linebreak='newline' indentalign='id' indenttarget='lparen' linebreakstyle='after'>&#x2062;</mo>
                         <mrow>
                          <mo>(</mo>
                          <mrow>
                           <msup> <mi>x</mi> <mn>4</mn> </msup>
                           <mo>+</mo>
                           <mrow>
                            <mn>4</mn>
                            <mo>&#x2062;</mo>
                            <msup> <mi>x</mi>  <mn>3</mn> </msup>
                            <mo>&#x2062;</mo>
                            <mi>y</mi>
                           </mrow>
                           <mo>+</mo>
                           <mrow>
                            <mn>6</mn>
                            <mo>&#x2062;</mo>
                            <msup> <mi>x</mi> <mn>2</mn> </msup>
                            <mo>&#x2062;</mo>
                            <msup> <mi>y</mi> <mn>2</mn> </msup>
                           </mrow>
                           <mo>+</mo>
                           <mrow>
                            <mn>4</mn>
                            <mo>&#x2062;</mo>
                            <mi>x</mi>
                            <mo>&#x2062;</mo>
                            <msup> <mi>y</mi> <mn>3</mn> </msup>
                           </mrow>
                           <mo>+</mo>
                           <msup> <mi>y</mi> <mn>4</mn> </msup>
                          </mrow>
                          <mo>)</mo>
                         </mrow>
                        </mrow>
                       </mrow>
                      </math>

                      Was this article helpful?

                      Yes
                      No
                      Give feedback about this article

                      Related Articles

                      • Linebreaking and indentation
                      • Verbosity
                      • Examples
                      • Automatic and manual linebreaks

                      Making people’s STEM work more meaningful

                      MathType

                      • MathType for Office Tools
                      • MathType for Mac
                      • MathType for Microsoft 365
                      • MathType for Google Workspace
                      • MathType for LMS
                      • MathType for XML Editors
                      • Arabic notation
                      • Our products accessibility
                      • MathType is online

                      WirisQuizzes

                      Learning Lemur

                      Solutions for Education

                      • Blackboard Learn
                      • Brightspace by D2L
                      • Canvas
                      • Google Classroom
                      • Moodle
                      • Schoology

                      Solutions for Publishing Houses

                      Solutions for Technical Writers

                      Solutions for Chemistry

                      Integrations

                      • HTML Editors
                      • MathType in WordPress

                      Pricing

                      Company

                      Careers

                      Blog

                      Contact Us

                      Buy Now

                      Plugin Downloads

                      © Wiris 2025

                      • Cookie Settings
                      • Cookie Policy
                      • Terms of Use
                      • Privacy Policy / GDPR
                      • Student Data Privacy
                      • Compliance
                      • Powered by Helpjuice
                      Expand