Skip to content

Fix CJK-Latin spacing incorrectly added around super/subscripts#7157

Closed
hongjr03 wants to merge 3 commits intotypst:mainfrom
hongjr03:fix-spacing
Closed

Fix CJK-Latin spacing incorrectly added around super/subscripts#7157
hongjr03 wants to merge 3 commits intotypst:mainfrom
hongjr03:fix-spacing

Conversation

@hongjr03
Copy link
Contributor

@hongjr03 hongjr03 commented Oct 16, 2025

This pr fixes #7113.

This solution checks whether text has shift_settings (which is only set by #super[], #sub[], and similar elements that render as actual superscripts/subscripts). This fix
tracks super/subscript boundaries to only prevent spacing at the edges while
maintaining proper spacing for mixed CJK-Latin text inside.

@laurmaedje
Copy link
Member

What if there are both CJK and Latin characters in the superscript?

@hongjr03
Copy link
Contributor Author

What if there are both CJK and Latin characters in the superscript?

The inner spacing should be preserved. I’ll fix it right away.

@laurmaedje
Copy link
Member

I had the feeling that this could be simplified, so I gave it a shot. This required refactoring the original implementation a bit first, which I did in 4c0499f, to then add the shift handling in 0d63032. I've opened #7175 with this alternative approach. I kept your test and added you as a co-author.

@hongjr03
Copy link
Contributor Author

I had the feeling that this could be simplified, so I gave it a shot. This required refactoring the original implementation a bit first, which I did in 4c0499f, to then add the shift handling in 0d63032. I've opened #7175 with this alternative approach. I kept your test and added you as a co-author.

Alright! Should I close this pr or not?

@laurmaedje
Copy link
Member

I'll just go ahead and close it now that I've merged the other one. Thanks for the quick fix that I could base my patch on!

@laurmaedje laurmaedje closed this Oct 17, 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.

CJK-Latin spaces should not be added to footnote numbers and superscripts (v0.14.0-rc.1 regression)

2 participants