Repository navigation
Fix HTML equation numbers lost with --mathml or --math-method - #15358
Merged
Merged
Conversation
Crossref equation numbering picks \tag{n} for MathJax and KaTeX and
\qquad(n) for every other method, reading the html-math-method filter
param. That param came from the Pandoc defaults only, so a method chosen
on the command line never reached the filter. On Bootstrap HTML the
defaults say mathjax, so --mathml, --math-method=mathml and
--math-method=plain got \tag{1}, which those methods drop: the equation
number disappeared from the output.
The param now comes from resolveHtmlMathMethod when a flag chose the
method, as the KaTeX post-processor, the template patch and llms.md
output already do. Without a flag it keeps the defaults value, so the
default webtex URL Quarto fills in is unchanged. The flag is not written
into the defaults or format.pandoc: the template patch relies on telling
a flag apart from html-math-method.
One visible change: --katex or --mathjax on HTML without Bootstrap now
numbers with \tag{1} instead of \qquad(1), as Bootstrap HTML already does.
Collaborator
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
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.
When the math method is chosen on the command line,
quarto render doc.qmd --mathml(or--math-method=mathml,--math-method=plain) drops cross-referenced equation numbers from HTML output. The same document withhtml-math-method: mathmlin YAML shows(1)next to the equation.This matters more now that the deprecation warning for
--mathml,--katex, etc. points users to--math-method(#15321 made Quarto honor it).Root cause
Equation numbering appends
\tag{1}for MathJax and KaTeX, which render it as a right-aligned number, and\qquad(1)for other methods, which have no\tagsupport. It chose between the two from thehtml-math-methodvalue in the format options only, never from the command line flags. Bootstrap HTML defaults tomathjax, so with--mathmlthe equation got\tag{1}, which MathML and plain output drop.Fix
The numbering now uses
resolveHtmlMathMethod()when a command line flag chose the method, as the KaTeX post-processor, the template math setup andllms.mdoutput already do. Without a flag, the value from the format options is used as before.The flag is not written back into the format options: the template math setup relies on telling a flag apart from
html-math-method, to leave the math library to Pandoc when a flag is used.One visible change:
--katexor--mathjaxon HTML without Bootstrap (theme: none,minimal: true) now numbers equations with\tag{1}instead of\qquad(1), as Bootstrap HTML already does. KaTeX renders the number right-aligned (checked in a browser).Checklist
I have (if applicable):
AI-assisted PR