Repository navigation
ragged text is not hyphenated, because an infinite background makes every line good - #772
Conversation
…very line good \raggedright broke its lines as if the paragraph were justified, and hyphenated them. tex.web §852 gives badness 0 and fitness `decent` to ANY line carrying infinite stretch; \raggedright's \rightskip is 0pt plus 1fil, so TeX's FIRST pass — no hyphenation, at \pretolerance — succeeds on every ragged paragraph it meets and the hyphenating pass is never reached. That is why ragged text is not hyphenated. It is not a rule about hyphens, it is what an infinite background does to badness. go-typeset/linebreak carries one float of stretch and flattens a fil to a large finite number (its issue #12, item 1), so the lines came back with a large but FINITE badness, the first pass failed, and the paragraph was hyphenated exactly as if it were justified. MEASURED, tectonic 0.17.0, \hsize=100pt, lmroman10 on both sides: reference ragged 6 lines, 0 hyphens, no warning reference justified 6 lines, 2 hyphens, one Overfull \hbox (1.172pt) before ragged `… and a mea-sure …`, 2 overfull lines of our own after ragged 0 hyphens, 0 overfull ⚠ THE JUSTIFIED COLUMN IS THE CONTROL AND IT DOES NOT MOVE. Swept at eleven measures from 80pt to 200pt, the justified output is byte for byte identical before and after. The ragged output improves at 80, 90, 100 and 180pt — the hyphen goes AND the overfull lines go (1, 1, 2, 1 → 0, 0, 0, 0) — and is unchanged everywhere else. 110pt and 130pt still set ragged text with overfull lines; that is older than this change and stays open. ⚠ AND IT IS NOT "DO NOT HYPHENATE WHEN RAGGED". TeX still hyphenates ragged text when a word would otherwise not fit: the first pass fails because the line is not good, whatever the \rightskip. Measured at \hsize=60pt, the reference breaks `incomprehen-` / `sibilities` under \raggedright and so do we. ⛔ A CLAIM THIS COMMIT FIRST MADE AND COULD NOT SUPPORT. The overfull test in the new branch was written asking `Ratio < -1`, then rewritten to measure the width with the reasoning that the ratio is blind to a line with no shrinkable glue — #771's defect, one file away, an hour earlier. The mutation does not support it: swapping the width back for the ratio, or deleting the test altogether, leaves the whole suite green, because at any measure narrow enough to overfull a line the first pass fails before the question is asked. The width is kept, for a reason that IS demonstrable: greedyLines never sets Ratio at all, so a Line it built carries 0 — that, not the absence of glue, is what made `Ratio < -1` count nothing in #771. One lineOverflowSP now answers the question for both callers. The comments say the test has no witness rather than implying it caught something. Refs #768. Co-Authored-By: Claude Opus 5 <[email protected]>
|
⛔ THE CORPUS A/B IS IN, AND IT GOES THE WRONG WAY. Two papers moved and BOTH Same corpus slice, same seed, same machine, base = the merge-base commit. ⚠ AND THEY ARE NOT NOISE. The scorer is deterministic: base reads 96.5% for ⛔ NEITHER PAPER USES \raggedright. Nothing in either source says That is not obviously wrong: §852 is about the background being infinite, not WHAT I AM DOING ABOUT IT Building a variant whose ⚠ WHAT THE SCORE IS. Word recall against the reference PDF, not a verdict on This stays a draft. |
|
⭐ THE ATTRIBUTION IS IN, AND IT REVERSES THE READING OF THE SCORE. 1. The regression is entirely
|
| paper | base | head | strict-\raggedright variant |
|---|---|---|---|
| 2607.14549 | 96.5% (1004/1040) | 96.4% (1003/1040) | 96.5% (1004/1040) |
| 2607.14914 | 92.6% (1270/1372) | 92.4% (1268/1372) | 92.6% (1270/1372) |
The variant returns to base exactly, word for word. So the whole movement is
three words, and all of it comes from centred material.
2. ⛔ BUT THE BROAD CONDITION IS THE FAITHFUL ONE — MEASURED
tectonic 0.17.0, the same paragraph inside \begin{center} at \hsize=100pt:
6 lines, 0 hyphens, no warning
… is wrong on / every line it sets.
identical to its \raggedright setting of the same text. The reference does not
hyphenate centred text, which is what §852 predicts — it is about the background
being infinite, not about which command set it. The variant that scores better
is the one that is wrong.
3. ⭐ AND THE PAGE THAT "LOST" A WORD IS VISIBLY BETTER
Word-multiset diff of the two PDFs for 2607.14549. What base has and head does
not:
CenterforTheoretical ElectronicEngineering
QiluNormalUniversity Jinan250200
Those are the affiliation lines WITH NO SPACES BETWEEN THE WORDS — the
signature of a centred line that was overfull and had its glue shrunk to
nothing to make it fit. Head sets the same lines as
Center for Theoretical Electronic Engineering
Qilu Normal University Jinan 250200
Head also replaces eight spurious hyphenations in centred material with whole
words: char-/acterized, follow-/ing, in-/dicated, repre-/sent,
respec-/tively, sys-/tems, transfor-/mations, con/trary become
characterized, following, indicated, represent, respectively,
systems, transformations, contrary — which is what the reference sets.
The net −1 word comes from token boundaries around a stray 0.5 fragment
(0.5This + case + siperiodic on one side, 0.5siperiodic.case + This on
the other), not from text that stopped appearing.
What I conclude, so it can be disagreed with
The corpus score is a proxy: word recall against the reference's extracted text.
Here it moved −0.1 while the direct comparison with the reference improved and a
visible defect — words touching each other in a centred block — was removed. I
am treating the oracle and the page as the authority over the proxy, and
marking this ready.
⚠ If that is the wrong call, the fix is one line (&& and == 0 in
raggedBackground), it buys back 3 words of recall, and it makes the engine
hyphenate centred text, which the reference does not.
…s about the BACKGROUND
The corpus A/B of this branch moved two revtex papers DOWN, and neither of them
uses \raggedright: the change reaches them through \centering, which sets both
skips to 0pt plus 1fil. So the condition had to be argued rather than assumed.
MEASURED, tectonic 0.17.0, the same paragraph inside \begin{center} at
\hsize=100pt: 6 lines, 0 hyphens, no warning — character for character what it
sets the same text \raggedright. The reference does not hyphenate centred text,
which is what §852 predicts: it is about the background being infinite, not
about which command set it.
A variant narrowed to a strictly right-ragged background scores BETTER — it
returns both papers to their base word recall exactly — and is wrong, because it
makes the engine hyphenate centred text. The test added here refuses it, and the
mutation was run: with `&&` and `== 0` the centred paragraph comes out
`Typogra-phy … a mea-sure …` and the test goes red while the \raggedright one
stays green.
⭐ AND THE PAGE THAT LOST A WORD OF RECALL IS VISIBLY BETTER. A word-multiset
diff of the two PDFs for 2607.14549 shows what base set in the affiliation
block:
CenterforTheoretical ElectronicEngineering
QiluNormalUniversity Jinan250200
with no spaces between the words — a centred line that was overfull and had its
glue shrunk to nothing. After, those are four ordinary lines of separate words.
Eight spurious hyphenations go with them (char-/acterized, follow-/ing,
in-/dicated, repre-/sent, respec-/tively, sys-/tems, transfor-/mations,
con/trary). The net -1 word is token boundaries around a stray `0.5` fragment,
not text that stopped appearing.
The corpus score is a proxy for the reference; here the proxy and the reference
disagree, and this follows the reference.
Refs #768.
Co-Authored-By: Claude Opus 5 <[email protected]>
|
⛔⛔ CORRECTION: THE AFFILIATION FINDING ABOVE IS AN EXTRACTION ARTEFACT, NOT I wrote that base set the affiliation block as The engine's own line dump settles it. Both PDFs, page 1: The spaces are in both. Nothing ran together, and this PR did not fix it. ⛔ A PROBE THROUGH A DIFFERENT EXTRACTOR MEASURES THE EXTRACTOR. That is a What IS true, re-measured through the harness's own extractor
The verdict I asked for is unchanged in direction but weaker in evidence than I |
…egression #772 lost 0.1 and 0.2 points of word recall on two revtex papers and I could not say why. The new tool says why, and most of it is not the engine. ⛔ pdftotext WITHOUT -layout READS A TWO-COLUMN PAGE AS ONE STREAM and fuses the end of one column's line onto the start of another's. These are real tokens from 2607.14549: disFigure distribhe participaentire quaThe respecIn transforlution matTo quag quasiof reperiodic WHICH boundaries fuse depends on where the lines break, so a line-breaking change moves them. On that paper the plain extraction reports 36 and 37 words differing between the two builds; with -layout it reports 23 and 18, and every fused token above is gone. What is left is the change itself: char-/acterized → characterized, follow-/ing → following, in-/dicated, repre-/sent, respec-/tively, sys-/tems, transfor-/mations. ⭐ AND THE SCORE MOVES WITH IT. Re-scoring #772's two papers with -layout extraction (a throwaway build of gotex-refdiff, not this commit): 2607.14914 plain -0.2 -> -layout 1327 vs 1327 words, NO difference 2607.14549 plain -0.1 -> -layout 1020 vs 1019 words, ONE word So one of the two regressions was the extractor fusing columns, and the other is a single word. ⚠⚠ THIS IS NOT A PROPOSAL TO SWITCH THE SCORER. -layout moves the ABSOLUTE scores by nine points on BOTH sides (2607.14549: 96.5% -> 87.6%), because the padding it inserts changes tokenisation everywhere, including the reference's. Every historical number would move. It is a diagnostic for reading a delta, and gotex-refdiff is untouched here. The flag is on gotex-worddiff; internal/pdftext.CaptureRunner takes opts and places them BEFORE the file, where pdftotext takes its options. The mutation was run: with the opts appended after the path instead, the test goes red (`cat -u` becomes `cat f - -u`, which reads a file that is not there). Refs #716, #772. Co-Authored-By: Claude Opus 5 <[email protected]>
|
⭐ THE REGRESSION IS EXPLAINED, AND MOST OF IT IS NOT THIS BRANCH. I left the −0.1 / −0.2 open above. pdftotext reads a two-column page as ONE streamWithout WHICH boundaries fuse depends on where the lines break — so a line-breaking On that paper the plain extraction reports 36 and 37 words differing between And the score moves with the extractionRe-scoring both papers with
So one of the two regressions was the extractor fusing columns. The other is a ⚠⚠ This is NOT a proposal to switch the scorer
Where that leaves this PR
I am no longer claiming a visible improvement outweighs a loss — that claim was |
…re uses (#773) * gotex-worddiff: which words moved, read through the extractor the score uses gotex-refdiff says a paper fell 0.1 points of word recall. It does not say which words, so there is no way to tell a regression from an improvement the metric mis-counts — which is #716's subject, and which #772 ran into head-on. gotex-worddiff reports the multiset difference between two of OUR PDFs: the words one holds that the other lacks, and the reverse. No reference; measuring against the oracle is gotex-refdiff's job. Exit 0 same words, 1 different, 2 an error. ⛔⛔ AND ITS FIRST ACT WAS TO CATCH ITS OWN AUTHOR, WHICH IS WHY THE EXTRACTOR IS SHARED The scratch probe this replaces read the PDFs with `pdfops text` and reported that a revtex affiliation block had set as `CenterforTheoretical`, `QiluNormalUniversity` — words with no spaces between them — and that #772 had repaired it. That was published on #772 and on #716 before it was checked. Reading the same two files through poppler's pdftotext, which is what gotex-refdiff SCORES with, there is no such difference; and the engine's own line dump shows the spaces present in both files, at identical coordinates. The finding was two extractors disagreeing, dressed as an engine defect. Both comments are corrected. So the extraction itself — which binary, how it is found on PATH or through pkgx, the poppler project pin that stops `pkgx pdftotext` failing with MultipleProjects — moves into internal/pdftext, and gotex-refdiff is rewired onto it. What does NOT move is what refdiff makes of the text: word recall, and its genuine-empty versus tool-error distinction. Those are scoring semantics, not extraction. WHAT IS TESTED - the shapes a line-breaking change makes: a word split across a hyphen on one side and whole on the other, a fused token - a word both files hold is not a difference, and the same words in a different order exit 0 - it is a MULTISET: three occurrences against two IS a difference - ⛔ a failed extraction is an error, never an empty page — otherwise a missing poppler reports every word of the other file as a difference, a maximal and confident meaningless answer - an absent or zero-byte file, likewise - internal/pdftext: the poppler pin, a tool found on PATH, and a missing tool that must error rather than return no text The repository's own gate caught the missing .gitignore row (TestEveryCommandIsIgnoredAtTheRoot). Refs #716, #772. Co-Authored-By: Claude Opus 5 <[email protected]> * gotex-worddiff -layout, and the column fusion it found under #772's regression #772 lost 0.1 and 0.2 points of word recall on two revtex papers and I could not say why. The new tool says why, and most of it is not the engine. ⛔ pdftotext WITHOUT -layout READS A TWO-COLUMN PAGE AS ONE STREAM and fuses the end of one column's line onto the start of another's. These are real tokens from 2607.14549: disFigure distribhe participaentire quaThe respecIn transforlution matTo quag quasiof reperiodic WHICH boundaries fuse depends on where the lines break, so a line-breaking change moves them. On that paper the plain extraction reports 36 and 37 words differing between the two builds; with -layout it reports 23 and 18, and every fused token above is gone. What is left is the change itself: char-/acterized → characterized, follow-/ing → following, in-/dicated, repre-/sent, respec-/tively, sys-/tems, transfor-/mations. ⭐ AND THE SCORE MOVES WITH IT. Re-scoring #772's two papers with -layout extraction (a throwaway build of gotex-refdiff, not this commit): 2607.14914 plain -0.2 -> -layout 1327 vs 1327 words, NO difference 2607.14549 plain -0.1 -> -layout 1020 vs 1019 words, ONE word So one of the two regressions was the extractor fusing columns, and the other is a single word. ⚠⚠ THIS IS NOT A PROPOSAL TO SWITCH THE SCORER. -layout moves the ABSOLUTE scores by nine points on BOTH sides (2607.14549: 96.5% -> 87.6%), because the padding it inserts changes tokenisation everywhere, including the reference's. Every historical number would move. It is a diagnostic for reading a delta, and gotex-refdiff is untouched here. The flag is on gotex-worddiff; internal/pdftext.CaptureRunner takes opts and places them BEFORE the file, where pdftotext takes its options. The mutation was run: with the opts appended after the path instead, the test goes red (`cat -u` becomes `cat f - -u`, which reads a file that is not there). Refs #716, #772. Co-Authored-By: Claude Opus 5 <[email protected]> --------- Co-authored-by: Claude Opus 5 <[email protected]>
ragged text is not hyphenated, because an infinite background makes every line good
\raggedrightbroke its lines as if the paragraph were justified, andhyphenated them.
Why ragged text is not hyphenated
tex.web §852 gives badness 0 and fitness
decentto ANY line carrying infinitestretch.
\raggedright's\rightskipis0pt plus 1fil, so TeX's FIRST pass —no hyphenation, at
\pretolerance— succeeds on every ragged paragraph it meetsand the hyphenating pass is never reached.
That is the whole mechanism. It is not a rule about hyphens; it is what an
infinite background does to badness.
go-typeset/linebreak carries one float of stretch and flattens a
filto alarge finite number (its issue #12, item 1), so the lines came back with a large
but FINITE badness, the first pass failed, and the paragraph was hyphenated
exactly as if it were justified. Our ragged and justified paragraphs were
character for character the same, which is "ragged text breaks as if justified
and gets its glue afterwards" seen rather than argued.
Measured
tectonic 0.17.0,
\hsize=100pt, lmroman10 on both sides:\raggedright… and a mea-sure …, 2 overfullpa-per⚠ The justified column is the control, and it does not move. Swept at eleven
measures from 80pt to 200pt against a worktree at the merge-base, the justified
output is byte for byte identical before and after. Ragged improves at 80, 90,
100 and 180pt — the hyphen goes AND the overfull lines go, 1, 1, 2, 1 → 0, 0, 0,
0 — and is unchanged everywhere else.
⚠ 110pt and 130pt still set ragged text with overfull lines. Identical before
and after, so that is older than this change; it belongs to #768 and stays open.
It is NOT "do not hyphenate when ragged"
TeX still hyphenates ragged text when a word would otherwise not fit: the first
pass fails because the line is not good, whatever the
\rightskip. Measured at\hsize=60pt, the reference breaksincomprehen-/sibilitiesunder\raggedright, and so do we. There is a test for it.⛔ A claim this branch first made and could not support
The overfull test in the new branch was written asking
Ratio < -1, thenrewritten to measure the width, with the reasoning that the ratio is blind to a
line with no shrinkable glue — #771's defect, one file away, an hour earlier.
The mutation does not support that. Swapping the width back for the ratio,
or deleting the test altogether, leaves the whole suite green: at any measure
narrow enough to overfull a line, the first pass fails before the question is
ever asked. I could not build a document that distinguishes them.
The width is kept, for a reason that IS demonstrable:
greedyLinesnever setsRatioat all, so aLineit built carries 0 — that, not the absence of glue,is what made
Ratio < -1count nothing in #771. OnelineOverflowSPnowanswers the question for both callers. The comments say the test has no witness
rather than implying it caught something.
Mutations run
Ratio < -1noteBadLines' bodyTestDocCommentNamesItsOwnFunction⚠ DRAFT until the corpus A/B lands
\raggedrightis in 871 of 2935 corpus papers — 29.7%, the most common ofthe line-breaking commands — so this changes what a large fraction of real
documents get. The A/B is running now and will be posted here. I argued on #769
that a behaviour change should not merge before its A/B; this one is in no
hurry, so it waits.
Refs #768.
🤖 Generated with Claude Code