-
MathType
-
Wiris Quizzes
-
Learning Lemur
-
CalcMe
-
MathPlayer
-
Store FAQ
-
VPAT for the electronic documentation
-
MathFlow
-
BF FAQ
Automatic and manual linebreaks
Reading time: 8minIn MathML 3, there is control for both manual and automatic linebreaking. For legacy reasons, manual linebreaks can be placed on mspace
, but the focus of MathML 3 is line breaks that happen "at" an operator (mo
). Of course, the linebreaks don't split an operator, they actually occur before the operator (so that the operator appears at the start of the next line) or after the operator (so that the operator appears at end of the current line). MathML even supports a style of linebreaking where the operator is placed at both the end of the current line and the beginning of the next line.
Control over manual linebreaks is done via the linebreak
attribute. Although this value can be inherited, it typically would only be set on an operator to either force or prevent a linebreak at that operator. In contrast, the other linebreaking attributes (lineleading
, linebreakstyle
, and linebreakmultchar
would often be inherited and affect both manual and automatic linebreaks.
Changing the linebreakstyle
is demonstrated in the following two examples:
linebreakstyle value
before | after |
![]() |
![]() |
The MathML for these examples is shown below. There are three things to note in the MathML:
- The width for linebreaking is set on the
math
element - The character to use (
×
) if an "invisible times" is the breakpoint set on themath
element. - The line breaking style is set on the
math
element and inherited.
<div><tt><math xmlns='http://www.w3.org/1998/Math/MathML'<br></br> maxwidth='200px' linebreakmultchar='×' linebreakstyle='before'><br></br> <mrow><br></br> <mrow><br></br> <mo>(</mo><br></br> <mrow><br></br> <msup> <mi>x</mi> <mn>4</mn> </msup><br></br> <mo>-</mo><br></br> <mrow><br></br> <mn>4</mn><br></br> <mo>⁢</mo><br></br> <msup> <mi>x</mi> <mn>3</mn> </msup><br></br> <mo>⁢</mo><br></br> <mi>y</mi><br></br> </mrow><br></br> <mo>+</mo><br></br> <mrow><br></br> <mn>6</mn><br></br> <mo>⁢</mo><br></br> <msup> <mi>x</mi> <mn>2</mn> </msup><br></br> <mo>⁢</mo><br></br> <msup> <mi>y</mi> <mn>2</mn> </msup><br></br> </mrow><br></br> <mo>-</mo><br></br> <mrow><br></br> <mn>4</mn><br></br> <mo>⁢</mo><br></br> <mi>x</mi><br></br> <mo>⁢</mo><br></br> <msup> <mi>y</mi> <mn>3</mn> </msup><br></br> </mrow><br></br> <mo>+</mo><br></br> <msup> <mi>y</mi> <mn>4</mn> </msup><br></br> </mrow><br></br> <mo>)</mo><br></br> </mrow><br></br> <mo>⁢</mo><br></br> <mrow><br></br> <mo>(</mo><br></br> <mrow><br></br> <msup> <mi>x</mi> <mn>4</mn> </msup><br></br> <mo>+</mo><br></br> <mrow><br></br> <mn>4</mn><br></br> <mo>⁢</mo><br></br> <msup> <mi>x</mi> <mn>3</mn> </msup><br></br> <mo>⁢</mo><br></br> <mi>y</mi><br></br> </mrow><br></br> <mo>+</mo><br></br> <mrow><br></br> <mn>6</mn><br></br> <mo>⁢</mo><br></br> <msup> <mi>x</mi> <mn>2</mn> </msup><br></br> <mo>⁢</mo><br></br> <msup> <mi>y</mi> <mn>2</mn> </msup><br></br> </mrow><br></br> <mo>+</mo><br></br> <mrow><br></br> <mn>4</mn><br></br> <mo>⁢</mo><br></br> <mi>x</mi><br></br> <mo>⁢</mo><br></br> <msup> <mi>y</mi> <mn>3</mn> </msup><br></br> </mrow><br></br> <mo>+</mo><br></br> <msup> <mi>y</mi> <mn>4</mn> </msup><br></br> </mrow><br></br> <mo>)</mo><br></br> </mrow><br></br> </mrow><br></br></math></tt></div>
The second example differs from the first only in the value of linebreakstyle
. The difference is shown below:
<div><tt><math xmlns='http://www.w3.org/1998/Math/MathML'<br></br> maxwidth='200px' linebreakmultchar='×' linebreakstyle=<span>'after'</span>><br></br> …<br></br></math></tt></div>
The linebreaking in the above examples was done automatically by the renderer (for the images above, that is MathPlayer). Different renderers might break the expression differently. You can control the line breaks manually. For example, suppose you want to break the sums in the middle and avoid a linebreak at the multiplication, you do that by setting explicit linebreaks as shown below (the changes to make that happen are highlighted):
<div><tt><math xmlns='http://www.w3.org/1998/Math/MathML'<br></br> maxwidth='200px' linebreakmultchar='×' linebreakstyle='before'><br></br> <mrow><br></br> <mrow><br></br> <mo>(</mo><br></br> <mrow><br></br> <msup> <mi>x</mi> <mn>4</mn> </msup><br></br> <mo>-</mo><br></br> <mrow><br></br> <mn>4</mn><br></br> <mo>⁢</mo><br></br> <msup> <mi>x</mi> <mn>3</mn> </msup><br></br> <mo>⁢</mo><br></br> <mi>y</mi><br></br> </mrow><br></br> <mo>+</mo><br></br> <mrow><br></br> <mn>6</mn><br></br> <mo>⁢</mo><br></br> <msup> <mi>x</mi> <mn>2</mn> </msup><br></br> <mo>⁢</mo><br></br> <msup> <mi>y</mi> <mn>2</mn> </msup><br></br> </mrow><br></br> <mo<span>linebreak='newline'</span>>-</mo><br></br> <mrow><br></br> <mn>4</mn><br></br> <mo>⁢</mo><br></br> <mi>x</mi><br></br> <mo>⁢</mo><br></br> <msup> <mi>y</mi> <mn>3</mn> </msup><br></br> </mrow><br></br> <mo>+</mo><br></br> <msup> <mi>y</mi> <mn>4</mn> </msup><br></br> </mrow><br></br> <mo>)</mo><br></br> </mrow><br></br> <mo<span>linebreak='newline'</span>>⁢</mo><br></br> <mrow><br></br> <mo>(</mo><br></br> <mrow><br></br> <msup> <mi>x</mi> <mn>4</mn> </msup><br></br> <mo>+</mo><br></br> <mrow><br></br> <mn>4</mn><br></br> <mo>⁢</mo><br></br> <msup> <mi>x</mi> <mn>3</mn> </msup><br></br> <mo>⁢</mo><br></br> <mi>y</mi><br></br> </mrow><br></br> <mo<span>linebreak='newline'</span>>+</mo><br></br> <mrow><br></br> <mn>6</mn><br></br> <mo>⁢</mo><br></br> <msup> <mi>x</mi> <mn>2</mn> </msup><br></br> <mo>⁢</mo><br></br> <msup> <mi>y</mi> <mn>2</mn> </msup><br></br> </mrow><br></br> <mo>+</mo><br></br> <mrow><br></br> <mn>4</mn><br></br> <mo>⁢</mo><br></br> <mi>x</mi><br></br> <mo>⁢</mo><br></br> <msup> <mi>y</mi> <mn>3</mn> </msup><br></br> </mrow><br></br> <mo>+</mo><br></br> <msup> <mi>y</mi> <mn>4</mn> </msup><br></br> </mrow><br></br> <mo>)</mo><br></br> </mrow><br></br> </mrow><br></br></math></tt></div>