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

Make sure multiple elements are typset in order. (mathjax/MathJax#2999) #912

Merged
merged 1 commit into from
Mar 10, 2023

Conversation

dpvc
Copy link
Member

@dpvc dpvc commented Feb 23, 2023

This PR refactors the HTMLDocument.findMath()method so that the order of the math is preserved properly. This is done by changing the order of the nested loops. In the past, the outer loop was on the containers, and then each Jax was called to find its math and the results were merged into the document list. This failed to work properly because the sorting is based on the index of the string in which the math was found, but the list of strings is separate for each container, so they get interleaved when merged. (See mathjax/MathJax#2999 for an example.)

Now the order is to loop over the jax first, and then over the containers, so that all the strings for all the containers are in one larger list, and there is no interleaving. At least not for a single typeset call.

Resolves issue mathjax/MathJax#2999.

@dpvc dpvc requested a review from zorkow February 23, 2023 22:59
@dpvc dpvc added this to the v4.0 milestone Feb 23, 2023
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 ae1b432 into develop Mar 10, 2023
@dpvc dpvc deleted the issue2999 branch March 10, 2023 15:15
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