brackets from macros get matched in comments
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.9k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the examples with the MathJax 4 tex-mml-chtml.js entry point, focusing on how the \text macro matches arguments across LaTeX comments. Done means a closing bracket inside a comment is ignored for macro matching while ordinary brace handling remains unchanged, with the reported cases verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, latex
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100