Advance native LaTeX execution and preview
This commit is contained in:
1 parent
91f9d76b16
commit
2741546ca8
414 files changed
+99872
-933
No files matched your search
@@ -0,0 +1,211 @@
|
||||
# Native math tokens, noads and penalties — 2026-11-01
|
||||
|
||||
2026-11-03: [W2-S4 native math font programs and operators](NATIVE_MATH_PROGRAMS.md)
|
||||
now execute actual two-pass noad ligature/kern, script transfers, math_text_char,
|
||||
limits/nolimits/displaylimits and one-step display variants with actual rebox.
|
||||
1311 workspace tests, 4562 independent INITEX DVI pages and full release gates
|
||||
pass. Native format boot remains false (kernel529 overfullrule/full-entry
|
||||
pdfoutput); real NFSS/article and W3–W7 remain open. Earlier slice counts and
|
||||
unsupported-math-ligature/operator notes below are historical.
|
||||
Subsequent box/list diagnostic acceptance (2026-11-01): [native inspection](NATIVE_BOX_DIAGNOSTICS.md)
|
||||
consumes actual showboxbreadth/showboxdepth and original nodes/settings in real
|
||||
log/terminal output. Full workspace: 1200 passed / 0 failed; 152 exact recursive
|
||||
lists, 24 paragraph lists, 24 byte-printer cases, 17 CLI tests and five-show/
|
||||
19-word PDF gate pass. Unchanged LaTeX stops at errorcontextlines (526:1), full
|
||||
startup false. Compound math/glue inspection and full interaction remain open.
|
||||
Earlier counts/boundaries below are historical; no font/template fidelity claim.
|
||||
|
||||
Subsequent delimiter acceptance (2026-11-01): [native delimiter fields and construction](NATIVE_DELIMITERS.md)
|
||||
now consumes real delcodes, left/right fields, factor/shortfall and actual TFM
|
||||
variants/extensible recipes. Full workspace: 1195 passed / 0 failed; 452 exact
|
||||
DVI cases, code/group readbacks, a 61-word PDF and full-delimiter ink gate pass.
|
||||
Generic odd-sp fraction/reboxing rounding is corrected. Unchanged LaTeX stops
|
||||
at showboxbreadth (524:1), full startup false. Earlier counts, boundaries and
|
||||
unimplemented-left/right/delimiter notes below are historical.
|
||||
|
||||
Subsequent font-state/accent acceptance (2026-11-01): [native font integers and accents](NATIVE_FONT_STATE_ACCENTS.md)
|
||||
now consumes real first-load defaultskewchar and globally mutable skewchar/
|
||||
hyphenchar in actual mathaccent/discretionary/hyphenation construction. Full
|
||||
workspace: 1191 passed / 0 failed, 438 accent DVI geometry and 28 mutable-hyphen
|
||||
timing cases, a 54-word PDF and full-accent ink gate. Unchanged LaTeX stops at
|
||||
delimiterfactor (523:1), with full format boot still false. Earlier boundaries,
|
||||
counts and unimplemented-accent/font-integer notes below are historical.
|
||||
|
||||
Subsequent font-slot acceptance (2026-11-01): [native font diagnostics](NATIVE_FONT_DIAGNOSTICS.md)
|
||||
now consumes tracinglostchars/tracingonline using actual TFM/Type1 slots, with
|
||||
real font predicates, log/terminal delivery and fatal PDF protection. Full
|
||||
workspace: 1187 passed / 0 failed; prior slice gates remain green. Unchanged
|
||||
LaTeX now stops at defaultskewchar (522:1), so earlier boundaries/counts on
|
||||
this page are historical. Full format startup remains false.
|
||||
|
||||
Current follow-up (2026-11-01): [native display math](NATIVE_DISPLAY_MATH.md)
|
||||
is accepted: 1182 workspace tests, 58 vlist / 36 page / 24 quantity-mode-pack
|
||||
cases and a three-page PDF gate. Unchanged LaTeX now stops at tracinglostchars
|
||||
(508:1). Earlier counts/boundaries below describe their original slices.
|
||||
|
||||
Current follow-up (2026-11-01): [native interline penalties](NATIVE_INTERLINE_PENALTIES.md)
|
||||
are accepted: 1176 workspace tests, 100 vlist and 64 actual page-ownership cases;
|
||||
unchanged LaTeX now stops at displaywidowpenalty (502:1). Earlier acceptance
|
||||
counts/boundaries below describe their original slices, not current startup.
|
||||
|
||||
The strict Route-D token executor now constructs inline mathematical lists,
|
||||
converts owned noads into actual horizontal material, and supplies binop/rel
|
||||
penalties to the paragraph breaker. This is a native execution slice, not a
|
||||
LaTeX command/string recognizer, AST adapter or fallback to v1.
|
||||
|
||||
## Token, mode and state ownership
|
||||
|
||||
execution/math.rs owns MathChar, MathField, Noad, MathNode and NativeMath;
|
||||
engine/math.rs consumes expanded tokens and manages math field/group frames.
|
||||
Math shift and script categories are read from the lazy mouth. No saved token
|
||||
is retokenized. Ordinary macro definitions/expansion and scoped assignments
|
||||
continue to execute through the existing core.
|
||||
|
||||
- mathcode is a scoped 8-bit code table with real INITEX defaults: digits are
|
||||
variable-family class 7/family 0, ASCII letters class 7/family 1, other byte
|
||||
characters class 0 with their own slot. Class 7 consults actual fam and becomes
|
||||
an ordinary noad. Code 0x8000 dispatches the actual active-character meaning.
|
||||
- mathchar and existing mathchardef use actual class/family/slot bits;
|
||||
char/chardef in math consult the character's mathcode. A plus/equal sign is
|
||||
not classified by its spelling. Macros can supply any of these tokens.
|
||||
- Inline math establishes math-shift group 15 and locally resets fam to -1;
|
||||
brace/field groups are group 9. ifmmode/ifinner/ifhmode/ifvmode read the actual
|
||||
mode. Field scanning, duplicate/missing scripts, unmatched shifts/groups and
|
||||
invalid math-only commands produce strict diagnostics. Mathematical mode
|
||||
cannot borrow the enclosing paragraph's spacefactor.
|
||||
- Superscript/subscript fields, grouped lists, explicit mathord/mathop/mathbin/
|
||||
mathrel/mathopen/mathclose/mathpunct/mathinner, style nodes, mskip/mkern,
|
||||
ordinary kern/penalty and generalized bar/no-bar over/atop execute natively.
|
||||
Text-style operators support actual centering and side scripts. Display
|
||||
operator variants/limits remain explicitly unsupported.
|
||||
|
||||
New scoped consumers include binoppenalty, relpenalty, fam, scriptspace,
|
||||
nulldelimiterspace, mathsurround and thin/med/thickmuskip. The new parameters
|
||||
have actual INITEX zero defaults; rendering drivers explicitly configure them.
|
||||
Mu parameters use native typed muskips, arithmetic and mu printing/unit checks.
|
||||
Mathcode/fam are consumed while scanning fields; fonts, glue and penalties are
|
||||
resolved at actual list conversion before math-group restoration. An assignment
|
||||
late in a formula can therefore affect earlier noads as TeX specifies.
|
||||
|
||||
## Real mathematical fonts and shared geometry
|
||||
|
||||
font now recognizes the ten real bundled CM design-size resources: CMR10/7/5,
|
||||
CMMI10/7/5, CMSY10/7/5 and CMEX10. at must name the actual design size; scaled
|
||||
1000 is supported. Other resources/sizes still error. Ordinary native text
|
||||
shaping remains the CMR10 10pt slice; math font resources do not silently turn
|
||||
into CMR10 text. Spaces use the selected resource's real font dimensions.
|
||||
|
||||
textfont/scriptfont/scriptscriptfont assign actual font selectors to any of 16
|
||||
families, with local/global/globaldefs restoration. INITEX families are nullfont;
|
||||
there is no automatic CM setup. Conversion verifies the actual symbol/extension
|
||||
font parameter counts at all three sizes and resolves each field from its real
|
||||
family. Changing a family to a supported different font/master changes metrics,
|
||||
styles and the font/slot painted. Font identifiers as expandable tokens and full
|
||||
indirect font-identifier scanning are not implemented yet.
|
||||
|
||||
The existing math_engine_tex geometry now exposes shared script/fraction
|
||||
placement helpers accepting actual MathParams from the assigned TFM resources.
|
||||
Native execution passes real scriptspace/null-delimiter state. It does not
|
||||
construct a source string or call the old MathAtom parser. Native geometry
|
||||
retains raw Type1 slots, exact CM optical master identities and rule positions.
|
||||
PDF/SVG consume the measured results with one sp-to-bp conversion.
|
||||
|
||||
Latin math font descriptor ascent/descent/cap height are now derived from the
|
||||
actual master's TFM d/p/H metrics. Previously the outline FontBBox was reused as
|
||||
Ascent, causing a 0.558bp extracted-word-box mismatch despite identical SVG
|
||||
baselines. This correction changes metadata, not glyph positions. Full PDF
|
||||
metadata/encoding coverage, especially symbol/extension descriptors and unmapped
|
||||
ToUnicode slots, is still open; an unmapped label does not substitute the glyph.
|
||||
|
||||
Mathematical field clean boxes and the first-pass noad extent checks use the
|
||||
actual native natural hpack, updating last_badness from its real result. An
|
||||
independent INITEX state probe checks that empty math preserves the preceding
|
||||
overfull result while ordinary/script math updates it through actual packing.
|
||||
BuiltMath records the horizontal pack count and last pack result.
|
||||
|
||||
## Actual horizontal penalties and breaks
|
||||
|
||||
The converter first mutates owned noads in actual TeX processing order, including
|
||||
binary cancellation and make_ord ligature/kern/script transfer. BuiltMath.noads
|
||||
and effective_classes describe the same surviving list. The second pass uses
|
||||
the 8x8 spacing table and actual style/family-2 quad and mu glues. math_text_char
|
||||
retains the real font-space rule for italic correction; no text shaper is used.
|
||||
|
||||
Automatic penalties are generated only for the outer inline list in ordinary
|
||||
horizontal mode. Restricted hbox math and recursive group/script/fraction lists
|
||||
suppress them. After an effective Bin/Rel noad, the corresponding current
|
||||
parameter is appended if below 10000, unless the immediate next node is absent,
|
||||
a relation noad or an explicit penalty. Explicit penalties remain actual list
|
||||
nodes. Scripts do not create additional automatic breaks.
|
||||
|
||||
MathBoundary nodes carry actual mathsurround and turn paragraph auto-breaking
|
||||
off/on around math. Interior math glue/kerns cannot bypass prohibited breaks;
|
||||
actual explicit/generated penalties still participate in native line breaking.
|
||||
Math end can break before following glue under TeX's boundary rules. Measured
|
||||
math nodes flow through hpack/vpack, box registers and the same page/display
|
||||
export as ordinary text. BuiltMath records retain noads, effective classes,
|
||||
parameter snapshots, generated material and spans for audit; they are not cache
|
||||
validity proofs or a portable fmt.
|
||||
|
||||
## Acceptance
|
||||
|
||||
- Six math integration tests contain **117 real pdfTeX INITEX geometry/list
|
||||
cases** (at most 1sp dimension error) and **88 actual paragraph break cases**.
|
||||
They cover all 64 class pairs, binary cancellation, repeated relations,
|
||||
explicit penalty suppression, grouping, mathcodes/active meanings, scripts,
|
||||
fractions/styles, actual family replacements, mu glue, parameter timing and
|
||||
mathsurround at text/math boundaries. Penalties 10000, ordinary and forced
|
||||
values visibly change line breaks; math glue does not bypass the prohibition.
|
||||
- Strict errors cover null/inadequate families, math/group/script mismatches,
|
||||
out-of-range indices/codes, unsupported display/boxed math, math-spacefactor
|
||||
reads and resource limits. Trusted execution snapshots round-trip with the
|
||||
real noad/family state and source dependencies.
|
||||
- Native and real pdfTeX math.tex both yield one page and **100 words in the
|
||||
same order**. Maximum word-box errors: xMin 0.004909, xMax 0.012033,
|
||||
yMin 0.000278, yMax 0.000078bp, below the unchanged 0.02bp gate.
|
||||
- Complete workspace: **1171 passed / 0 failed**, including thirteen CLI tests
|
||||
(native_execution 10, native_job_io 3). The existing 205 box, 119 paragraph,
|
||||
90 token, 101 quantity and 12 filesystem comparisons plus shipout oracle
|
||||
remain covered. Release/fmt/diff and math D absolute-position/ink gates pass.
|
||||
|
||||
~~~sh
|
||||
cargo test -p texrra-tex-core --offline --test execution_math -- --nocapture
|
||||
cargo test --workspace --offline -- --test-threads=1
|
||||
cargo build --release --offline
|
||||
python scripts/check-native-paragraphs.py --binary target/release/texrra \
|
||||
--fixture examples/native-bootstrap/math.tex \
|
||||
--output-dir /tmp/texrra-native-math/math \
|
||||
--json /tmp/texrra-native-math/math/pdf-oracle.json
|
||||
python scripts/probe-native-format.py --binary target/release/texrra \
|
||||
--texmf /usr/share/texlive/texmf-dist \
|
||||
--json /tmp/texrra-native-math/format-probe-final.json
|
||||
~~~
|
||||
|
||||
The PDF checker resolves native input from the actual fixture path and gives
|
||||
reference TeX the fixture's input directory. It does not rewrite the fixture's
|
||||
local font driver. Its entry hash is not a certified complete dependency closure.
|
||||
Evidence: /tmp/texrra-native-math/ (math/paragraph/box PDFs and audits, raster,
|
||||
format-probe-final.json, arxiv-regression.pdf and math-regression.json).
|
||||
Final logs: /tmp/texrra-native-math-accepted-workspace.log and
|
||||
/tmp/texrra-native-math-accepted-release.log.
|
||||
|
||||
## Real format startup and next work
|
||||
|
||||
The unchanged SHA-pinned LaTeX2e 2025-11-01 entry advances from binoppenalty at
|
||||
498:1 through relpenalty to **500:1, missing clubpenalty**. Auxiliary job time/date
|
||||
write/read and directory checks still execute. format_boot_passed remains false.
|
||||
No format source, guard or version marker was changed to advance the boundary.
|
||||
|
||||
Next implement real paragraph-to-vertical interline/club/widow/broken penalties
|
||||
and page-break consumers, then native display transitions with the actual
|
||||
before/after penalties/skips. Do not register these as inert initialization
|
||||
values. Native display math, delimiter/radical/accent/mathchoice/limits,
|
||||
full ligature/reboxing and generalized fraction/glue coverage, boxed math fields,
|
||||
whatsits/output/shipout, complete fonts/encoding/NFSS and native format images
|
||||
remain open. The tested CM fraction subset is not full generalized math coverage.
|
||||
|
||||
Only the strict native CLI uses this execution slice; HTTP/project endpoints
|
||||
still use the transitional frontend. Their existing math D geometry remains a
|
||||
separate accepted gate and is not a native display-mode fallback. Font closure,
|
||||
unchanged real format/minimal article execution, resumable mode/list checkpoints
|
||||
and realtime performance still gate the final v1 replacement.
|
||||
Reference in new issue
Block a user