example:math:compare

KaTeX vs AsciiMath

The same formulas written both ways. Left column is AsciiMath (backticks, rendered to MathML on the server); right column is LaTeX (dollar signs, rendered by KaTeX in the browser). They should look near-identical.

Inline

AsciiMath KaTeX
`x2+y2=r2` $x^2+y^2=r^2$
`a/b` $\frac{a}{b}$
`sqrt(x+1)` $\sqrt{x+1}$
`alpha+beta=gamma` $\alpha+\beta=\gamma$
`x in RR` $x \in \mathbb{R}$
`f(x)=sin(x)/x` $f(x)=\frac{\sin(x)}{x}$

Display

Quadratic formula

AsciiMath: ` x=(-b+-sqrt(b^2-4a c))/(2a)`

KaTeX: $$x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}$$

Sum

AsciiMath: ` sum_(i=1)^n i^3=1)/2)^2`

KaTeX: $$\sum_{i=1}^{n} i^3=\left(\frac{n(n+1)}{2}\right)^2$$

Integral

AsciiMath: ` int_0^1 x^2 dx = 1/3`

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

Limit

AsciiMath: ` lim_(x→0) {:sin(x)/x:} = 1`

(The {: … :} invisible brackets matter: without them this parser reads lim sin(x) as the numerator.)

KaTeX: $$\lim_{x\to 0}\frac{\sin(x)}{x} = 1$$

Matrix

AsciiMath: ` 2)`

KaTeX: $$\begin{pmatrix} a & b \\ c & d \end{pmatrix}$$

Nested fraction and root

AsciiMath: ` root(3)(1+ (x)/(1+y))`

KaTeX: $$\sqrt[3]{1+\frac{x}{1+y}}$$

1)
n(n+1
2)
a,b),(c,d
example/math/compare.txt · ostatnio zmienione: przez 127.0.0.1