val_latex
0.1.4, released 2 weeks ago by useval.io
LaTeX math parser and layout engine in pure Dart with OpenType fonts.
$ flutter pub add val_latexWhat it does
Parses and lays out LaTeX mathematical formulas in pure Dart without native code or web views. Supports line breaking, right-to-left math, speech output, and OpenType math fonts.
AI-written summary of version 0.1.4, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to render LaTeX math formulas in pure Dart or across all Flutter platforms without WebViews.
- You are building an LLM streaming chat interface that needs to render incomplete mathematical formulas safely.
- You need formula layout measurements or speech output in non-Flutter or Flutter environments.
Skip it when
- You need full, general-purpose HTML/CSS document rendering rather than math typesetting.
Strengths
- Pure Dart implementation runs anywhere Dart runs (VM, Flutter, server, web).
- Never throws on bad input, gracefully handling unfinished LLM streams or diagnostics.
- Supports broad LaTeX coverage including amsmath, physics, and chemistry packages.
Weaknesses
- Requires an additional companion package (`val_latex_flutter`) to get Flutter widgets like `Math` and `MathText`.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
Add val_latex to your pubspec.yaml via dart pub add val_latex.
import 'package:val_latex/val_latex.dart';
final result = parseLatex(r'x = \frac{-b \pm \sqrt{b^2-4ac}}{2a}');
final layout = layoutFormula(result);Alternatives
Packages that do the same job and could replace val_latex.
- flutter_math_fork
Fast and high-quality TeX math equation rendering with pure Dart and Flutter.
69Compare - flutter_html_math
Renders <math> tags in flutter_html using flutter_math_fork.
56Compare - flutter_tex_js
Render TeX to PNG using KaTeX in a native WebView
62Compare - swipe
Detect swipe gestures in all four directions in Flutter.
43Compare
Works with
Packages commonly used together with val_latex: ones it builds on, ones built on it, and its own family.
- charactersval_latex depends on itUnicode and grapheme cluster aware string manipulation operations for Dart.
- val_highlight_flutterSame familyFlutter widgets for displaying and editing syntax-highlighted code.
- val_highlightSame familySyntax highlighter in pure Dart for 55 languages, themes, incremental updates, and HTML output.
- val_latex_flutterBuilt on val_latexRender LaTeX math formulas, inline math, and Markdown with math in Flutter.