diff --git a/crates/texrra-tex-core/tests/oracle.rs b/crates/texrra-tex-core/tests/oracle.rs index c6f64a0..cf7418f 100644 --- a/crates/texrra-tex-core/tests/oracle.rs +++ b/crates/texrra-tex-core/tests/oracle.rs @@ -421,6 +421,24 @@ fn tolerance_10000_matches_pdftex() { } } +/// A narrow measure exercises TeX's `\pretolerance` pass: loose one-word +/// lines are feasible there, so the breaker must not hyphenate them itself. +#[test] +fn narrow_measure_pretolerance_matches_pdftex() { + let text = "hyphenation demonstrates discretionary representation according extraordinary understanding"; + for width in [70, 85] { + compare_fixture_with( + text, + width, + "\\pretolerance=10000 \\tolerance=200 ", + |style| { + style.pretolerance = 10_000; + style.tolerance = 200; + }, + ); + } +} + /// `\hyphenpenalty=10000` makes hyphenation illegal, so the final pass keeps /// overfull lines instead. #[test] diff --git a/docs/ROUTE_D_PLAN.md b/docs/ROUTE_D_PLAN.md index 5f0382a..a25d1af 100644 --- a/docs/ROUTE_D_PLAN.md +++ b/docs/ROUTE_D_PLAN.md @@ -48,7 +48,7 @@ floats (`\floatsep`, `\textfloatsep`, `\intextsep`, `\topfraction`, `\bottomnumber`, `\totalnumber`), insertion classes (`\skip`, fraction and absolute limits, splitting), marks, Rust output hook, multi-page PDF, and the route-D service endpoints (`/api/route-d/preview|pdf|edit`, project preview and -PDF opt-in with `?engine=route-d`). 466 workspace tests are green and no oracle +PDF opt-in with `?engine=route-d`). 467 workspace tests are green and no oracle fixture is ignored. Known gaps, in dependency order: @@ -245,10 +245,9 @@ lines outside the emergency pass, exactly like TeX, so `\tolerance` cannot smuggle in a single overfull line any more. Hyphenated breaks are checked at 80-120pt, and a 70/85pt fixture sets `\doublehyphendemerits` and `\finalhyphendemerits` to 0 and 10000 so both demerits change the reference -breaks; at `\tolerance=10000` the wide-measure fixture now matches pdfLaTeX at -100-240pt, but narrow measures (70/85pt) still pick different hyphenated -breaks because the demerits optimum differs; that stays documented as a -known approximation. +breaks; at `\tolerance=10000` the wide-measure fixture matches pdfLaTeX at +100-240pt, and a 70/85pt fixture with `\pretolerance=10000 \tolerance=200` +matches the loose one-word lines TeX keeps before enabling hyphenation. Bottom floats have two page fixtures: one where the float fits, and one where it does not fit the remaining body space. In both cases the page diff --git a/docs/TEX_CORE.md b/docs/TEX_CORE.md index e545c40..9d1833c 100755 --- a/docs/TEX_CORE.md +++ b/docs/TEX_CORE.md @@ -94,9 +94,10 @@ final line held at its declared shrink limit), 130-160pt the final-pass overfull box, and 180-240pt ordinary tolerance solutions. Two further fixtures pin register behaviour at 120pt: `\pretolerance=10000` stops before hyphenation and `\hyphenpenalty=10000` inhibits it, leaving the overfull first-fit lines TeX produces. A -`\tolerance=10000` fixture matches pdfLaTeX at 100-240pt; at very narrow -measures (70/85pt) the demerits optimum still picks different hyphenated -breaks, which stays documented as a known approximation. Hyphenated paragraphs are compared at 80, 100 and 120pt, and a +`\tolerance=10000` fixture matches pdfLaTeX at 100-240pt, and a 70/85pt +fixture with `\pretolerance=10000 \tolerance=200` confirms that the +pretolerance pass keeps loose one-word lines before hyphenation is +considered. Hyphenated paragraphs are compared at 80, 100 and 120pt, and a 70/85pt fixture runs with `\doublehyphendemerits` and `\finalhyphendemerits` at 0 and 10000 so the reference breaks change with the demerits. A 120pt fixture with `\hangindent=20pt \hangafter=1` checks every line origin @@ -366,7 +367,7 @@ Math coverage includes fractions/roots, scripts, `\left...\right` with body-scal Paragraph units carry a `ParagraphFont`; `Unit::paragraph_with_face` and `Unit::paragraph_with_style_and_face` select Roman, bold, italic, mono, or sans. The corresponding Computer Modern TFM (`cmr10`, `cmbx10`, `cmti10`, `cmbxti10`, `cmtt10`, `cmss10`) supplies advances, kerns, ligatures, and italic correction for layout, while the display list and PDF select the matching Liberation face. `Engine::edit` preserves the face when reflowing an edited paragraph. -The crate currently has 310 unit tests plus seven route-D integration tests and thirty-four oracle fixtures. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 466 tests (310 route-D unit, 7 route-D integration, 34 oracle, 71 v1 integration, 26 server, 4 v1 unit, 1 core unit, 13 binary units), with none ignored. v1 remains the live server path. +The crate currently has 310 unit tests plus seven route-D integration tests and thirty-five oracle fixtures. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 467 tests (310 route-D unit, 7 route-D integration, 35 oracle, 71 v1 integration, 26 server, 4 v1 unit, 1 core unit, 13 binary units), with none ignored. v1 remains the live server path. ### M0 incremental demo