Skip to content

infinite loop / OOM when a spacing macro precedes \square #3571

@TheSil

Description

@TheSil

Issue Summary

In MathJax v4, \qquad\square sends typesetting into an infinite loop: the page never finishes rendering and the browser tab hangs / runs out of memory. \square on its own renders fine.

Steps to Reproduce:

  1. Load a page that loads MathJax v4 (tex-chtml) with the minimal config below.
  2. Put \(\qquad\square\) in the body.
  3. Open the page — it hangs during initial typesetting (tab becomes unresponsive / OOM). \(\square\) or \(\qquad x\) alone render normally.

This is valid TeX that LaTeX typesets without issue, so MathJax should render it (or report an error) rather than hang indefinitely. I expected the QED box to render with the preceding space.

Technical details:

  • MathJax Version: 4.1.2
  • Client OS: Windows 11
  • Browser: Brave (1.90.128) Chromium (148.0.7778.217)

I am using the following MathJax configuration:

MathJax = {};

and loading MathJax via

<script async src="https://cdn.jsdelivr.net/npm/mathjax@4.1.2/tex-chtml.js"></script>

Supporting information:

  • No live link, but a complete minimal repro page:
<!doctype html><html><head><meta charset="utf-8">
<script>MathJax = {};</script>
<script async src="https://cdn.jsdelivr.net/npm/mathjax@4.1.2/tex-chtml.js"></script>
</head><body>
<p>\(\qquad\square\)</p>
</body></html>
  • Not a display issue — the tab hangs/OOMs before anything renders.
  • Browser console shows no errors (it hangs before any are emitted).

Metadata

Metadata

Assignees

No one assigned

    Labels

    AcceptedIssue has been reproduced by MathJax teamSREv4

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions