brackets from macros get matched in comments
Author: superle3Created Jun 15, 2026Updated Aug 5, 2026
LabelsReady for ReviewAccepted
Issue Summary
When there is a macro that takes an argument, the first closing bracket gets used, even when it is inside a latex comment. Since this is not an issue when there is no macro but just brackets, I assume its a bug? from quick search, couldn't find anything indicating its not.
Steps to Reproduce:
render the math
$$
\text{hello
%}
world}
$$Should produce the same as
$$ \text{hello world} $$
where as
$$
{
hello %}
}
$$doesn't give an error
Technical details:
- MathJax Version: 4
- Client OS: windows 10
- Browser: librewolf 151.0.4-1
Supporting information:
using basic html template
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Page Title</title>
<script
defer
src="https://cdn.jsdelivr.net/npm/mathjax@4/tex-mml-chtml.js"
></script>
</head>
<body>
<div>$$\text{
a%b}
c}$$
</div>
</body>
</html>produces
Source: mathjax/MathJax