Skip to content

Apply short fall consistently in math when stretching#6377

Merged
laurmaedje merged 2 commits intotypst:mainfrom
mkorje:short-fall-consistent
Jun 4, 2025
Merged

Apply short fall consistently in math when stretching#6377
laurmaedje merged 2 commits intotypst:mainfrom
mkorje:short-fall-consistent

Conversation

@mkorje
Copy link
Collaborator

@mkorje mkorje commented Jun 4, 2025

No description provided.

@mkorje mkorje changed the title Apply short fall consistenly in math when stretching Apply short fall consistently in math when stretching Jun 4, 2025
@laurmaedje
Copy link
Member

I think my original thought was that if we pick a variant and it's just a little too short (<= short fall), then it's not worth picking a way larger one, but if we create a construction, we might as well create the exact desired size.

The interpretation here instead is that it's generally good to make the stretched thing a little less wide/large than the base/content. That's more consistent I guess. Do we happen to know what LuaLaTeX does? Probably the same as this here?

@mkorje
Copy link
Collaborator Author

mkorje commented Jun 4, 2025

I think my original thought was that if we pick a variant and it's just a little too short (<= short fall), then it's not worth picking a way larger one, but if we create a construction, we might as well create the exact desired size.

I think I gathered this as well. But I didn't like the idea of either having the short fall hard coded (and so appears as a bit of magic to the end user), or adding another parameter along with the size...

The interpretation here instead is that it's generally good to make the stretched thing a little less wide/large than the base/content. That's more consistent I guess. Do we happen to know what LuaLaTeX does? Probably the same as this here?

Yeah my reasoning is really just the above. I believe *TeX uses the following formula calc.max(x - 5pt, x * 0.901), and then just picks among the variants or assembly to get the smallest one at least the calculated size. So basically the same as this PR then.

I could see it being nicer to only apply the short fall for prebuilt variants, but exposing this will just be confusing to end users I think. Also, the prebuilt variants and their sizes are entirely font dependent anyways...

@laurmaedje laurmaedje added this pull request to the merge queue Jun 4, 2025
@laurmaedje
Copy link
Member

Alright, I think I'm good with this change. The updated reference images also actually look a bit nicer imo.

@mkorje
Copy link
Collaborator Author

mkorje commented Jun 4, 2025

I'll sort out the other PR now.

Merged via the queue into typst:main with commit aee9940 Jun 4, 2025
7 checks passed
@mkorje mkorje deleted the short-fall-consistent branch June 4, 2025 10:20

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change really correct? Using \overrightarrow in LaTeX does not produce this noticeably short arrow

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I agree it doesn't look great. Maybe we can just modify the accent size shortfall, I'll try it out soon.

mkorje added a commit to mkorje/typst that referenced this pull request Oct 14, 2025
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.

3 participants