MathJax icon indicating copy to clipboard operation
MathJax copied to clipboard

[SVG renderer] with line break enabled, a multiline display formula flows out of the top border of container

Open hbghlyj opened this issue 6 months ago • 1 comments

Steps to Reproduce:

  1. At https://www.mathjax.org/#demo, test the following
<div style="border: 2px lightgray solid;width: 16em;">
\begin{align*}
\frac{8m}{2+m}+\frac{9n}{1+n}&=8-\frac{16}{2+m}+9-\frac{9}{1+n}\\[1ex]
&=17-\left(\frac{64}{8+4m}+\frac{81}{9+9n}\right)\\[1ex]
&\leqslant17-\frac{(8+9)^2}{(8+4m)+(9+9n)}\\[1ex]
&=\frac{17}{18},
\end{align*}
</div>
  1. In MathJax context menu, set Wide Expressions to Linebreak and Math Renderer to CHTML, Image Image

  2. Reload the page

  3. In MathJax context menu, set Wide Expressions to Linebreak and Math Renderer to SVG, the multiline formula flows out of the top border of the container:

Image

Technical details:

  • MathJax Version: 4.0.0

hbghlyj avatar Aug 17 '25 08:08 hbghlyj

I have made a PR that addresses this issue, and several other line-breaking problems.

dpvc avatar Aug 18 '25 18:08 dpvc