Extends the width-checking pattern from fractions/radicals to ALL remaining
complex atom types, completing Priority 1 of the multiline implementation.
Changes:
- Large operators (∑, ∫, ∏): Now stay inline with height+width checking
(breaks only if height > fontSize * 2.5 OR width exceeds constraint)
- Delimiters (\left...\right): Stay inline with maxWidth propagation to
inner content for proper nested wrapping
- Colors (.color, .textcolor, .colorBox): All 3 types now stay inline with
maxWidth propagation for proper nested wrapping
- Matrices/tables: Small matrices can now stay inline with surrounding content
- Width constraint propagation: All recursive createLineForMathList() calls
now properly pass maxWidth parameter
Impact:
Before: Complex atoms always forced line breaks, even when they fit
After: ALL complex atoms intelligently stay inline when width permits
Examples:
- a + ∑ xᵢ + b → 1 line instead of 3
- (a+b) + \left(\frac{c}{d}\right) + e → stays inline with wrapping
Implement smart width-checking for complex mathematical displays to enable
inline rendering when space permits, dramatically improving multiline layout.
Changes:
- Add shouldBreakBeforeDisplay() helper to check width before line breaks
- Add performLineBreak() helper for clean line transitions
- Modify fraction handling to stay inline when they fit within maxWidth
- Modify radical handling to stay inline when they fit within maxWidth
- Support radicals with degrees (cube roots, nth roots, etc.)
Add display-style (dfrac) and text-style (tfrac) fraction commands
to SwiftMath's LaTeX parser. These commands force fractions to render
in specific styles regardless of context.
Implementation:
- Add dfrac parsing to prepend displaystyle to numerator/denominator
- Add tfrac parsing to prepend textstyle to numerator/denominator
- Implement in both parser functions in MTMathListBuilder.swift
Testing:
- Add testDisplayStyleFraction() for dfrac validation
- Add testTextStyleFraction() for tfrac validation
- Add testDisplayAndTextStyleFractions() for complex expressions
- All 180 tests pass on macOS and iOS simulator
Documentation:
- Update MISSING_FEATURES.md (7/12 features now implemented, 58%)
- Update README.md feature list to include dfrac and tfrac
Fixes issue where equations like y'=-\dfrac{2}{x^{3}} would fail to
parse with "Invalid command dfrac" error. This was blocking the
StepByStep feature preview rendering.