Improve TeX spacing and bounds#165
Conversation
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #165 +/- ##
==========================================
+ Coverage 79.93% 84.74% +4.80%
==========================================
Files 10 10
Lines 658 1029 +371
==========================================
+ Hits 526 872 +346
- Misses 132 157 +25 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I did some comparing between different versions:
It's not actually the ascender that is different but the position returned by MathTeXEngine.jl/src/engine/layout.jl Line 102 in 23b783e Forcing the old choice results in these:
Without the prs the sqrt rendering is an exact match if I pick 5946. |
|
Oh and just to be clear, I don't care much about the little details like the spacing in |
|
These are the different sqrt options:
Is there a good reason to not just remove the first option? It's the only one that's weird and it wasn't there before #156 |
You are right. I have removed this glyph! Current PR also aims to fix the whitespace issue you identified (and the small a*b spacing, and I noticed multi-argument functions where slightly cramped in argument formatting). I hope this fixes all of those things. The Makie PR has been removed (not necessary once glyph excised). |
|
Short visual update after the font-capability sqrt refactor and fraction-origin tweak. The square-root reference now keeps the NCM-style radical for simple/non-rule roots, while allowing native sized radicals for fraction/tall roots where the font provides compatible variants. The last row also shows the I also refreshed the Makie-style rotation/anchor check; this remains a MathTeXEngine-side fix, with no Makie code change required. |
|
Bounding boxes look good to me without the 861 sqrt. There are a couple more noticeable changes in Makie refimages. Github doesn't let me upload images atm, so I'm just going to list them:
Not sure if these are improvements or regressions. I wouldn't mind just updating the refimages for them |
Im just working on the "sqrt glyphs extends lower" problem |
|
Are you done with the pr? |
|
Thanks again for the careful checks. I pushed one more compact update (
Local checks: |
|
Would be nice if we could merge & tag that somewhat quickly. Let us know if we can help with anything! Thank you all! |
|
Makie refimages look fine to me |
|
@Kolaru let me know what else I should do to get this merged |
|
It all looks good to me, thanks to everyone involved! I'll tag a new version now. |












Summary
Improves TeX spacing/bounds and square-root layout without changing the public API.
The main visible changes are:
Spaceout of visual ink bounds while preserving horizontal advance, so padding does not inflate labels or rotated text extents.2ab, over-wide Latin pairs such asab, and punctuation regressions such asW(\alpha,\alpha^*).\gtrsimand\lesssimas relation commands, so they receive the same relation spacing as≳,≲, and\geq.√glyph ascender to its ink top, preventing empty root-glyph ascender space from inflating rotated/y-axis label bounds.No public API changes are intended.
Explanation
The sqrt path now separates base-root and constructed-root use cases. Ordinary
√glyphs are allowed for simple, short roots where they produce the expected compact shape, but they are not treated as stretchable radicals for fraction or tall roots. Those cases continue throughradical.v*/sqrt.v*candidates, with NewComputerModern only used as a missing-glyph fallback. A small descent cap handles fonts whose compact root glyph otherwise hangs too far below short content such as\sqrt{x}.The bounds changes make visual bounds better match actual ink/rule geometry. This helps labels, rotated TeX, and fraction/radical expressions avoid whitespace or anchoring artifacts from non-ink padding and from font-level ascenders on compact sqrt glyphs.
The spacing changes keep the existing collision-safe Greek behavior, but add a separate compact path for adjacent Latin italic variables and digit-to-Latin implicit multiplication. Relation command classification now also includes
\gtrsimand\lesssim, matching their unicode equivalents.Tests
git diff --checkjulia --project=@runic -m Runic --check -d src/engine/layout.jl src/engine/texelements.jl test/layout.jljulia --project=/Users/braas09p/Dropbox/Julia/Dev/MathTeXEngine.jl test/runtests.jlTeXExpr 1/1,Parser 128/128,Fonts 5/5,Layout 201/201,Generate elements 4/4.I also regenerated local visual diagnostics for the full radicals/font sheet, the Makie
latex_stringssheet, the rotated fraction bbox/vinculum intercept check, and a focused\gtrsimrelation-spacing sheet.