Add support for dfrac and tfrac LaTeX commands

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.
This commit is contained in:
Nicolas Guillot
2025-11-03 10:23:49 +01:00
parent 43faacf8de
commit d2df078dc9
4 changed files with 191 additions and 4 deletions

View File

@@ -284,7 +284,7 @@ ScrollView {
This is a list of formula types that the library currently supports:
* Simple algebraic equations
* Fractions and continued fractions (including `\cfrac`)
* Fractions and continued fractions (including `\frac`, `\dfrac`, `\tfrac`, `\cfrac`)
* Exponents and subscripts
* Trigonometric formulae
* Square roots and n-th roots