Expand description
MathML line-breaking algorithm.
Port of LaTeXML::Post::MathML::Linebreaker (1053 lines of Perl).
Implements line-breaking for long Presentation MathML expressions
by finding optimal breakpoints and inserting <mspace linebreak="newline"/>.
Strategy (from Perl source):
- If top-level has trailing punctuation, remove it to add back later
- Find all layouts that fit within a specified width (top-down)
- Find possible breaks within current node
- Recursively find possible layouts for children
- Pattern of breaks depends on tag (sub/superscripts don’t break)
- Each combination scored by width + penalty
- Apply the best layout’s breaks
Structs§
- Layout
- A single layout option for a MathML subtree.
- Linebreaker
- Line-breaking configuration.