Current itex2MML Version: 1.6.1 (10/3/2021)
Installation: Readme
Source code: (download |
browse repository)
Here is a list of all the TeX commands currently implemented in itex2MML. Most should be familiar to users of AMSLaTeX (and, I hope, represent their most commonly-used commands). Some are derived from WebTeX.
All of these commands work only within equation-mode. Inline equations are demarcated by $…$
or \(…\)
. Display equations are demarcated by $$…$$
or \[…\]
. You cannot nest equations: i.e. $$…\text{foo $…$ bar}…$$
is not allowed.
Users should be aware of two main differences between itex and TeX:
- In itex,
$pin$
is a single token, which is translated into<mi>pin</mi>
in MathML.
$p i n$
, on the other hand, is three tokens, which is translated into<mi>p</mi><mi>i</mi><mi>n</mi>
in MathML. TeX makes no distinction between these two. - It is possible (though probably not recommended) to insert MathML markup inside itex equations. So "<" and ">" are significant. To obtain a less-than or greater-than sign, you should use
\lt
or\gt
, respectively.
Environments
\begin{env}…\end{env}
where env is one of
matrix
,
pmatrix
,
bmatrix
,
Bmatrix
,
vmatrix
,
Vmatrix
,
smallmatrix
,
cases
,
aligned
,
gathered
,
split
,
array
,
svg
The array
Environment
As in standard LaTeX, the array
environment takes one optional argument, indicating the alignment of the whole array with the respect to the equation axis, and one mandatory argument, indicating the alignment of the columns. Thus
\begin{array}[t]{clrc} 1 & 2 & 3 & 4 \\ 5 & 6 & 7 & 8 \\ 9 & 10& 11& 12 \end{array}
produces an array with 4 columns. The first and last column are centered; the second and third are, respectively, left- and right-aligned. The top line of the array is aligned with the equation axis.
As in AMSLaTeX,
\begin{matrix} ... \end{matrix}
is precisely equivalent to
\begin{array}{cc...c} ... \end{array}
except that you don't have to explicitly state the number of columns.
The svg
Environment
\begin{svg} ... \end{svg}
allows you to embed snippets of SVG in itex equations. To assist in Instiki's LaTeX export feature, you can also include a graphicx
command:
\begin{svg} ... \end{svg} \includegraphics[width=...]{foo}
where foo.pdf
is a file containing a PDF version of the graphic. In itex, the \includegraphics
command is defined as a NOOP, and the SVG is embedded in the MathML output. In Instiki's LaTeX export, the opposite is true: the svg
environment is a NOOP, and the \includegraphics
command is included in the output.
WebTeX-style Arrays and Array Options†
The \array{}
command allows much finer control over the layout of arrays than is available in the standard (AMS)LaTeX-style environments above.
\array
-
\arrayopts
-
\collayout
(=\colalign
),\rowalign
,\align
,\equalcols
,\equalrows
,\collines
,\rowlines
,\frame
,\padding
\rowopts
-
\colalign
,\rowalign
\cellopts
-
\colalign
,\rowalign
,\rowspan
,\colspan
Greek Letters
\alpha
,
\beta
,
\gamma
,
\delta
,
\epsilon
,
\backepsilon
,
\varepsilon
,
\zeta
,
\eta
,
\theta
,
\vartheta
,
\iota
,
\kappa
,
\varkappa
,
\lambda
,
\mu
,
\nu
,
\xi
,
\omicron
,
\pi
,
\varpi
,
\rho
,
\varrho
,
\sigma
,
\varsigma
,
\tau
,
\upsilon
,
\phi
,
\varphi
,
\chi
,
\psi
,
\omega
,
\Alpha
,
\Beta
,
\Gamma
,
\Delta
,
\Zeta
,
\Eta
,
\Theta
,
\Iota
,
\Kappa
,
\Lambda
,
\Mu
,
\Nu
,
\Xi
,
\Pi
,
\Rho
,
\Sigma
,
\Tau
,
\Upsilon
( = \Upsi
),
\Phi
,
\Psi
,
\Omega
,
\digamma
,
\mho
Log-like Symbols
\arccos
,
\arcsin
,
\arctan
,
\arg
,
\cos
,
\cosh
,
\cot
,
\coth
,
\csc
,
\deg
,
\det
,
\dim
,
\exp
,
\gcd
,
\inf
,
\hom
,
\ker
,
\lg
,
\lim
,
\liminf
,
\limsup
,
\ln
,
\log
,
\max
,
\min
,
\mod
*,
\pmod
*,
\Pr
,
\sec
,
\sin
,
\sinh
,
\sup
,
\tan
,
\tanh
Arrows
\rightarrow
( = \to
),
\longrightarrow
,
\Rightarrow
( = \implies
),
\hookrightarrow
( = \embedsin
),
\mapsto
( = \map
),
\leftarrow
,
\longleftarrow
,
\Leftarrow
( = \impliedby
),
\hookleftarrow
,
\leftrightarrow
,
\Leftrightarrow
,
\Longleftrightarrow
( = \iff
),
\nearrow
( = \nearr
),
\nwarrow
( = \nwarr
),
\searrow
( = \searr
),
\swarrow
( = \swarr
),
\neArrow
( = \neArr
),
\nwArrow
( = \nwArr
),
\seArrow
( = \seArr
),
\swArrow
( = \swArr
),
\darr
,
\Downarrow
,
\uparr
,
\Uparrow
,
\downuparrow
( = \duparr
= \updarr
),
\Updownarrow
,
\leftsquigarrow
,
\rightsquigarrow
,
\leftrightsquigarrow
,
\upuparrows
,
\rightleftarrows
,
\rightrightarrows
,
\dashleftarrow
,
\dashrightarrow
,
\curvearrowleft
,
\curvearrowbotright
,
\downdownarrows
,
\leftleftarrows
,
\leftrightarrows
,
\righttoleftarrow
,
\lefttorightarrow
,
\circlearrowleft
,
\circlearrowright
,
\curvearrowright
,
\leftarrowtail
,
\rightarrowtail
,
\leftrightsquigarrow
,
\Lleftarrow
,
\Rrightarrow
,
\looparrowleft
,
\looparrowright
,
\Lsh
,
\Rsh
,
\twoheadleftarrow
,
\twoheadrightarrow
,
\nLeftarrow
,
\nleftarrow
,
\nLeftrightarrow
,
\nleftrightarrow
,
\nRightarrow
,
\nrightarrow
,
\leftharpoonup
,
\leftharpoondown
,
\rightharpoonup
,
\rightharpoondown
,
\downharpoonleft
,
\downharpoonright
,
\leftrightharpoons
,
\rightleftharpoons
,
\upharpoonleft
,
\upharpoonright
All arrows are supposed to be stretchy. Not all of them are, however --- at least not in the current Mozilla/Firefox.
Extensible Arrows
While you can always put a superscript on an arrow, using \overset{u}{\rightarrow}
(or both a subscript and a superscript, using \underoverset{d}{u}{\rightarrow}
), these don't quite work right when exported to LaTeX (the arrows don't stretch). For LaTeX compatibility, one can use \xrightarrow{u}
and \xrightarrow[d]{u}
, respectively. The set of extensible arrows is:
\xrightarrow
,
\xleftarrow
,
\xleftrightarrow
,
\xLeftarrow
,
\xRightarrow
,
\xLeftrightarrow
,
\xleftrightharpoons
,
\xrightleftharpoons
,
\xhookleftarrow
,
\xhookrightarrow
,
\xmapsto
Delimiters
(
,
)
,
[
,
]
,
\langle
( = \lang
),
\rangle
( = \rang
),
\llangle
,
\rrangle
,
\lbrace
( = \{
),
\rbrace
( = \}
),
\lceil
,
\rceil
,
\lmoustache
,
\rmoustache
,
\lfloor
,
\rfloor
,
\lvert
,
\rvert
,
\lVert
,
\rVert
,
\llbracket
,
\rrbracket
,
\uparrow
,
\downarrow
,
\updownarrow
,
\vert
( = |
),
\Vert
( = \|
),
/
In TeX, delimiters are non-stretchy, by default. Stretchy delimiters are obtained with \left<delim>
and \right<delim>
. Each \left<delim>
must be matched with a corresponding \right<delim>
. If you don't want a visible matching delimiter, you can match with the invisible delimiters, \left.
and \right.
.
Fixed-size large delimiters are generated with the modifiers \big
,\Big
,\bigg
,\Bigg
,
\bigl
,\Bigl
,\biggl
,\Biggl
,
and
\bigr
,\Bigr
,\biggr
,\Biggr
. For example, \Biggr)
generates a very large (3×natural size) right parenthesis; \bigl\vert
generates a large (1.2×natural size) left vertical bar.
Operators
\amalg
,
\angle
,
\measuredangle
,
\sphericalangle
,
\approx
,
\approxeq
,
\thickapprox
,
\ast
,
\asymp
,
\backslash
,
\because
,
\between
,
\bottom
(= \bot
),
\boxminus
( = \minusb
)
\boxplus
( = \plusb
),
\boxtimes
( = \timesb
),
\boxdot
,
\boxslash
,
\boxbslash
,
\boxast
,
\boxcircle
,
\boxbox
,
\bowtie
,
\bullet
,
\cap
( = \intersection
),
\cup
( = \union
),
\Cap
,
\Cup
,
\cdot
,
\circledast
,
\circledcirc
,
\clubsuit
,
\curlyvee
,
\curlywedge
,
\diamondsuit
,
\divideontimes
,
\dotplus
,
\heartsuit
,
\spadesuit
,
\circ
,
\bigcirc
,
\cong
,
\ncong
,
\dagger
,
\ddagger
,
\dashv
,
\Vdash
,
\vDash
,
\nvDash
,
\VDash
,
\nVDash
,
\vdash
,
\nvdash
,
\Vvdash
,
\Diamond
,
\diamond
,
\div
,
\equiv
,
\nequiv
,
\eqcirc
,
\neq
( = \ne
),
\Bumpeq
,
\bumpeq
,
\circeq
,
\doteq
,
\doteqdot
,
\fallingdotseq
,
\risingdotseq
,
\exists
,
\nexists
,
\flat
,
\forall
,
\frown
,
\smallfrown
,
\gt
,
\ngtr
,
\gg
,
\ggg
,
\geq
( = \ge
),
\ngeq
,
\geqq
,
\ngeqq
,
\geqslant
,
\ngeqslant
,
\eqslantgtr
,
\gneq
,
\gneqq
,
\gnapprox
,
\gnsim
,
\gtrapprox
,
\gtrsim
,
\gtrdot
,
\gtreqless
,
\gtreqqless
,
\gtrless
,
\gvertneqq
,
\in
,
\notin
,
\ni
,
\notni
,
\intercal
,
\invamp
( = \parr
),
\lhd
,
\unlhd
,
\leftthreetimes
,
\rightthreetimes
,
\lt
,
\nless
,
\ll
,
\lll
,
\leq
( = \le
),
\nleq
,
\leqq
,
\nleqq
,
\leqslant
,
\nleqslant
,
\eqslantless
,
\lessapprox
,
\lessdot
,
\lesseqgtr
,
\lesseqqgtr
,
\lessgtr
,
\lesssim
,
\lnapprox
,
\lneq
,
\lneqq
,
\lnsim
,
\ltimes
,
\lvertneqq
,
\lozenge
,
\blacklozenge
,
\mid
( = \shortmid
),
\nmid
,
\nshortmid
,
\models
,
\multimap
,
\nabla
( = \Del
),
\natural
,
\not
( = \neg
),
\odot
,
\odash
( = \circleddash
),
\otimes
,
\oplus
,
\ominus
,
\oslash
,
\obslash
,
\obar
,
\olessthan
,
\ogreaterthan
,
\parallel
,
\nparallel
,
\shortparallel
,
\nshortparallel
,
\partial
,
\Perp
( = \Vbar
),
\perp
,
\pitchfork
,
\pm
,
\mp
,
\prec
,
\nprec
,
\precapprox
,
\precnapprox
,
\preceq
,
\npreceq
,
\preccurlyeq
,
\curlyeqprec
,
\precsim
,
\precnsim
,
\prime
,
\backprime
,
\propto
,
\varpropto
,
\rhd
,
\unrhd
,
\rtimes
,
\setminus
,
\smallsetminus
,
\sharp
,
\sim
,
\nsim
,
\backsim
,
\simeq
,
\backsimeq
,
\thicksim
,
\smile
,
\smallsmile
,
\sslash
,
\subset
,
\nsubset
,
\subseteq
,
\nsubseteq
,
\subseteqq
,
\nsubseteqq
,
\subsetneq
,
\subsetneqq
,
\varsubsetneq
,
\varsubsetneqq
,
\Subset
,
\succ
,
\nsucc
,
\succeq
,
\nsucceq
,
\succapprox
,
\succnapprox
,
\succcurlyeq
,
\curlyeqsucc
,
\succsim
,
\succnsim
,
\supset
,
\nsupset
,
\supseteq
,
\nsupseteq
,
\supseteqq
,
\supsetneq
,
\supsetneqq
,
\varsupsetneq
,
\varsupsetneqq
,
\Supset
,
\square
( = \Box
),
\blacksquare
(= \qed
),
\sqcup
,
\sqcap
,
\sqsubset
,
\sqsubseteq
,
\sqsupset
,
\sqsupseteq
,
\star
,
\bigstar
,
\therefore
,
\times
,
\top
,
\triangle
,
\triangledown
,
\triangleleft
,
\triangleright
,
\blacktriangle
,
\blacktriangledown
,
\bigtriangleup
,
\bigtriangledown
,
\blacktriangleleft
,
\blacktriangleright
,
\ntriangleleft
,
\ntriangleright
,
\ntrianglelefteq
,
\ntrianglerighteq
,
\trianglelefteq
,
\trianglerighteq
,
\triangleq
,
\vartriangleleft
,
\vartriangleright
,
\uplus
,
\vee
,
\veebar
,
\wedge
,
\barwedge
,
\doublebarwedge
,
\wr
,
\coloneqq
,
\Coloneqq
,
\coloneq
,
\Coloneq
,
\eqqcolon
,
\Eqqcolon
,
\eqcolon
,
\Eqcolon
,
\colonapprox
,
\Colonapprox
,
\colonsim
,
\Colonsim
,
\dblcolon
In keeping with AMSLaTeX, rather than MathML's conventions, \smallsetminus
( = U+FE68) is designated as a small (non-stretchy) reverse solidus, \backslash
is a reverse solidus ( = U+05C). \setminus
( = U+2216) is stretchy.
Symbols
\aleph
,
\beth
,
\ell
,
\hbar
,
\Im
,
\imath
,
\jmath
,
\eth
,
\Re
,
\wp
,
\infty
( = \infinity
),
\emptyset
( = \varnothing
)
Dots
\dots
,
\ldots
,
\cdots
,
\ddots
,
\udots
,
\vdots
,
\colon
While ":" is allowed in math mode, it doesn't (either in LaTeX or in itex) produce the desired spacing for, e.g., . Use \colon
, instead.
Large Math Operators and Integrals
\bigcup
( = \Union
),
\bigcap
( = \Intersection
),
\bigodot
,
\bigoplus
( = \Oplus
),
\bigotimes
( = \Otimes
),
\bigsqcup
,
\bigsqcap
,
\biginterleave
,
\biguplus
,
\bigwedge
( = \Wedge
),
\bigvee
( = \Vee
),
\coprod
( = \coproduct
),
\prod
( = \product
),
\sum
,
\int
( = \integral
),
\iint
( = \doubleintegral
),
\iiint
( = \tripleintegral
),
\iiiint
( = \quadrupleintegral
),
\oint
( = \conint
= \contourintegral
)
Sizes and Styles
\displaystyle
,
\textstyle
,
\textsize
,
\scriptsize
,
\scriptscriptsize
,
\mathit
,
\mathbf
( = \boldsymbol
),
\mathrm
,
\mathbb
,
\mathfrak
( = \mathfr
),
\mathcal
,
\mathscr
☯,
\mathsf
,
\mathtt
,
\text
Spaces
\␣
,\,
( = \thinspace
),
\:
( = \medspace
),
\;
( = \thickspace
),
\quad
,
\qquad
,
\!
( = \negthinspace
),
\negmedspace
,
\negthickspace
,
\phantom
,
\mathrlap
✵,
\mathllap
✵,
\mathclap
✵,
\space
†
Accents
\bar
,
\overline
( = \closure
= \widebar
),
\underline
,
\vec
,
\widevec
( = \overrightarrow
),
\overleftarrow
,
\overleftrightarrow
,
\underrightarrow
,
\underleftarrow
,
\underleftrightarrow
,
\dot
,
\ddot
,
\dddot
,
\ddddot
,
\tilde
,
\widetilde
,
\check
,
\widecheck
,
\hat
,
\widehat
,
\slash
,
\boxed
Fractions, Sub/Superscripts and Roots
\frac
,
\tfrac
,
\binom
,
\tbinom
,
\over
,
\atop
,
\substack
,
\overbrace
,
\underbrace
,
\underset
,
\overset
(=\stackrel
),
\underoverset
‡,
\tensor
†,
\multiscripts
†,
\sqrt
,
\root
†,
\operatorname
,
\mathop
,
\mathbin
,
\mathrel
,
\mathraisebox
☭
As in LaTeX, \sqrt
accepts an optional argument, so that \sqrt[3]{n+1}
is equivalent to \root{3}{n+1}
.
Numbers
In MathML, numbers are represented as, e.g., <mn>127.3</mn>
. itex2MML does its best to intelligently parse what's a number and what's not. Unfortunately, conventions for things like decimal markers are very culture-dependent, and incompatibly-so. If you don't like the way itex2MML parses the would-be numbers in your input, you can force it to interpret a certain string as a number, using the \itexnum{}
command.
Colours
\color{colourspec}
changes the current foreground colour. colourspec
is either
- an HTML named-colour:
aqua
,black
,blue
,fuchsia
,gray
,green
,lime
,maroon
,navy
,olive
,purple
,red
,silver
,teal
,white
, oryellow
- or is an RGB colour value:
#rgb
or#rrggbb
, wherergb
orrrggbb
is a 3- or 6-digit hexadecimal number.#000000
is black,#FFFFFF
is white, and#1AC=#11AACC
.
As an example, $a { b \color{red} c \color{#0F0} d } e$
will render a
, b
and e
in the default colour (usually black), c
in red and d
in green.
The alternate LaTeX syntax, involving specifying a colour model, e.g.
\color[cmyk]{0, 0.1, 0.5, 0.3}
is not supported.
A new command, \bgcolor{colourspec}
, works the same way, but changes the current background colour.
Interactivity
\href{url}{expression}
- Turns a mathematical expression into a clickable link. This makes use of Xlink.
\statusline{message}{expression}
- Displays the message text in the browser's status-line, when the user hovers his mouse over the mathematical expression. Works in current (but not older versions of) Mozilla/Firefox, or is easily implemented with a touch of Javascript⁂.
\tooltip{message}{expression}
- Displays the message text as a tooltip, when the user hovers his mouse over the mathematical expression. Also does not work natively in Mozilla/Firefox. Instead, Mozilla/Firefox supports the (nonexistent) title attribute. So, the same Javascript, below, works around the problem.
\fghilight{colourspec}{expression}
( =\fghighlight)
\bghilight{colourspec}{expression}
( =\bghighlight)
†- Change the foreground/background colour of an expression when the user hovers over it. Not supported by current browsers, but can be worked-around with little Javascript.
\toggle{expression1}{expression2}
- Toggle between these two expressions when the user clicks on them.
\begintoggle{expression1}{expression2}...{expressionN}\endtoggle
- Toggle between these n expressions when the user clicks on them.
Equation Numbering
While itex2MML, the stream filter, does not provide such facilities, various tools built around it, like the itex2MML MovableType plugin and Maruku provide enhanced features, such as equation-numbering and cross-referencing. $$...$$ produces an unnumbered equation. \[...\] produces a numbered equation. Optionally, \[...\] can contain a label
\[...\label{foo}...\]
You can then refer back to this equation by (eq:foo)
or \eqref{foo}
. These are automatically turned into hyperlinks.
* Yeah, yeah, I know …
† MathML-inspired WebTeX extension.
✵ The names of these macros are drawn from this TUGboat article, where math-mode compatible versions of the usual \rlap{}
and \llap{}
commands are presented. \mathclap{}
is similar, producing a zero-width box, with its content centered about the current position. See this blog post for some examples.
☯ Supporting \mathscr{}
requires the STIX Two fonts and adding
.mathscript { font-variant-alternates: styleset(1); /* Recommended syntax */ font-feature-settings: ss01; /* E.g. Chrome doesn't support the above */ }
to your CSS file.
‡ \underoverset{subscript}{superscript}{symbol}
☭ \mathraisebox{voffset}[height][depth]{content}
works just like \raisebox
, but is suitable for math mode. For a LaTeX implementation, see here. The itex implementation works in Firefox 7 and later (since it uses MathML3 features).
⁂ Just add a function mactionWorkarounds()
to your onload
handler. In Prototype, that function would look like
function mactionWorkarounds() { $$('maction[actiontype="tooltip"]').each( function(el){ Element.writeAttribute(el, 'title', Element.firstDescendant(el).nextSibling.firstChild.data); }); $$('maction[actiontype="statusline"]').each( function(el){ var v = Element.firstDescendant(el).nextSibling.firstChild.data; Event.observe(el, 'mouseover', function(){window.status = v;}); Event.observe(el, 'mouseout', function(){window.status = '';}); }); }
JQuery would look similar.