Test file for rendering TeX math within Markdown files

test file
Test file for rendering TeX math within Markdown files

TeX Test

Simple Math Rendering Test

This is a minimal test note for TeX math rendering.

1) Inline Math

  • \(E=mc^2\)
  • \(\sqrt{x^2+1}\)
  • \(\frac{a}{b}\)
  • \(\Psi, \psi, \Phi, \phi\)

2) Display Math

$$E=mc^2$$

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

$$\begin{pmatrix}1 & 2 \\ 3 & 4\end{pmatrix}$$

3) Mixed Text + Math

The roots of \(x^2-6x+4=0\) are:

$$x=\frac{6\pm\sqrt{36-16}}{2}$$

So approximately \(x\approx 0.8\) or \(x\approx 5.2\).

4) TeX in a fenced block

$$ f(x)= \begin{cases} x^2, & x \ge 0 \\ -x, & x < 0 \end{cases} $$

5) Edge cases (should stay as plain text)

  • The price is $10.50
  • echo “Price: $100”
  • ``const price = `$${amount}```
  • color: $primary-color

Advanced TeX + Markdown Stress Test

This note mixes inline math, display math, aligned equations, matrices, piecewise functions, integrals, sums, limits, and edge-case text.

1) Inline Math

  • Energy relation: $E=mc^2$
  • Euler identity: $e^{i\pi}+1=0$
  • Binomial coefficient: $\binom{n}{k}=\frac{n!}{k!(n-k)!}$
  • Vector norm: $\lVert x\rVert_2=\sqrt{\sum_{i=1}^n x_i^2}$
  • Conditional probability: $P(A\mid B)=\frac{P(A\cap B)}{P(B)}$
  • Greek + operators: $\alpha,\beta,\gamma,\Gamma,\Delta,\Omega,\nabla,\partial,\infty,\pm,\times,\cdot$

2) Display Math

$$\sum_{k=1}^{n}k=\frac{n(n+1)}{2}$$

$$\int_0^1 x^2,dx=\frac{1}{3}$$

$$\lim_{x\to 0}\frac{\sin x}{x}=1$$

$$\prod_{i=1}^{m}\prod_{j=1}^{n} a_{ij}$$

3) Multi-line / Aligned

$$ \begin{aligned} (a+b)^2 &= a^2 + 2ab + b^2 \ (a-b)^2 &= a^2 - 2ab + b^2 \ a^2-b^2 &= (a-b)(a+b) \end{aligned} $$

4) Piecewise + Text

$$ f(x)= \begin{cases} x^2, & x \ge 0 \ -x, & x < 0 \end{cases} \qquad \text{and}\qquad g(x)= \begin{cases} \sin x, & |x|\le \pi \ 0, & \text{otherwise} \end{cases} $$

5) Matrices + Determinants

$$A=\begin{bmatrix}1&2&3\0&1&4\5&6&0\end{bmatrix}$$

$$B=\begin{pmatrix}a&b\c&d\end{pmatrix},\quad \det(B)=\begin{vmatrix}a&b\c&d\end{vmatrix}=ad-bc$$

$$\operatorname{tr}(A)=1+1+0=2$$

6) Calculus / Differential Equations

$$\frac{d}{dx}\left(e^{x^2}\right)=2x e^{x^2}$$

$$\frac{\partial u}{\partial t}=\kappa \frac{\partial^2 u}{\partial x^2}$$

7) Number Theory / Logic

Congruence: $a\equiv b\pmod n$

Prime set: $\mathbb{P}={p\in\mathbb{N}:p\text{ is prime}}$

Quantifiers: $\forall x\in\mathbb{R}\ \exists y\in\mathbb{R}: y>x$

8) Markdown + Math in same paragraph

For $x>0$, define $h(x)=\ln x$.

Then $h’(x)=\frac{1}{x}$, and by Taylor expansion near $x=1$: $$\ln(1+u)=u-\frac{u^2}{2}+\frac{u^3}{3}-\cdots,\quad |u|<1$$.

9) TeX in fenced block (language tag only)

$$\left.\frac{\partial T}{\partial P}\right|_s=\left.\frac{\partial v}{\partial s}\right|_P$$

10) Edge Cases (should remain plain text)

The price is $19.99 echo “Price: $100” ``const tpl = `$${amount}``` color: $primary-color literal $$ not a closed block literal $x+1 without closing delimiter


No comments yet.