Fix malformed $\LaTeX$#1937
Open
NathanielBlairStahn wants to merge 17 commits intomainfrom
Open
Conversation
Contributor
Author
|
I had the AI search for missed errors again, this time by running MathJax directly, and it found a few more that escaped both the pattern matching in the initial Python script and the Playwright page scraping for some reason. |
Contributor
Author
|
For reference, here are a few of the pages that were affected by these changes: |
zmbc
approved these changes
May 5, 2026
Collaborator
zmbc
left a comment
There was a problem hiding this comment.
I randomly sampled parts of this PR and they all looked reasonable
SylLutze
approved these changes
May 6, 2026
Collaborator
SylLutze
left a comment
There was a problem hiding this comment.
Similar to Zeb, I did a bit of random spot checking, I did not do a complete review of all lines.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix a bunch of errors in our displayed equations, with the help of GitHub Copilot. The two most common errors were
\textcommand, e.g.,\text{deaths_c500}instead of\text{deaths\_c500}, leading to a "'_' allowed only in math mode" error. The first version is not valid_as a subscript, which is illegal in text mode, so the underscore needs to be escaped if we want a literal underscore.\begin{aligned*}...\end{aligned*}within Sphinx's.. math::directive without the:no-wrap:option, which leads to an "Erroneous nesting of equation structures" error. There are two ways to fix this: Either add the:no-wrap:option to the math directive to prevent Sphinx from erroneously wrapping it in another environment, or replace thealign*environment with thealignedenvironment, which is designed to be used inside another equation environment.These errors have always been present in our code, but I'm guessing they only showed up recently due to an update to MathJax, which renders the equations in web browsers. I'm not totally sure, but most likely older versions of MathJax were more forgiving of$LaTeX$ commands that didn't follow proper syntax.
The AI caught a few other instances of typos, bad formatting, and bad syntax that I also fixed, even though they weren't throwing errors.
I can't guarantee that I've caught all the errors, or that I've necessarily implemented the correct fix in all instances since the fixes were made programmatically via Python scripts from the AI. After I thought I had caught everything, I tried having the AI run a headless browser (Playwright) to scrape error messages from the rendered web pages (this idea was one of the AI's suggestions), and it caught one more that had been missed. So maybe that means now there shouldn't be any more errors?