Skip to main content
Search IntMath
Close

Home | Math Display Experiments | ASCIIMathML, KaTeX and MathJax Demo

ASCIIMathML, KaTeX and MathJax Demo

By Murray Bourne, IntMath.com. Last updated: 20 Jan 2020

ASCIIMathML input

On this page, all input is ASCIIMathML (simple calculator-like math input), and the math expressions have been processed with KaTeX.

UPDATE: Earlier, when KaTeX was not so developed, I had a fallback option where MathJax would process the math in those cases where KaTeX could not handle it yet. That is no longer needed for IntMath, as KaTeX handles all the math expressions I need.

There are just two cases where I need to use a "fiddle" to avoid KaTeX errors. They are the single right patenthesis ")" and the single right bracket "]". My ASCIIMath-to-LaTeX doesn't quite handle these cases (it's expecting left and right brackets together, not right brackets alone), so I need to add an "invisible" left bracket as follows: {:) for right parenthesis and {:] for right bracket.

See some background: KaTeX with ASCIIMathML input and MathJax fallback.

See also: KaTeX and MathJax Comparison Demo

Example math expressions

Some random text then some math `r = +- sqrt(a^2 + b^2)`, then some more text.
The ASCIIMathML input for the above line was r = +- sqrt(a^2 + b^2).

Fractions `y/z` (ASCIIMathML input was y/z.)

`3xx3` matrix: `((1,2,3),(4,8,3),(-5,4,9))`

ASCIIMathML input was ((1,2,3),(4,8,3),(-5,4,9)).

Products and powers of variables: `ab^2`. ASCIIMathML input was ab^2

Integrals: `int_(0)^(2 pi) sin x dx = 0` ASCIIMathML input was int_(0)^(2 pi) sin x dx = 0

Square root: `sqrt(169) = 13`. ASCIIMathML input was sqrt(169) = 13

Summation notation: `sum_(i=1)^ni^3` ASCIIMathML input was sum_(i=1)^ni^3

Fourier Series:

`f(t)` `=(a_0)/2` ` + sum_(n=1)^ooa_ncos((npit)/L)` `+sum_(n=1)^oo b_n\ sin((npit)/L)`

ASCIIMathML input was f(t)=(a_0)/2 + sum_(n=1)^ooa_ncos((npit)/L)+sum_(n=1)^oo b_n\ sin((npit)/L).

`=(a_0)/2` `+a_1 cos((pit)/L)` `+a_2 cos((2pit)/L)` `+a_3 cos((3pit)/L)+...` `+b_1 sin((pit)/L)` `+b_2 sin((2pit)/L)` `+b_3 sin((3pit)/L)` `+...`

ASCIIMathML input was =(a_0)/2 +a_1 cos((pit)/L) +a_2 cos((2pit)/L) +a_3 cos((3pit)/L)+... +b_1 sin((pit)/L) +b_2 sin((2pit)/L) +b_3 sin((3pit)/L) +...

ASCIIMathML syntax examples

Greek letters
(lower case)
Type See
alpha `alpha`
beta `beta`
gamma `gamma`
delta `delta`
epsilon `epsilon`
varepsilon `varepsilon`
zeta `zeta`
eta `eta`
theta `theta`
vartheta `vartheta`
iota `iota`
kappa `kappa`
lambda `lambda`
mu `mu`
nu `nu`
xi `xi`
omicron `o`
pi `pi`
rho `rho`
sigma `sigma`
tau `tau`
upsilon `upsilon`
phi `phi`
varphi `varphi`
chi `chi`
psi `psi`
omega `omega`
Greek letters
(upper case)
Type See
A `A`
B `B`
Gamma `Gamma`
Delta `Delta`
E `E`
Z `Z`
- -
H `H`
Theta `Theta`
- -
I `I`
K `K`
Lambda `Lambda`
M `M`
N `N`
Xi `Xi`
O `O`
Pi `Pi`
P `R`
Sigma `Sigma`
T `T`
Y `Y`
Phi `Phi`
- -
X `X`
Psi `Psi`
Omega `Omega`
Operation symbols
Type See
+ `+`
- `-`
* `*`
** `**`
// `//`
\\ `\
xx `xx`
-: `-:`
@ `@`
o+ `o+`
ox `ox`
o. `o.`
sum `sum`
prod `prod`
^^ `^^`
^^^ `^^^`
vv `vv`
vvv `vvv`
nn `nn`
nnn `nnn`
uu `uu`
uuu `uuu`
Miscellaneous symbols
Type See
int `int`
oint `oint`
del `del`
grad `grad`
+- `+-`
O/ `O/`
oo `oo`
aleph `aleph`
/_ `/_`
:. `:.`
|...| |`...`|
|cdots| |`cdots`|
vdots `vdots`
ddots `ddots`
|\ | |`|
|quad| |`quad`|
diamond `diamond`
square `square`
|__ `|__`
__| `__|`
|~ `|~`
~| `~|`
CC `CC`
NN `NN`
QQ `QQ`
RR `RR`
ZZ `ZZ`
Accents
Type See
hat x `hat x`
bar x `bar x`
ul x `ul x`
vec x `vec x`
dot x `dot x`
ddot x `ddot x`
Arrows
Type See
uarr `uarr`
darr `darr`
rarr `rarr`
-> `->`
|-> `|->`
larr `larr`
harr `harr`
rArr `rArr`
lArr `lArr`
hArr `hArr`
Relation symbols
Type See
= `=`
!= `!=`
< `<`
> `>`
<= `<=`
>= `>=`
-< `-<`
>- `>-`
in `in`
!in `notin`
sub `sub`
sup `sup`
sube `sube`
supe `supe`
-= `-=`
~= `~=`
~~ `~~`
prop `prop`
Font commands
Type See
bb A `bb A`
bbb A `bbb A`
cc A `cc A`
cc L `cc L`
tt A `tt A`
fr A `fr A`
sf A `sf A`
Grouping brackets
Type See
( `(`
{:) `{:)`
[ `[`
{:] `{:]`
{ `{`
} `}`
(: `(:`
:) `:)`
{: `{:`
:} `{::}`
Logical symbols
Type See
and `and`
or `or`
not `not`
=> `=>`
if `if`
iff `iff`
AA `AA`
EE `EE`
_|_ `_|_`
TT `TT`
|-- `|--`
|== `|==`

Examples of use

Type this:

x^2+y_1+z_12^34

See this:

`x^2+y_1+z_12^34`

Type this:

sin^-1(x)

See this:

`sin^-1(x)`

Type this:

d/dxf(x) = lim_(h->0)(f(x+h)-f(x))/h

See this:

`d/dxf(x)=lim_(h->0)(f(x+h)-f(x))/h`

Type this:

f(x) = sum_(n=0)^oo (f^((n))(a))/(n!)(x-a)^n

See this:

`f(x)=sum_(n=0)^oo (f^((n))(a))/(n!)(x-a)^n`

Type this:

int_0^1f(x)dx

See this:

`int_0^1f(x)dx`

Type this:

[[a,b],[c,d]]((n),(k))

See this:

`[[a,b],[c,d]]((n),(k))`

Type this:

f(x) = {(1,if x=0), (0,if x>=0):}

See this:

`f(x) = {(1,if x=0), (0,if x>=0):}`

Type this:

a//b

See this:

`a//b`

Type this:

(a/b)/(c/d)

See this:

`(a/b)/(c/d)`

Type this:

a/b/c/d

See this:

`a/b/c/d`

Type this:

((a*b))/c

See this:

`((a*b))/c`

Type this:

sqrt sqrt root3x

See this:

`sqrt sqrt root3x`

Type this:

<< a,b >> and {:(x,y),(u,v):}

See this:

`<< a,b >> and {:(x,y),(u,v):}`

Type this:

(a,b]={x in RR | a < x <= b}

See this:

`(a,b]={x in RR | a < x <= b}`

Type this:

abc-123.45^-1.1

See this:

`abc-123.45^-1.1`

Type this:

hat(ab) bar(xy) ulA vec v dotx ddot y

See this:

`hat(ab) bar(xy) ulA vec v dotx ddot y`

Type this:

bb{AB3}.bbb(AB]. cc(AB).fr{AB}. tt[AB].sf(AB)

See this:

`bb{AB3}.bbb(AB]. cc(AB).fr{AB}. tt[AB].sf(AB)`

Type this:

stackrel"def"= or \stackrel{\Delta}{=}" "("or ":=)

See this:

`stackrel"def"= or \stackrel{\Delta}{=}" "("or ":=)`

Type this:

{::}_(\ 92)^238U

See this:

`{::}_(\ 92)^238U`

You may be interested in...

This comparison of the 2 systems of math rendering:

KaTeX and MathJax comparison demo

This page gives background on KaTeX:

KaTeX – a new way to display math on the Web

Table source: The author of ASCIIMathML: Peter Jipsen, Chapman University.

Tips, tricks, lessons, and tutoring to help reduce test anxiety and move to the top of the class.