Test: Math Rendering

2 min read

Comprehensive test suite for MathJax rendering with various equation types, LaTeX syntax, and edge cases to verify the markdown pipeline's math processing.

draft: true

Math and LaTeX Rendering Tests

This page tests MathJax rendering with various equation types to ensure our LaTeX post-processing and MathJax configuration work correctly.

Inline Math

Here's some inline math: $E = mc^2$ and $f(x) = x^2 + 2x + 1$.

We can also test Greek letters: $\alpha$, $\beta$, $\gamma$, $\Delta$, $\Omega$.

Block Math

Basic Equations

$ \frac{d}{dx}\left( \int_{0}^{x} f(u) \, du\right) = f(x) $

Matrix Equations

$ \begin{bmatrix} a & b \\ c & d \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix} = \begin{bmatrix} ax + by \\ cx + dy \end{bmatrix} $

Summations and Products

$ \sum_{i=1}^{n} i = \frac{n(n+1)}{2} $
$ \prod_{i=1}^{n} i = n! $

Machine Learning Equations

Loss Function:

$ \mathcal{L}(\theta) = \frac{1}{m} \sum_{i=1}^{m} \left( h_\theta(x^{(i)}) - y^{(i)} \right)^2 $

Softmax Function:

$ \text{softmax}(z_i) = \frac{e^{z_i}}{\sum_{j=1}^{K} e^{z_j}} $

Attention Mechanism:

$ \text{Attention}(Q, K, V) = \text{softmax}\left(\frac{QK^T}{\sqrt{d_k}}\right)V $

Complex Equations with Multiple Lines

$ \begin{align} \nabla \cdot \mathbf{E} &= \frac{\rho}{\epsilon_0} \\ \nabla \cdot \mathbf{B} &= 0 \\ \nabla \times \mathbf{E} &= -\frac{\partial \mathbf{B}}{\partial t} \\ \nabla \times \mathbf{B} &= \mu_0\mathbf{J} + \mu_0\epsilon_0\frac{\partial \mathbf{E}}{\partial t} \end{align} $

Fractions and Nested Expressions

$ f(x) = \frac{1}{\sqrt{2\pi\sigma^2}} e^{-\frac{(x-\mu)^2}{2\sigma^2}} $

Underscores Test (Fixed by LaTeX Post-Processing)

These should render correctly with normal underscores:

$ \theta_1, \theta_2, \ldots, \theta_n $
$ x_{i,j} = \sum_{k=1}^{n} a_{i,k} \cdot b_{k,j} $

Custom Commands Test

Testing argmin and argmax (should work with our MathJax config):

$ \hat{\theta} = \argmin_{\theta} \mathcal{L}(\theta) $
$ x^* = \argmax_{x \in \mathcal{X}} f(x) $

Vector Notation

$ \vec{v} = \begin{bmatrix} v_1 \\ v_2 \\ v_3 \end{bmatrix} $
$ \|\vec{a} - \vec{b}\|_2 = \sqrt{\sum_{i=1}^{n} (a_i - b_i)^2} $

Equation Numbering Test

The following equations should be numbered automatically:

$ F = ma \tag{1} $
$ PV = nRT \tag{2} $
$ \Delta S \geq 0 \tag{3} $

Mixed Content Test

Here's a paragraph with inline math $\int_0^\infty e^{-x} dx = 1$ followed by a block equation:

$ \lim_{n \to \infty} \left(1 + \frac{1}{n}\right)^n = e $

And then more text with $\sin^2(x) + \cos^2(x) = 1$ to ensure proper rendering.

Copyright 2025, Ran DingPrivacyTerms
Test: Math Rendering