Skip to content

Avoid spaces around ignorant and invisible elements in math - #4348

Merged
laurmaedje merged 2 commits into
typst:mainfrom
EpicEricEE:ignorant-math
Jul 6, 2024
Merged

laurmaedje merged 2 commits into
typst:mainfrom
EpicEricEE:ignorant-math

Conversation

@EpicEricEE

Copy link
Copy Markdown
Contributor

Fixes #4326

I don't know what the intended behaviour is, but I feel like invisible and ignorant elements should not be accounted for when the space between two elements is inserted in an equation.

I have to admit that I don't really like the growing list of fields on the FrameFragment struct but it seemed to be the easiest way.

@bluebear94

Copy link
Copy Markdown
Contributor

Does this fix #3727 as well? In particular, do all three of the following lines display identically?

#let test = context math.class("relation", "--")
$ a test b $

$ a class("relation", "--") #metadata("hi") b $

$ a class("relation", "--") b $

@EpicEricEE

EpicEricEE commented Jun 6, 2024 •

Copy link
Copy Markdown
Contributor Author

They all look identical, but I'm not sure if it's correct as it doesn't look centered.

image

Edit: Ok, it's just the "--" not being measured correctly, it looks good with other characters.
Edit 2: It already looks like that on main too, so nothing changed with this PR

@laurmaedje

Copy link
Copy Markdown
Member

Why another field instead of just setting spaced to false for ignorant/invisible?

@EpicEricEE

Copy link
Copy Markdown
Contributor Author

Because then it wouldn't be truly ignorant but just like a normal class frame which influences the spacing between neighboring frames, e.g. vary class operators would become binary in the test cases

// Operator spacing
$#counter("test").update(3) + b$ \
$#place(dx: 5em)[a] + b$

@laurmaedje

Copy link
Copy Markdown
Member

Okay.

I have to admit that I don't really like the growing list of fields on the FrameFragment struct but it seemed to be the easiest way.

Me neither, but I guess one more field won't change anything.

If you could fix the conflict, I'll merge.

@laurmaedje
laurmaedje added this pull request to the merge queue Jul 6, 2024
@laurmaedje

Copy link
Copy Markdown
Member

Thanks!

Merged via the queue into typst:main with commit 59374f7 Jul 6, 2024
Myriad-Dreamin pushed a commit to Myriad-Dreamin/typst that referenced this pull request Jul 9, 2024
@EpicEricEE
EpicEricEE deleted the ignorant-math branch July 27, 2024 20:42
Dikluwe pushed a commit to Dikluwe/typst-crystalline that referenced this pull request Sep 12, 2026
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.

Unexpected space in math between invisible element and text

3 participants