Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid spaces around ignorant and invisible elements in math #4348

Merged
merged 2 commits into from
Jul 6, 2024

Conversation

EpicEricEE
Copy link
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
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
Copy link
Contributor Author

EpicEricEE commented Jun 6, 2024

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
Member

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

@EpicEricEE
Copy link
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
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
Member

Thanks!

Merged via the queue into typst:main with commit 59374f7 Jul 6, 2024
6 checks passed
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
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