snippet mk "inline Math" iwA
$${1}$
endsnippet

snippet dmi "display Math" iwA
$ ${1} $
endsnippet

snippet dmm "display Math" iwA
$
${1} 
$
endsnippet

snippet pp "parenthesis" iAm
(${1})
endsnippet

snippet lim "limit" iAm
lim_(${1:n} -> ${2:oo})
endsnippet

snippet derive "derive" iAm
derive(${1:f}, ${2:x})
endsnippet

snippet part "partial" iAm
(diff ${1:f})/(diff ${3:x})
endsnippet

snippet sb "subscript" iAm
_(${1:2})
endsnippet

snippet sr "square" iAm
^2
endsnippet

snippet pow "to the ... power" iAm
^(${1:3})
endsnippet

snippet veps "epsilon.alt" iAm
epsilon.alt
endsnippet

snippet ;; "\;" iAm
\;
endsnippet

snippet ,, "\," iAm
\,
endsnippet

snippet `([A-Za-z\)])(\d)` "auto subscript" iAm
`` rv = m[1] + "_" + m[2]``
endsnippet

snippet `([A-Za-z\)])_(\d{2})` "auto subscript" iAm
`` rv = m[1] + "_(" + m[2] + ")" ``
endsnippet

snippet `(?<![A-Za-z])([A-Za-hk-z])([acdijkmnpqrstABCDIJKMNPQRST])\2` "auto subscript" iAm
`` rv = m[1] + "_" + m[2] ``
endsnippet

# Custom: Add more greek letters

snippet `(\)|mu|alpha|sigma|rho|beta|gamma|delta|zeta|eta|varepsilon|epsilon|theta|iota|kappa|vartheta|lambda|nu|pi|rho|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)([acdijkmnpqrstABCDIJKMNPQRST])\2` "auto subscript for greek letter" iAm
`` rv = m[1] + "_" + m[2].substring(0, 1) ``
endsnippet

snippet `(?<![A-Za-z])([A-Za-hk-z01])(grave|acute|hat|tilde|macron|breve|dot|ddot|dddot|ddddot|diaer|circle|caron|vec|upright|italic|b|sans|frak|mono|bb|cal|ov)` "hat" iAm
``
const map = { "ddot": "dot.double", "dddot": "dot.triple", "ddddot": "dot.quad", "vec": "arrow", "b": "bold", "ov": "overline" }
rv = (map[m[2]] || m[2]) + "(" + m[1] + ")"
``
endsnippet

snippet `(mu|alpha|sigma|rho|beta|gamma|delta|zeta|eta|varepsilon|epsilon|theta|iota|kappa|vartheta|lambda|nu|pi|rho|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(grave|acute|hat|tilde|macron|breve|dot|ddot|dddot|ddddot|diaer|circle|caron|vec|upright|italic|b|sans|frak|mono|bb|cal|ov)` "hat" iAm
``
const map = { "ddot": "dot.double", "dddot": "dot.triple", "ddddot": "dot.quad", "vec": "arrow", "b": "bold", "ov": "overline" }
rv = (map[m[2]] || m[2]) + "(" + m[1] + ")"
``
endsnippet

snippet `((grave|acute|hat|tilde|macron|breve|dot|dot\.double|dot\.triple|dot\.quad|diaer|circle|acute\.double|caron|arrow|arrow\.l|upright|italic|bold|sans|frak|mono|bb|cal)\([a-zA-Z\d]+\))(grave|acute|hat|tilde|macron|breve|dot|ddot|dddot|ddddot|diaer|circle|caron|vec|upright|italic|b|sans|frak|mono|bb|cal|ov)` "hat" iAm
``
const map = { "ddot": "dot.double", "dddot": "dot.triple", "ddddot": "dot.quad", "vec": "arrow", "b": "bold", "ov": "overline" }
rv = (map[m[3]] || m[3]) + "(" + m[1] + ")"
``
endsnippet

snippet `(?<!\.)alt` "alt" iAm
.alt
endsnippet

snippet invs "inverse" iAm
^(-1)
endsnippet

snippet xl "vector" iAm
arrow(${1:x})
endsnippet

snippet @< "angle" iAm
angle.l ${1:x} angle.r
endsnippet


snippet HL "highlight" iA
#highlight[${VISUAL}]
endsnippet

snippet iiint "triple integral" iAm
integral.triple ${1}
endsnippet

snippet oint "closed line integral" iAm
integral.cont ${1}
endsnippet

snippet iint "double integral" iAm
integral.double ${1}
endsnippet

snippet int "integral" iAm
integral ${1}
endsnippet

snippet // "frac" iAm
frac(${1:1}, ${2:2})
endsnippet