Skip to content

Fix: left right duplication#70

Open
samuelzxu wants to merge 3 commits into
mgriebling:mainfrom
samuelzxu:fix/issue-66-left-right-duplication
Open

Fix: left right duplication#70
samuelzxu wants to merge 3 commits into
mgriebling:mainfrom
samuelzxu:fix/issue-66-left-right-duplication

Conversation

@samuelzxu

@samuelzxu samuelzxu commented Jun 12, 2026

Copy link
Copy Markdown

The inner content of \left( and \right) should be typeset at most once to avoid duplication errors.

Thanks for maintaining this tool! I use it in my repo and found this issue with it which was already open.

Fixes #66

)

makeLeftRight typeset the inner math list twice — once to size the
delimiters and once to place the content. Typesetting an MTMathList is
not idempotent: preprocessMathList fuses adjacent ordinary atoms in
place via MTMathAtom.fuse (nucleus += atom.nucleus), so the second pass
re-fused already-fused runs and duplicated any multi-atom content inside
a \left…\right group. Nesting compounded the effect (one extra pass per
level).

Typeset the inner list once, cache the resulting MTMathListDisplay, and
reuse it for both the delimiter-height calculation and placement.

Adds LeftRightDuplicationTests covering the issue mgriebling#66 reporter
expression plus fraction, bracket, nested, and \left. variants.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicate characters are rendered when \left and \right are used

1 participant