Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow \middle to work when a style or color is open. (mathjax/MathJax#2663) #673

Merged
merged 1 commit into from
Apr 14, 2021

Conversation

dpvc
Copy link
Member

@dpvc dpvc commented Mar 30, 2021

The current implementation for \middle only works when there are no open style or color changes, and so it fails with

\left( \color{red} x \middle| y \right)

for example. This PR introduces a MiddleItem stack item that acts as a close item, so it will close any pending and style items. The LeftItem looks for a MiddleItem and processes it (by adding the needed mo) without closing itself so that it will remain open until the following RightItem occurs.

In addition, the \middle and \right delimiters now save the color that they should be in, since \left(\color{red}x\right) colors the right brace red in actual LaTeX (and similarly for \middle), and apply those properly (they didn't before).

Finally, I made the LeftRight constructor take the actual delimiter (and color) as an argument so that you don't have to set it after it is created.

Resolves issue mathjax/MathJax#2663.

@dpvc dpvc added this to the 3.1.3 milestone Mar 30, 2021
@dpvc dpvc requested a review from zorkow March 30, 2021 19:01
Copy link
Member

@zorkow zorkow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm.

@dpvc dpvc merged commit 2e89f33 into develop Apr 14, 2021
@dpvc dpvc deleted the issue2663 branch April 14, 2021 13:59
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.

None yet

2 participants