Repository navigation
Wrapping with parens should not push superscripts higher - #4545
Merged
Merged
Conversation
laurmaedje
reviewed
Jul 14, 2024
Leedehai
force-pushed
the
attach
branch
3 times, most recently
from
July 14, 2024 16:42
eea2779 to
f3eda63
Compare
laurmaedje
enabled auto-merge
July 15, 2024 09:51
Member
|
Thanks! |
Member
|
@Leedehai Since you've recently worked a bunch on |
Contributor
Author
|
Sure, opened #4569 |
This was referenced Sep 27, 2024
Dikluwe
pushed a commit
to Dikluwe/typst-crystalline
that referenced
this pull request
Sep 12, 2026
Co-authored-by: Laurenz <[email protected]>
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.
A parenthesis glyph itself (i.e.
(or)) is a text-like [1], so superscripts attached to it should not be pushed higher, just like other non-large glyphs [2]typst/crates/typst/src/math/attach.rs
Line 427 in ab5cebc
As shown below, parenthesis glyphs of an LR that wraps around text-like glyphs are the same as standalone parenthesis glyphs, and should still be text-like. Therefore, the whole sequence of glyphs in the said LR are all text-like, and the superscripts attached to this sequence should still not be pushed higher.
This is addressed by marking the frame fragment built from a
MathRuncontaining all text-like fragments text-like.Comparisons:
Taking figure (4) as an example. The 1st red box shows the superscript position when the base (an
xcharacter) is a non-large glyph. The 2nd box shows the superscript position when the base is a single parenthesis glyph. The 3rd box's base is a sequential combination of the these glyphs, so the superscript in the 3rd should have the same vertical position like before, instead of being pushed higher.[1]
MathFragment::is_text_like()is for the purpose of TeXBook Appendix G 18a's special handling to determine the vertical position for superscripts and subscripts.[2] See
MathFragment::is_text_like(). Large glyphs (i.e.MathClass::Large) are the ones like the big integral symbol.