Fix block LaTeX rendering with SwiftMath display mode - #153
Open
manemajef wants to merge 1 commit into
Open
Conversation
manemajef
marked this pull request as ready for review
August 12, 2026 23:41
manemajef
force-pushed
the
fix/block-latex-display-style
branch
from
September 9, 2026 15:27
439cc81 to
b8cb75b
Compare
Author
|
I rebased this onto the current I also removed unrelated documentation churn, reduced the SwiftMath regression |
The parser already distinguishes block and inline formulas, but that information was discarded before rendering. Carry the mode through the renderer boundary so block formulas use display typesetting, while legacy renderers continue to receive the existing call. Include the mode in SwiftMath cache keys so an inline result cannot be reused for the same formula in display mode.
manemajef
force-pushed
the
fix/block-latex-display-style
branch
from
September 9, 2026 15:29
b8cb75b to
6051966
Compare
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.
Summary
SwiftMathBridgecurrently renders both inline$ … $and block$$ … $$formulas using SwiftMath's text mode.
That gives block formulas inline typography: limits sit beside large operators,
fractions remain small, and operators do not scale as expected.
What changed
The parser already distinguishes inline and block LaTeX. This PR carries that
information through
LatexRenderer:.inline.displaySwiftMathBridgemaps the mode to SwiftMath'slabelModeresults for the same formula from colliding
The Markdown source remains unchanged; no
\displaystyleinjection or contenttransformation is involved.
Compatibility
Existing
LatexRendererconformers remain source-compatible. The newmode-aware overload defaults to the original renderer method, so renderers that
do not distinguish the two modes continue working unchanged.
Direct calls to
render(latex:fontSize:theme:)retain inline behavior.Validation
swift buildswift test --parallel— 473 core tests and the SwiftMath regression test pass