Wednesday, March 27, 2024

Line breaking in math using MathJax

Line breaking in math using MathJax

This is in response to a discussion thread in the MathJax email list.

I would write the inline version with a separate math container for each of the components in this list so that spacing and breaking is handled by the browser in the standard way for HTML. This avoids bad line breaks. Thus: A long line \(\{\)$\frac{3}{4},$ $x,$ $y,$ $z,$ $3,$ $10,$ $x+3,$ $10-x,$ $13-y-z,$ $13-z,$ $y+z,$ $x,$ $y,$ $z,$ $3,$ $10,$ $x+3,$ $10-x,$ $13-y-z,$ $13-z,$ $y+z$\(\}\) which stretches and stretches.

In my opinion any form of displayed math should not have automatic line breaking. So I would not use displaymath for this long sequence of expressions. However, HTML display techniques — for example, a nested pair of suitably styled divs — can be applied for the inline markup above as here:

\(\{\)$\frac{3}{4},$ $x,$ $y,$ $z,$ $3,$ $10,$ $x+3,$ $10-x,$ $13-y-z,$ $13-z,$ $y+z,$ $x,$ $y,$ $z,$ $3,$ $10,$ $x+3,$ $10-x,$ $13-y-z,$ $13-z,$ $y+z$\(\}.\)