LineBreaker class

Line breaking engine for latex formulas.

Uses penalty-based algorithm inspired by MathJax/KaTeX:

  • spaces have top priority (best break points)
  • relations (=, <, >) have high priority
  • binary operators (+, -) have medium priority
  • multiplicative (×, ÷) have lower priority
  • atomic structures (fractions, matrices) are unbreakable

Break position: operators go to the NEW line (latex convention).

Constructors

LineBreaker(double maxWidth)

Properties

hashCode int
The hash code for this object.
no setterinherited
maxWidth double
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

breakIntoLines(List<LatexNode> nodes, List<double> widths) List<List<int>>
Breaks nodes into lines based on calculated penalties and widths.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

noBreak → const int
penaltyAdditive → const int
penaltyDepthFactor → const int
penaltyMultiplicative → const int
penaltyOtherOp → const int
penaltyRelation → const int
penaltySpace → const int