Skip to content

brackets from macros get matched in comments #3577

@superle3

Description

@superle3

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

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions