Issue Description
Mathematical formulas using block LaTeX syntax \[ \] are not rendering properly. Specifically, formulas 10-20 in a list of mathematical expressions fail to render, while formulas 1-9 render correctly.
Environment
- Platform: iOS/macOS (SwiftUI)
- MarkdownView: Latest version
Sample Code
ScrollView {
MarkdownView(markdownText)
.markdownMathRenderingEnabled()
}
Problematic Markdown Content
The following markdown content shows the issue - formulas 1-9 render correctly, but formulas 10-20 do not render:
1. **Quadratic Formula**:
\[ x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \]
2. **Pythagorean Theorem**:
\[ a^2 + b^2 = c^2 \]
3. **Area of a Circle**:
\[ A = \pi r^2 \]
4. **Circumference of a Circle**:
\[ C = 2\pi r \]
5. **Area of a Triangle**:
\[ A = \frac{1}{2}bh \]
6. **Volume of a Sphere**:
\[ V = \frac{4}{3}\pi r^3 \]
7. **Volume of a Cylinder**:
\[ V = \pi r^2 h \]
8. **Euler's Formula** (for complex numbers):
\[ e^{ix} = \cos x + i\sin x \]
9. **Slope of a Line**:
\[ m = \frac{y_2 - y_1}{x_2 - x_1} \]
10. **Distance Formula**:
\[ d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2} \]
11. **Midpoint Formula**:
\[ M = \left(\frac{x_1 + x_2}{2}, \frac{y_1 + y_2}{2}\right) \]
12. **Logarithm Rule**:
\[ \log_b(xy) = \log_b x + \log_b y \]
13. **Compound Interest Formula**:
\[ A = P\left(1 + \frac{r}{n}\right)^{nt} \]
14. **Binomial Theorem**:
\[ (a + b)^n = \sum_{k=0}^{n} \binom{n}{k} a^{n-k} b^k \]
15. **Sum of an Arithmetic Series**:
\[ S_n = \frac{n}{2}(a + l) \]
16. **Sum of a Geometric Series**:
\[ S_n = a \frac{1-r^n}{1-r} \] (for \( r \neq 1 \))
17. **Law of Sines**:
\[ \frac{\sin A}{a} = \frac{\sin B}{b} = \frac{\sin C}{c} \]
18. **Law of Cosines**:
\[ c^2 = a^2 + b^2 - 2ab \cos C \]
19. **Derivative of a Function**:
\[ f'(x) = \lim_{h \to 0} \frac{f(x+h) - f(x)}{h} \]
20. **Integral of a Function**:
\[ \int f(x) \, dx = F(x) + C \]
Expected Behavior
All mathematical formulas (1-20) should render properly as formatted math expressions.
Actual Behavior
- Formulas 1-9: Render correctly ✅
- Formulas 10-20: Do not render (appear as raw LaTeX code or fail to display) ❌
Observations
-
Pattern: The issue seems to start specifically at formula #10 and affects all subsequent formulas
-
Syntax: All formulas use the same block math syntax \[ \]
-
Complexity: The non-rendering formulas include various LaTeX elements:
- Square roots:
\sqrt{}
- Fractions with parentheses:
\left(\frac{}{}\right)
- Subscripts in logarithms:
\log_b
- Summation notation:
\sum_{k=0}^{n}
- Limits:
\lim_{h \to 0}
- Integrals:
\int
- Mixed inline/block: Formula 16 has both block
\[ \] and inline \( \) math
-
Position dependency: The issue appears to be position-dependent rather than content-dependent, as similar mathematical expressions work in positions 1-9 but fail in positions 10-20.
Issue Description
Mathematical formulas using block LaTeX syntax
\[\]are not rendering properly. Specifically, formulas 10-20 in a list of mathematical expressions fail to render, while formulas 1-9 render correctly.Environment
Sample Code
Problematic Markdown Content
The following markdown content shows the issue - formulas 1-9 render correctly, but formulas 10-20 do not render:
Expected Behavior
All mathematical formulas (1-20) should render properly as formatted math expressions.
Actual Behavior
Observations
Pattern: The issue seems to start specifically at formula
#10and affects all subsequent formulasSyntax: All formulas use the same block math syntax
\[\]Complexity: The non-rendering formulas include various LaTeX elements:
\sqrt{}\left(\frac{}{}\right)\log_b\sum_{k=0}^{n}\lim_{h \to 0}\int\[\]and inline\(\)mathPosition dependency: The issue appears to be position-dependent rather than content-dependent, as similar mathematical expressions work in positions 1-9 but fail in positions 10-20.