mathjax / mathjax/MathJax

Determining when line breaks should occur on small screens in 4.0.0 with firefox.

Open
#3,470 13 comments 0 reactions 1 assignee View on GitHub

@dpvc is already working on this.

Since Dec 28, 2025.

Browser Bug Code Example
Dominant language
JavaScript
Stars
10.9k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

In testing if some of my formulas are more responsive using the line break feature of 4.0.0, I have determined that sometimes line breaks occur on smaller screens and other times they don't. I haven't figured out the logic here and if it is something that I can improve or configure.

I have an equal chain that doesn't line break on smaller screens.

\(A\vec{\bf x} =
 \begin{bmatrix} 2 & 2 \\ -1 & 3\end{bmatrix}
 \begin{bmatrix} 2 \\ 3\end{bmatrix}
 = \begin{bmatrix} (2)(2) + (2)(3) \\ (-1)(2) + (3)(3) \end{bmatrix}
 = \begin{bmatrix} 10 \\ 7 \end{bmatrix}\)

But if I add another matrix to the equal chain it does line break.

\(A\vec{\bf x} =
 \begin{bmatrix} 2 & 2 \\ -1 & 3\end{bmatrix}
 \begin{bmatrix} 2 \\ 3\end{bmatrix}
 = \begin{bmatrix} (2)(2) + (2)(3) \\ (-1)(2) + (3)(3) \end{bmatrix}
 = \begin{bmatrix} 4 + 6 \\ -2 + 9 \end{bmatrix}
 = \begin{bmatrix} 10 \\ 7 \end{bmatrix}\)

Here is a screenshot, the first equal chain the last matrix is pushed off the edge of the screen, while the second causes a line break.

Image

In trying to determine what causes the line breaks, it seems to be the number of matrices,
and not their sizes. For example if I make the last matrix bigger in the first example by writing
the numbers as a sum of 1's:

\(A\vec{\bf x} =
 \begin{bmatrix} 2 & 2 \\ -1 & 3\end{bmatrix}
 \begin{bmatrix} 2 \\ 3\end{bmatrix}
 = \begin{bmatrix} (2)(2) + (2)(3) \\ (-1)(2) + (3)(3) \end{bmatrix}
 = \begin{bmatrix} 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1\\ 1 + 1 + 1 + 1 + 1 + 1 + 1 \end{bmatrix}\)

No line break occurs just like the first example, even though this statement is now longer than
the second example which has a line break in it.

I did notice there have been various issues and some fixes with line breaks in 4.0.0, but I could not determine if this was addressed (this particular issue didn't seem to be included in the other issue and fixes I saw, and I didn't have time to test if this was fixed by building the most recent mathjax from source).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.