Repository navigation
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
0a39f0a to
45722a3
Compare
|
I have read the CLA Document and I hereby sign the CLA |
Assisted-by: Codex Signed-off-by: dancvv <35890032+dancvv@users.noreply.github.com>
An intervening smaller base on a higher row can carry the glyph as its subscript. Keep the drawn position when that base occupies the gap to the glyph, while retaining the existing superscript alignment for ordinary scripts and full-size delimiters. Assisted-by: Codex Signed-off-by: dancvv <35890032+dancvv@users.noreply.github.com>
Assisted-by: Codex Signed-off-by: dancvv <35890032+dancvv@users.noreply.github.com>
Signed-off-by: dancvv <35890032+dancvv@users.noreply.github.com>
fae15ab to
433a011
Compare
|
Hi @yfedoseev, could you please rerun the failed Java 11 check on Ubuntu? Compilation passed, but Maven couldn't resolve the Surefire dependencies, so the tests never started. Thanks! |
|
Hi @dancvv, thank you for picking this up! The write-up is clear, the synthetic reproducer is exactly the right shape, and the root-cause work showed us where to look. Contributions like this are always welcome. We took a deeper look at the problem itself before reading the patch, and found that #3113 is one visible case of a wider defect in how scripts are attached to rows. The guard in this PR fixes the reported layout, but the cause underneath is still there. Below is what we found and the change we think the fix needs. It's more than the PR set out to do, so please read it as a direction we'd like to agree on together, not a list of mistakes. What's actually going wrong
The snap exists only to keep scripts in their row for reading order. That's a grouping decision, and it shouldn't change coordinates. What we found in the PR itself
The change we'd suggest1. Keep every box where it's drawn, and group rows on a separate key.
2. Attach a script to its own base, judged by geometry only.
3. Tests.
4. The issue's case in 5. One logical change. Reviving the superscript-digit substitution test (currently 6. Housekeeping.
About regression testingTo be transparent: we haven't run a regression on real documents for this yet, either for your patch or for the direction above. Everything here comes from reading the code, the spec and the geometry. We'll run it once there's a version to test, against both main and v0.3.78, on documents that use this code: author/affiliation blocks, chemistry, maths papers with nested scripts and fractions, drop caps, tables with larger headers, and large pages for timing. It may turn up cases that need further adjustment, such as the stack threshold, or places that relied on the moved box, so a few more changes may be needed after it. How we'd like to go from hereThis can mean some back-and-forth: a design-level change like this, followed by a regression run, often takes a few rounds of review. Please pick whichever option suits you:
Either way, thank you. This report and the reproducer found a real problem that goes beyond the one case. |
|
Thanks for offering to take this over, @yfedoseev. I’m happy to go with option 2. I tried your approach locally. It fixed the original fraction, but my prototype changed the reading order on two pages: mathtools, p. 15 and chemformula, p. 22. I hope they’re useful as regression tests. |
|
@dancvv thank you, and thanks for trying the approach. Those two pages are exactly what we need: a fix that changes the reading order there is not right yet. We'll take it from here. We'll rebuild both layouts, mathtools p. 15 and chemformula p. 22, as small synthetic PDFs in code, since the originals are third-party and stay out of the repository. They become regression tests beside your fraction reproducer, and the fix has to keep all three right. You're credited for the report and the cases in the CHANGELOG. |
Closes #3113
What and why
As an active user of the project, I picked up this issue and took the initiative to implement a fix. I used Codex to assist with root cause analysis and improve regression test coverage. The test verifies that the numerator’s subscript stays at the same y-coordinate as its glyph, even when an equals sign appears beside the fraction.
The
3in the syntheticQ₃numerator is drawn at y = 705.9 pt. When an equals sign appears to the left,extract_spanspreviously moved the digit to y = 700.0 pt. The fix checks for a closer base above the digit before snapping it to the lower row.Tests
main(aad918a) before the fix. With the fix, bothextract_spansandextract_charsreturn y = 705.9 pt. The denominator stays at 691.6 pt.aad918a, the default Rust suite had 8,826 passes, 0 failures and 268 ignored tests. Formatting, Clippy and the Python binding reproduction also passed.Regression on real PDFs
Against both
main(aad918a) andv0.3.78, the 13 control PDFs (264 pages) had identical extracted text and all 37,299 spans matched. Minimum word Jaccard was 1.0, with zero spacing differences. On page 4 of the reporter’s PDF, all seven adjusted digits matched their character coordinates. The reported numerator moved from 751.78 to 757.68 pt.AI assistance disclosure
Codex wrote the candidate extraction change and regression tests. The commits include
Assisted-by: Codex. Contributor review and DCO sign-off are pending.