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:
@@ -4,10 +4,10 @@ This document lists LaTeX features that are **not yet implemented** in SwiftMath
|
||||
|
||||
## Summary
|
||||
|
||||
- **Total Features Tested**: 11
|
||||
- **Fully Implemented**: 6 (55%)
|
||||
- **Total Features Tested**: 12
|
||||
- **Fully Implemented**: 7 (58%)
|
||||
- **Partially Implemented**: 0 (0%)
|
||||
- **Not Implemented**: 5 (45%)
|
||||
- **Not Implemented**: 5 (42%)
|
||||
|
||||
---
|
||||
|
||||
@@ -126,6 +126,25 @@ x \, y \: z \; w % mixed spacing
|
||||
|
||||
---
|
||||
|
||||
### 7b. ✅ `\dfrac` and `\tfrac` - Display/Text Style Fractions - **IMPLEMENTED**
|
||||
**Status**: ✅ Working
|
||||
**Description**: Fractions with forced display or text style
|
||||
|
||||
**Test Results**: All tests passed
|
||||
- `\dfrac{1}{2}` - ✅ Works (display-style fraction)
|
||||
- `\tfrac{a}{b}` - ✅ Works (text-style fraction)
|
||||
- `y'=-\dfrac{2}{x^{3}}` - ✅ Works (complex expression)
|
||||
- Nested `\dfrac` and `\tfrac` - ✅ Works
|
||||
|
||||
**Use Case**:
|
||||
- `\dfrac` forces display style (larger, more readable fractions)
|
||||
- `\tfrac` forces text style (smaller, inline fractions)
|
||||
- Useful when you want consistent fraction appearance regardless of context
|
||||
|
||||
**Implementation**: Prepends style atoms to numerator and denominator to force rendering style.
|
||||
|
||||
---
|
||||
|
||||
### 8. ❌ `\boldsymbol` - Bold Greek Letters
|
||||
**Status**: ❌ Not Implemented
|
||||
**Error**: `Invalid command \boldsymbol`
|
||||
|
||||
Reference in New Issue
Block a user