val_latex 0.1.0
val_latex: ^0.1.0 copied to clipboard
LaTeX math typesetting in pure Dart: a TeX parser, macros, TeX layout with line breaking and right-to-left math, OpenType math fonts, and speech output.
0.1.0 #
First release.
val_latex typesets LaTeX math in pure Dart. It runs anywhere Dart runs —
the VM, Flutter on every platform, servers and the web — and is the shared
core of val_latex_flutter.
Added #
- Parser —
parseLatexturns LaTeX math into an immutable syntax tree where every node carries its source span. It never throws for bad input: problems become error nodes andDiagnostics, and unfinished input is incomplete, so streaming text renders as far as it goes. - 3,882 commands and 68 environments — LaTeX and AMS math, mathtools,
the physics package, mhchem (
\ce,\pu), siunitx, diffcoeff, commath, nccmath, empheq, unicode-math names, stmaryrd and wasysym symbols, text tables and lists.LatexCataloglists them all. - Macros —
\def,\newcommand,\DeclareMathOperatorand more, with TeX group scoping, shareable across formulas withnewMacroTable(). - TeX layout —
layoutFormulaandrenderLatexfollow the TeXbook's Appendix G and the OpenTypeMATHtable, and produce a render-agnostic display list. - Fonts — Latin Modern Math bundled, STIX Two Math as the fallback;
any OpenType math font with
MathFont.fromBytes, variable fonts at any axis values. - Line breaking —
LayoutOptions.maxWidth;prepareFormulalays out once and re-breaks for each width. - Right-to-left math — Arabic notation, Arabic-Indic and Persian digits.
- Text with formulas —
MathScannerfinds$…$,$$…$$,\(…\)and\[…\]in text. - Outputs —
toLatex(normalised source) andtoSpeech(spoken math in eight languages, six of them drafts). - Hit testing and selection —
hitTestLayout,selectionUnits. - Background layout —
layoutInBackgroundin a worker isolate. - Third-party notices —
valLatexNoticesandTHIRD_PARTY_NOTICES.mdcredit the work val_latex contains.