smart_latex 2.1.0
smart_latex: ^2.1.0 copied to clipboard
Self-contained Flutter LaTeX rendering with bundled KaTeX metrics, input repair, RTL-safe layout, and no extra math package.
2.1.0 - 2026-06-30 #
Added #
- Unicode math conversion in the sanitizer: literal symbols such as
×,÷,≤,≥,π,√,∑,→and the Greek alphabet are converted to their LaTeX commands (\times,\le,\pi, …). Controlled by the newLatexSanitizeOptions.convertUnicodeMathflag (on by default). - Currency detection: a single
$...$pair is only treated as math when it looks like math, so text likeit costs $5 and $10no longer renders as a formula. NewSmartLatexText.detectCurrencyflag (on by default). - Accessibility: rendered formulas now expose a spoken
Semanticslabel. New top-levellatexToSpeech()converts LaTeX to a readable phrase (\frac{a}{b}→ "a over b");SmartMath.semanticLabeloverrides it. - Copy & export:
SmartLatexText.copyableMath/SmartMath.copyablelong-press to copy a formula's LaTeX, and the newcaptureLatexPng()utility (withSmartMath.boundaryKey) renders a formula to PNG bytes for sharing.
Notes #
detectCurrencyandconvertUnicodeMathdefault to on; pass the corresponding flag to restore the previous behaviour.
2.0.2 - 2026-06-30 #
Fixed #
- Documentation and metadata polish for pub.dev analysis (CHANGELOG, doc comment formatting). No functional changes.
2.0.0 - 2026-06-28 #
Breaking / major #
- Self-contained now. The math engine (a layout-fixed copy of
flutter_math_fork, Apache-2.0) is bundled inside the package. You no longer
need to add
flutter_math_forkyourself or apply anydependency_overrides—flutter pub add smart_latexis all that's required. - The bundled engine fixes the upstream
RenderResetDimension does not meet its constraintslayout crash that affected\sqrtnested in\fracwith\left(...\right)delimiters.
See PATCHES.md for the exact changes made to the bundled engine.
1.0.0 - 2026-06-27 #
Initial release.
Widgets #
SmartLatexText— renders a string of mixed plain text and LaTeX. Supports inline ($...$,\(...\)) and display ($$...$$,\[...\]) math, RTL, selectable text, custom error builders, text scaling, and ahideTrailingIncompleteMathflag for streaming / animated text.SmartMath— renders a single LaTeX expression (no surrounding text).
Sanitizer #
sanitizeLatex()repairs common malformed LaTeX:- Double-backslash before command names (
\\right→\right). \sqttypo →\sqrt.- Persian / Arabic digits (۰–۹, ٠–٩) → ASCII.
- Persian decimal/thousands separators (
٫ ٬ ،). - Single-character
\text{0}wrappers → bare characters. - Unbalanced curly braces.
- Double-backslash before command names (
LatexSanitizeOptionslets you enable/disable each rule individually.