← Back

Math Rendering Test — LaTeX & Cartesian Graphs

July 4, 2026

This post tests two new rendering capabilities: LaTeX math notation via KaTeX, and Cartesian graphs via a custom SVG renderer.

Inline math

The quadratic formula is x=b±b24ac2ax = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}, and Euler's identity is eiπ+1=0e^{i\pi} + 1 = 0.

You can also reference variables inline — e.g., given a matrix ARm×nA \in \mathbb{R}^{m \times n}, its rank satisfies rank(A)min(m,n)\text{rank}(A) \leq \min(m, n).

Display math (block equations)

The general form of a Taylor series centered at aa:

f(x)=n=0f(n)(a)n!(xa)nf(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(a)}{n!}(x - a)^n

The Gaussian integral:

ex2dx=π\int_{-\infty}^{\infty} e^{-x^2}\, dx = \sqrt{\pi}

A system of linear equations Ax=bAx = b written out:

(a11a12a13a21a22a23a31a32a33)(x1x2x3)=(b1b2b3)\begin{pmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \end{pmatrix} \begin{pmatrix} x_1 \\ x_2 \\ x_3 \end{pmatrix} = \begin{pmatrix} b_1 \\ b_2 \\ b_3 \end{pmatrix}

Cartesian graphs

A parabola — y=x2y = x^2

-4-2024-3-2-1123(0,0)

Comparing sin(x)\sin(x) and cos(x)\cos(x)

-4-2024-3-2-1123

Blue is sin(x)\sin(x), dashed red is cos(x)\cos(x).

Parametric curve — unit circle

The unit circle is defined parametrically as x(t)=cos(t)x(t) = \cos(t), y(t)=sin(t)y(t) = \sin(t) for t[0,2π]t \in [0, 2\pi]:

-4-2024-3-2-1123

Logistic function — f(x)=11+exf(x) = \frac{1}{1 + e^{-x}}

-4-2024-3-2-1123(0, 0.5)

Mixed content

Gradient descent updates a parameter θ\theta at each step:

θt+1=θtαθL(θt)\theta_{t+1} = \theta_t - \alpha \nabla_\theta \mathcal{L}(\theta_t)

where α\alpha is the learning rate and L\mathcal{L} is the loss function. Below is a simple loss landscape L(θ)=θ2+2\mathcal{L}(\theta) = \theta^2 + 2:

-4-2024-3-2-1123minimum