# Linebreaking

Note: You can resize your browser window to test line breaking at different position.

For mathematical formulas intended to be displayed on the Web, manual line breaking is not enough to ensure compatibility with the various screen resolutions of mobile, laptop or desktop computers. Contrary to static images, the new MathML mode opens the possibility for Web rendering engines to automatically break mathematical expressions in a clever way. Unfortunately, none of the existing MathML rendering engines implements a line breaking algorithm that is compatible with the CSS line breaking. Hopefully, this test page will help developers to improve the situation.

This paragraph contains a very long display expressions where we typically expect the break to happen at operators.

${\displaystyle \sum _{i=1}^{n}i=1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+21+22+23+24+25+26+27+28+29+30+31+32+33+34+35+36+37+38+39+40+41+42+43+44+45+46+47+48+49+50+51+52+53+54+55+56+57+58+59+60+61+62+63+64+65+66+67+68+69+70+71+72+73+74+75+76+77+78+79+80+81+82+83+84+85+86+87+88+89+90+91+92+93+94+95+96+97+98+99+100={\frac {100\times 101}{2}}=5050}$

This paragraph contains several inline expressions like ${\displaystyle a+b+c+d}$, ${\displaystyle 1+{\frac {p}{q}}-{\sqrt {3}}}$ or ${\displaystyle {\frac {\pi }{2}}}$-periodic. Browsers generally have good line breaking for normal words but they should improve their support for mathematical line breaking. On the one hand, when we arrive at the end of a line of text, it should be possible to break a formula at operator position and to continue the formula on the next line. On the other hand, breaking a line between ${\displaystyle a+b+c+d}$ and the comma or between ${\displaystyle {\frac {\pi }{2}}}$ and the "-periodic" suffix does not seem good compared to what happens with normal words.

Finally, it is also very common to have table of formulas. Line breaking inside table cells is a bit more complicated but browsers are able to do it with normal text and could theory do the same for MathML too:

Rule Example
The sum of the ${\displaystyle N}$ first integers is ${\displaystyle {\frac {N{(N+1)}}{2}}}$ ${\displaystyle 1+2+3+4+5+6+7+8+9+10={\frac {10\times 11}{2}}=55}$
The sum of the squares of the ${\displaystyle N}$ first integers is ${\displaystyle {\frac {N{(N+1)}{(2N+1)}}{6}}}$ ${\displaystyle 1^{2}+2^{2}+3^{2}+4^{2}+5^{2}+6^{2}+7^{2}+8^{2}+9^{2}+10^{2}={\frac {10\times 11\times 21}{6}}=385}$

Below is a larger example taken from the Fourier transform article, with the manual line breaks removed.

Function Fourier transform unitary, ordinary frequency Fourier transform unitary, angular frequency Fourier transform non-unitary, angular frequency Remarks
${\displaystyle \displaystyle f(x)}$ ${\displaystyle \displaystyle {\hat {f}}(\xi )=\displaystyle \int _{-\infty }^{\infty }f(x)e^{-2\pi ix\xi }\,dx}$ ${\displaystyle \displaystyle {\hat {f}}(\omega )=\displaystyle {\frac {1}{\sqrt {2\pi }}}\int _{-\infty }^{\infty }f(x)e^{-i\omega x}\,dx}$ ${\displaystyle \displaystyle {\hat {f}}(\nu )=\displaystyle \int _{-\infty }^{\infty }f(x)e^{-i\nu x}\,dx}$
301 ${\displaystyle \displaystyle 1}$ ${\displaystyle \displaystyle \delta (\xi )}$ ${\displaystyle \displaystyle {\sqrt {2\pi }}\cdot \delta (\omega )}$ ${\displaystyle \displaystyle 2\pi \delta (\nu )}$ The distribution ${\displaystyle \delta (\xi )}$ denotes the Dirac delta function.
302 ${\displaystyle \displaystyle \delta (x)\,}$ ${\displaystyle \displaystyle 1}$ ${\displaystyle \displaystyle {\frac {1}{\sqrt {2\pi }}}\,}$ ${\displaystyle \displaystyle 1}$ Dual of rule 301.
303 ${\displaystyle \displaystyle e^{iax}}$ ${\displaystyle \displaystyle \delta \left(\xi -{\frac {a}{2\pi }}\right)}$ ${\displaystyle \displaystyle {\sqrt {2\pi }}\cdot \delta (\omega -a)}$ ${\displaystyle \displaystyle 2\pi \delta (\nu -a)}$ This follows from 103 and 301.
304 ${\displaystyle \displaystyle \cos(ax)}$ ${\displaystyle \displaystyle {\frac {\displaystyle \delta \left(\xi -{\frac {a}{2\pi }}\right)+\delta \left(\xi +{\frac {a}{2\pi }}\right)}{2}}}$ ${\displaystyle \displaystyle {\sqrt {2\pi }}\cdot {\frac {\delta (\omega -a)+\delta (\omega +a)}{2}}\,}$ ${\displaystyle \displaystyle \pi \left(\delta (\nu -a)+\delta (\nu +a)\right)}$ This follows from rules 101 and 303 using Euler's formula: ${\displaystyle \textstyle \cos(ax)=(e^{iax}+e^{-iax})/2.}$
305 ${\displaystyle \displaystyle \sin(ax)}$ ${\displaystyle \displaystyle {\frac {\displaystyle \delta \left(\xi -{\frac {a}{2\pi }}\right)-\delta \left(\xi +{\frac {a}{2\pi }}\right)}{2i}}}$ ${\displaystyle \displaystyle {\sqrt {2\pi }}\cdot {\frac {\delta (\omega -a)-\delta (\omega +a)}{2i}}}$ ${\displaystyle \displaystyle -i\pi \left(\delta (\nu -a)-\delta (\nu +a)\right)}$ This follows from 101 and 303 using ${\displaystyle \textstyle \sin(ax)=(e^{iax}-e^{-iax})/(2i).}$
306 ${\displaystyle \displaystyle \cos(ax^{2})}$ ${\displaystyle \displaystyle {\sqrt {\frac {\pi }{a}}}\cos \left({\frac {\pi ^{2}\xi ^{2}}{a}}-{\frac {\pi }{4}}\right)}$ ${\displaystyle \displaystyle {\frac {1}{\sqrt {2a}}}\cos \left({\frac {\omega ^{2}}{4a}}-{\frac {\pi }{4}}\right)}$ ${\displaystyle \displaystyle {\sqrt {\frac {\pi }{a}}}\cos \left({\frac {\nu ^{2}}{4a}}-{\frac {\pi }{4}}\right)}$
307 ${\displaystyle \displaystyle \sin(ax^{2})\,}$ ${\displaystyle \displaystyle -{\sqrt {\frac {\pi }{a}}}\sin \left({\frac {\pi ^{2}\xi ^{2}}{a}}-{\frac {\pi }{4}}\right)}$ ${\displaystyle \displaystyle {\frac {-1}{\sqrt {2a}}}\sin \left({\frac {\omega ^{2}}{4a}}-{\frac {\pi }{4}}\right)}$ ${\displaystyle \displaystyle -{\sqrt {\frac {\pi }{a}}}\sin \left({\frac {\nu ^{2}}{4a}}-{\frac {\pi }{4}}\right)}$
308 ${\displaystyle \displaystyle x^{n}\,}$ ${\displaystyle \displaystyle \left({\frac {i}{2\pi }}\right)^{n}\delta ^{(n)}(\xi )\,}$ ${\displaystyle \displaystyle i^{n}{\sqrt {2\pi }}\delta ^{(n)}(\omega )\,}$ ${\displaystyle \displaystyle 2\pi i^{n}\delta ^{(n)}(\nu )\,}$ Here, ${\displaystyle n}$ is a natural number and ${\displaystyle \textstyle \delta ^{(n)}(\xi )}$ is the ${\displaystyle n}$-th distribution derivative of the Dirac delta function. This rule follows from rules 107 and 301. Combining this rule with 101, we can transform all polynomials.
309 ${\displaystyle \displaystyle {\frac {1}{x}}}$ ${\displaystyle \displaystyle -i\pi \operatorname {sgn}(\xi )}$ ${\displaystyle \displaystyle -i{\sqrt {\frac {\pi }{2}}}\operatorname {sgn}(\omega )}$ ${\displaystyle \displaystyle -i\pi \operatorname {sgn}(\nu )}$ Here ${\displaystyle \mathop {sgn} (\xi )}$ is the sign function. Note that ${\displaystyle 1/x}$ is not a distribution. It is necessary to use the Cauchy principal value when testing against Schwartz functions. This rule is useful in studying the Hilbert transform.
310 ${\displaystyle \displaystyle {\frac {1}{x^{n}}}:=\displaystyle {\frac {(-1)^{n-1}}{(n-1)!}}{\frac {d^{n}}{dx^{n}}}\log |x|}$ ${\displaystyle \displaystyle -i\pi {\frac {(-2\pi i\xi )^{n-1}}{(n-1)!}}\operatorname {sgn} (\xi )}$ ${\displaystyle \displaystyle -i{\sqrt {\frac {\pi }{2}}}\cdot {\frac {(-i\omega )^{n-1}}{(n-1)!}}\operatorname {sgn}(\omega )}$ ${\displaystyle \displaystyle -i\pi {\frac {(-i\nu )^{n-1}}{(n-1)!}}\operatorname {sgn}(\nu )}$ ${\displaystyle 1/x^{n}}$ is the homogeneous distribution defined by the distributional derivative ${\displaystyle \textstyle {\frac {(-1)^{n-1}}{(n-1)!}}{\frac {d^{n}}{dx^{n}}}\log |x|}$
311 ${\displaystyle \displaystyle |x|^{\alpha }\,}$ ${\displaystyle \displaystyle -2{\frac {\sin(\pi \alpha /2)\Gamma (\alpha +1)}{|2\pi \xi |^{\alpha +1}}}}$ ${\displaystyle \displaystyle {\frac {-2}{\sqrt {2\pi }}}{\frac {\sin(\pi \alpha /2)\Gamma (\alpha +1)}{|\omega |^{\alpha +1}}}}$ ${\displaystyle \displaystyle -2{\frac {\sin(\pi \alpha /2)\Gamma (\alpha +1)}{|\nu |^{\alpha +1}}}}$ This formula is valid for ${\displaystyle 0>\alpha >-1}$. For ${\displaystyle \alpha >0}$ some singular terms arise at the origin that can be found by differentiating 318. If Re α > −1, then ${\displaystyle |x|^{\alpha }}$ is a locally integrable function, and so a tempered distribution. The function ${\displaystyle \textstyle \alpha \mapsto |x|^{\alpha }}$ is a holomorphic function from the right half-plane to the space of tempered distributions. It admits a unique meromorphic extension to a tempered distribution, also denoted ${\displaystyle |x|^{\alpha }}$ for ${\displaystyle \alpha \neq -2,-4,...}$ (See homogeneous distribution.)
${\displaystyle {\frac {1}{\sqrt {|x|}}}\,}$ ${\displaystyle {\frac {1}{\sqrt {|\xi |}}}}$ ${\displaystyle {\frac {1}{\sqrt {|\omega |}}}}$ ${\displaystyle {\frac {\sqrt {2\pi }}{\sqrt {|\nu |}}}}$ Special case of 311.
312 ${\displaystyle \displaystyle \operatorname {sgn}(x)}$ ${\displaystyle \displaystyle {\frac {1}{i\pi \xi }}}$ ${\displaystyle \displaystyle {\sqrt {\frac {2}{\pi }}}{\frac {1}{i\omega }}}$ ${\displaystyle \displaystyle {\frac {2}{i\nu }}}$ The dual of rule 309. This time the Fourier transforms need to be considered as Cauchy principal value.
313 ${\displaystyle \displaystyle u(x)}$ ${\displaystyle \displaystyle {\frac {1}{2}}\left({\frac {1}{i\pi \xi }}+\delta (\xi )\right)}$ ${\displaystyle \displaystyle {\sqrt {\frac {\pi }{2}}}\left({\frac {1}{i\pi \omega }}+\delta (\omega )\right)}$ ${\displaystyle \displaystyle \pi \left({\frac {1}{i\pi \nu }}+\delta (\nu )\right)}$ The function ${\displaystyle u(x)}$ is the Heaviside unit step function; this follows from rules 101, 301, and 312.
314 ${\displaystyle \displaystyle \sum _{n=-\infty }^{\infty }\delta (x-nT)}$ ${\displaystyle \displaystyle {\frac {1}{T}}\sum _{k=-\infty }^{\infty }\delta \left(\xi -{\frac {k}{T}}\right)}$ ${\displaystyle \displaystyle {\frac {\sqrt {2\pi }}{T}}\sum _{k=-\infty }^{\infty }\delta \left(\omega -{\frac {2\pi k}{T}}\right)}$ ${\displaystyle \displaystyle {\frac {2\pi }{T}}\sum _{k=-\infty }^{\infty }\delta \left(\nu -{\frac {2\pi k}{T}}\right)}$ This function is known as the Dirac comb function. This result can be derived from 302 and 102, together with the fact that ${\displaystyle \sum _{n=-\infty }^{\infty }e^{inx}=2\pi \sum _{k=-\infty }^{\infty }\delta (x+2\pi k)}$ as distributions.
315 ${\displaystyle \displaystyle J_{0}(x)}$ ${\displaystyle \displaystyle {\frac {2\,\operatorname {rect} (\pi \xi )}{\sqrt {1-4\pi ^{2}\xi ^{2}}}}}$ ${\displaystyle \displaystyle {\sqrt {\frac {2}{\pi }}}\cdot {\frac {\operatorname {rect} \left(\displaystyle {\frac {\omega }{2}}\right)}{\sqrt {1-\omega ^{2}}}}}$ ${\displaystyle \displaystyle {\frac {2\,\operatorname {rect} \left(\displaystyle {\frac {\nu }{2}}\right)}{\sqrt {1-\nu ^{2}}}}}$ The function ${\displaystyle J_{0}(x)}$ is the zeroth order Bessel function of first kind.
316 ${\displaystyle \displaystyle J_{n}(x)}$ ${\displaystyle \displaystyle {\frac {2(-i)^{n}T_{n}(2\pi \xi )\operatorname {rect} (\pi \xi )}{\sqrt {1-4\pi ^{2}\xi ^{2}}}}}$ ${\displaystyle \displaystyle {\sqrt {\frac {2}{\pi }}}{\frac {(-i)^{n}T_{n}(\omega )\operatorname {rect} \left(\displaystyle {\frac {\omega }{2}}\right)}{\sqrt {1-\omega ^{2}}}}}$ ${\displaystyle \displaystyle {\frac {2(-i)^{n}T_{n}(\nu )\operatorname {rect} \left(\displaystyle {\frac {\nu }{2}}\right)}{\sqrt {1-\nu ^{2}}}}}$ This is a generalization of 315. The function ${\displaystyle J_{n}(x)}$ is the ${\displaystyle n}$-th order Bessel function of first kind. The function ${\displaystyle T_{n}(x)}$ is the Chebyshev polynomial of the first kind.
317 ${\displaystyle \displaystyle \log \left|x\right|}$ ${\displaystyle \displaystyle -{\frac {1}{2}}{\frac {1}{\left|\xi \right|}}-\gamma \delta \left(\xi \right)}$ ${\displaystyle \displaystyle -{\frac {\sqrt {\pi /2}}{\left|\omega \right|}}-{\sqrt {2\pi }}\gamma \delta \left(\omega \right)}$ ${\displaystyle \displaystyle -{\frac {\pi }{\left|\nu \right|}}-2\pi \gamma \delta \left(\nu \right)}$ ${\displaystyle \gamma }$ is the Euler–Mascheroni constant.
318 ${\displaystyle \displaystyle \left(\mp ix\right)^{-\alpha }}$ ${\displaystyle \displaystyle {\frac {\left(2\pi \right)^{\alpha }}{\Gamma \left(\alpha \right)}}u\left(\pm \xi \right)\left(\pm \xi \right)^{\alpha -1}}$ ${\displaystyle \displaystyle {\frac {\sqrt {2\pi }}{\Gamma \left(\alpha \right)}}u\left(\pm \omega \right)\left(\pm \omega \right)^{\alpha -1}}$ ${\displaystyle \displaystyle {\frac {2\pi }{\Gamma \left(\alpha \right)}}u\left(\pm \nu \right)\left(\pm \nu \right)^{\alpha -1}}$ This formula is valid for ${\displaystyle 1>\alpha >0}$. Use differentiation to derive formula for higher exponents. ${\displaystyle u}$ is the Heaviside function.