ASCII MATH Syntax

Source : http://asciimath.org/

Syntax

Most AsciiMath symbols attempt to mimic in text what they look like rendered, like oo for . Many symbols can also be displayed using a TeX alternative, but a preceeding backslash is not required.

Operation symbols
Type TeX alt See
+ ++
- -
* cdot
** ast
*** star
// //
\\ backslash
setminus
\\
xx times ××
-: div ÷÷
|>< ltimes
><| rtimes
|><| bowtie
@ circ
o+ oplus
ox otimes
o. odot
sum
prod
^^ wedge
^^^ bidwedge
vv vee
vvv bigvee
nn cap
nnn bigcap
uu cup
uuu bigcup

 

Miscellaneous symbols
Type TeX alt See
2/3 frac{2}{3} 2323
2^3 2323
sqrt x xx
root(3)(x) 3xx3
int
oint
del partial
grad nabla
+- pm ±±
O/ emptyset
oo infty
aleph
:. therefore
:' because
|...| |ldots| |...||...|
|cdots| |||⋯|
vdots
ddots
|\ | | || |
|quad| |  ||  |
/_ angle
frown
/_\ triangle
diamond
square
|__ lfloor
__| rfloor
|~ lceiling
~| rceiling
CC C
NN N
QQ Q
RR R
ZZ Z
"hi" text(hi) hihi

 

Relation symbols
Type TeX alt See
= ==
!= ne
< lt <<
> gt >>
<= le
>= ge
-< prec
-<= preceq
>- succ
>-= succeq
in
!in notin
sub subset
sup supset
sube subseteq
supe supseteq
-= equiv
~= cong
~~ approx
prop propto
Logical symbols
Type TeX alt See
and andand
or oror
not neg ¬¬
=> implies
if ifif
<=> iff
AA forall
EE exists
_|_ bot
TT top
|-- vdash
|== models

 

Grouping brackets
Type TeX alt See
( ((
) ))
[ [[
] ]]
{ {{
} }}
(: langle
🙂 rangle
<<
>>
{: x ) x)x)
( x :} (x(x
abs(x) |x||x|
floor(x) x⌊x⌋
ceil(x) x⌈x⌉
norm(vecx) x∥x→∥
Arrows
Type TeX alt See
uarr uparrow
darr downarrow
rarr rightarrow
-> to
>-> rightarrowtail
->> twoheadrightarrow
>->> twoheadrightarrowtail
|-> mapsto
larr leftarrow
harr leftrightarrow
rArr Rightarrow
lArr Leftarrow
hArr Leftrightarrow

 

Accents
Type TeX alt See
hat x ˆxx^
bar x overline x ¯x
ul x underline x x
vec x xx→
dot x .xx.
ddot x ..xx..
overset(x)(=) overset(x)(=) x==x
underset(x)(=) =x=x
ubrace(1+2) underbrace(1+2) 1+21+2⏟
obrace(1+2) overbrace(1+2) 1+21+2⏞
color(red)(x) xx
cancel(x) xx
Greek Letters
Type See Type See
alpha αα
beta ββ
gamma γγ Gamma ΓΓ
delta δδ Delta ΔΔ
epsilon εε
varepsilon ɛɛ
zeta ζζ
eta ηη
theta θθ Theta ΘΘ
vartheta ϑϑ
iota ιι
kappa κκ
lambda λλ Lambda ΛΛ
mu μμ
nu νν
xi ξξ Xi ΞΞ
pi ππ Pi ΠΠ
rho ρρ
sigma σσ Sigma ΣΣ
tau ττ
upsilon υυ
phi ϕϕ Phi ΦΦ
varphi φφ
chi χχ
psi ψψ Psi ΨΨ
omega ωω Omega ΩΩ

 

Font commands
Type See
bb "AaBbCc" AaBbCcAaBbCc
bbb "AaBbCc" AaBbCcAaBbCc
cc "AaBbCc" AaBbCcAaBbCc
tt "AaBbCc" AaBbCcAaBbCc
fr "AaBbCc" AaBbCcAaBbCc
sf "AaBbCc" AaBbCcAaBbCc

 

Standard Functions

sin, cos, tan, sec, csc, cot, arcsin, arccos, arctan, sinh, cosh, tanh, sech, csch, coth, exp, log, ln, det, dim, mod, gcd, lcm, lub, glb, min, max, f, g.

 

Special Cases

Matrices: [[a,b],[c,d]] yields to [abcd][abcd]

Column vectors: ((a),(b)) yields to (ab)(ab)

Matrices can be used for layout: {(2x,+,17y,=,23),(x,-,y,=,5):} yields{2x+17y=23xy=5{2x+17y=23x-y=5

Complex subscripts: lim_(N->oo) sum_(i=0)^N yields to limNNi=0limN→∞∑i=0N

Subscripts must come before superscripts: int_0^1 f(x)dx yields to 10f(x)dx∫01f(x)dx

Derivatives: f'(x) = dy/dx yields f'(x)=dydxf′(x)=dydx
For variables other than x,y,z, or t you will need grouping symbols: (dq)/(dp) for dqdpdqdp

Overbraces and underbraces: ubrace(1+2+3+4)_("4 terms") yields 1+2+3+44 terms1+2+3+4⏟4 terms.
obrace(1+2+3+4)^("4 terms") yields 4 terms1+2+3+41+2+3+4⏞4 terms.

Attention: Always try to surround the > and < characters with spaces so that the html parser does not confuse it with an opening or closing tag!

 

The Grammar

Here is a definition of the grammar used to parse AsciiMath expressions. In the Backus-Naur form given below, the letter on the left of the ::= represents a category of symbols that could be one of the possible sequences of symbols listed on the right. The vertical bar | separates the alternatives.

v ::= [A-Za-z] | greek letters | numbers | other constant symbols
u ::= sqrt | text | bb | other unary symbols for font commands
b ::= frac | root | stackrel | other binary symbols
l ::= ( | [ | { | (: | {: | other left brackets
r ::= ) | ] | } | 🙂 | :} | other right brackets
S ::= v | lEr | uS | bSS             Simple expression
I ::= S_S | S^S | S_S^S | S          Intermediate expression
E ::= IE | I/I                       Expression