]> MathToWeb - User's Guide (learn how to generate MathML from LaTeX)
MathToWeb .com Home|Support
What's New User's Guide Support Download Open Source MathToWeb Online Donate Links
Tips on Usage Browsers

MathToWeb User's Guide Version 3.0.1 - 2010/04/28

Contents

Note to Firefox users:  If you are seeing numerous square boxes (they look like this:     ) in the guide below, it means your MathML fonts are not up to date.   They can be updated here:  Firefox MathML fonts.
If you are using an up-to-date version of Firefix (3.0+), see the Mozilla 1.9, STIX (BETA) FONTS at the above link.

Using MathToWeb

MathToWeb will convert any text file containing mathematical expressions written in AMS-Latex to MathML. In this respect, the file extension is of no importance, it could be: *.txt, *.xml, *.htm, etc., MathToWeb will convert them all in the same way. The file extension does become important when it comes to displaying your documents in a browser however, and the *.xml extension, along with the mandatory declarations found in the template below are recommended for this purpose.

MathToWeb can be downloaded as a graphics-based program (a picture of which can be seen on the home page) or a command-line program. The former is very simple to use: simply select a file (one that contains AMS-Latex math expressions that you would like converted to MathML) and press the 'Convert' button. For information on the using the command-line version, click here.

Regardless of which version you use (graphics or command-line), MathToWeb will create a separate file into which it will place your converted text. It will put this file in the same directory as the source file and name it by tacking '_MathToWeb_###' to the original file name.

MathToWeb can be used in one of two general ways:

There are a few things to be aware of before writing documents containing MathML.

MathML is an XML application and web pages that use it must comply with strict XML syntax rules.
This can be achieved by writing your web pages in a form of HTML called XHTML (see the Wiki page on XHTML).

It is not difficult to conform to the XHTML standard. Four essential rules follow:

Below is a template that contains all the necessary XHTML declarations etc. that are required to have MathML display properly in a browser. It should be copied and saved to a text file with an .xml extension (for example, my_web_page_template.xml).

Within the body of this template you'll find a couple of example equations written in Latex. These can be deleted and replaced with your own work; however, before doing this, it is instructive to convert the template, as is, to MathML. This simple procedure is explained below.

  Testing the template

  To convert the template using the command-line version, click here.

Template for web pages that will contain MathML

A single click inside the text-area will 'Select All'.

Math environments

Environment Properties Example Rendering
$...$  or  \(...\)
  • inline
  • unnumbered
this equation, $(a+b)$ is inline... this equation, ( a + b ) is inline...
\[...\]
  • displayed
  • unnumbered
\[ a^3+b^2+c \]
a 3 + b 2 + c ()
\begin{equation*}
...
\end{equation*}
  • displayed
  • unnumbered
\begin{equation*}
a_1 + b_2 + c
\end{equation*}
a 1 + b 2 + c ()
\begin{equation}
...
\end{equation}
  • displayed
  • numbered
  • single equation /
    single number
\begin{equation}
\tag{1.1}\label{equation-eg}
x_1 + x_2 + x_3
\end{equation}
x 1 + x 2 + x 3 (1.1)
\begin{multline}
...
\end{multline}
  • displayed
  • numbered
  • single equation \
    single number
\begin{multline}
\tag{1.2}\label{multline-eg}
a+b+c+d+e+f+g\\
+h+i+j+k\\
+l+m+n
\end{multline}
a + b + c + d + e + f + g + h + i + j + k + l + m + n (1.2)
  • MathToWeb's implementation of multline left-aligns the first row, centre-aligns the middle row (or rows), and right-aligns the last row, as can be seen in the above example. This behaviour can be modified by applying the commands \shoveleft and \shoveright, which take as their argument the entire row in question, excluding the row separator \\. These commands are used only on the middle rows and have the effect of forcing them left or right. An example using \shoveright is below.

    \begin{multline}
    \tag{1.2}\label{multline-shoveright-eg}
    	a+b+c+d+e+f+g\\
    	\shoveright{+h+i+j+k}\\
    	+l+m+n
    \end{multline}
      which is rendered as  
    a + b + c + d + e + f + g + h + i + j + k + l + m + n (1.2)
\begin{gather}
...
\end{gather}
  • displayed
  • numbered
  • multi-equation /
    multi-numbered
\begin{gather}
a_1=b+c+d              \tag{1.3}\label{gather-eq1}\\
a_2=e+f+g+h+i+j+k+l+m  \tag{1.4}\label{gather-eq2}\\
a_3=n+o+p+q            \tag{1.5}\label{gather-eq3}
\end{gather}
                  
a 1 = b + c + d a 2 = e + f + g + h + i + j + k + l + m a 3 = n + o + p + q (1.3)
(1.4)
(1.5)
  • gather centre-aligns all of its rows as can be seen from the above example.
  • The subordinate environment split can be used within the gather environment (see the section on split below).
\begin{align}
...
\end{align}
  • displayed
  • numbered
  • multi-equation /
    multi-numbered
\begin{align}
a&=b     & A&=B     & x&=y+z  \tag{1.6}\label{align-eq1}\\
cd&=ef   & CD&=EF   & k&=m    \tag{1.7}\label{align-eq2}\\
g+h&=i+j & G+H&=I+J & nq&=rs  \tag{1.8}\label{align-eq3}
\end{align}
                  
a = b A = B x = y + z c d = e f C D = E F k = m g + h = i + j G + H = I + J n q = r s (1.6)
(1.7)
(1.8)
  • align permits alignment points to be specified using & and rows by \\, and is commonly used to vertically align two or more equations, usually on binary operators such as equal signs (the example above illustrates this).
  • Alignment for this environment is actually as follows:  right & left & right & left & right & left ... .
  • To have numbering suspended on a particular row, place a \notag command instead of  \tag{...}\label{...}.
  • The subordinate environment split can be used within the align environment (see the section on split below).
  • The spacing around the equal sign in the above example is not optimal. This problem is being addressed and it is hoped that a solution will be at hand in the near future.
  • \text{...} can be used inside any of the math environments, but in case of align, it is often used to annotate a multi-line equation line-by-line
    (the example below illustrates this).
  • There a couple of things to note regarding this example:
    • \notag is used to suspend numbering on the second line (the first row is numbered 1.9, the second has no tag, the last is 2.0).
    • References to other equations using the command \ref{...} (or \eqref{...}) are made from inside \text{...} calls.
    • MathToWeb treats references (which are, in fact, just links) that are inside MathML differently that those that are outside. Looking at the MathML for the example below, we see that the hyperlinks representing cross-references (which are inside MathML code) are actually XML xlink calls made from <mrow> tags, for example,
      <mrow xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="#align-eq1">1.6</mrow>, rather than normal HTML hyperlinks <a href="#align-eq1">1.6</a>. The former is necessary for links inside MathML, which is an XML application. Although not illustrated here, MathToWeb does use the latter mentioned HTML links for cross-references outside of MathML code (see Cross-referencing your equations for more on this topic).
\begin{align}
y& = x_0+x_1-x_2+x_3-\dotsb  && \text{by \ref{align-eq1}}    \tag{1.9}\label{align-eq4}\\
 & = y_0+y_1                 && \text{by \eqref{align-eq2}}  \notag \\
 & = q_0-q_1+q_2             && \text {by Axiom 4.}          \tag{2.0}\label{align-eq5}
\end{align}
                  
y = x 0 + x 1 - x 2 + x 3 - by 1.6 = y 0 + y 1 by (1.7) = q 0 - q 1 + q 2 by Axiom 4. (1.9)
()
(2.0)
\begin{split}
...
\end{split}
  • subordinate
  • numbered by parent environment as a single equation
  • split must be used inside: equation, gather or align (or their * forms).
    Do not use it inside multline or multline*.
  • The subordinate environment split allows a single equation to be broken into multiple lines in such a way that rows are marked by \\ and alignment points by &. Each split has associated with it just one equation number (see 2.1 in example below, and 1.4 in the example below that).
  • split  inside  equation
    • In this instance, split must constitute the entire body of the equation.
    • Take a look at this more realistic example.
\begin{equation}
\tag{2.1}\label{equation-split-eg}
\begin{split}
a_2+a_3+a_4&=e+f+g+h\\
           &\quad +i+j+k\\
           &=l+m+n
\end{split}
\end{equation}
  which is rendered as  
a 2 + a 3 + a 4 = e + f + g + h + i + j + k = l + m + n (2.1)
  • split  inside  gather or align
\begin{gather}
a_1=b+c+d \tag{1.3}\label{gather-eq1}\\
\begin{split}
a_2+a_3+a_4&=e+f+g+h\\
           &\quad +i+j+k\\
           &=l+m+n
\end{split} \tag{1.4}\label{gather-eq2} \\
a_5=o+p+q+r+s+t+u+v+w \tag{1.5}\label{gather-eq3}
\end{gather}
    which is rendered as    
a 1 = b + c + d a 2 + a 3 + a 4 = e + f + g + h + i + j + k = l + m + n a 5 = o + p + q + r + s + t + u + v + w (1.3)
(1.4)
(1.5)
\begin{gathered}
...
\end{gathered}
\begin{aligned}
...
\end{aligned}
  • subordinate
  • numbered by parent environment as a single equation
  • gathered and aligned must be used inside: equation or equation*.
  • These environments exist primarily to allow delimiters to be placed around multi-lined equation structures, as a whole, something that can not done using gather or align because these expand to the full width of the line, allowing nothing else.

    For example, one might try the following in order to place curly braces around an align structure; however, such a construct will produce an error, both in Latex and MathToWeb.
    \begin{equation}
    \left\{
    \begin{align}
    ...
    \end{align}
    \right\}
    \end{equation}
    Error:  align can not be nested inside equation.
    Similar code below using aligned rather than align, however, works as expected.
    \begin{equation}\tag*{- ii -}\label{eq:aligned-eg1}
    \left\{
    \begin{aligned}
    a&=b\\
     &=c
    \end{aligned}
    \right\}
    \end{equation}
      which is rendered as  
    { a = b = c } - ii -
      * Recall that \tag*{...} typesets whatever text is supplied literally, with no parentheses being added.
\begin{equation}
\tag{2.5}\label{equation-aligned-eg}
\left.\begin{aligned}
 y_0&=n_0+n_1\\
 z_0&=r_0+r_1
\end{aligned}\right\}
\qquad \text{$Y_0$ equations}
\end{equation}
  which is rendered as  
( y 0 = n 0 + n 1 z 0 = r 0 + r 1 } Y 0  equations (2.5)
  There are a couple of points to note regarding the above example:
  • \left. is used in place of \left\{, to insert a 'phantom delimiter' that does not appear, but which makes the necessary match with the automatically sized right pairing delimiter \right\}. Recall that the \left and \right commands cause the pairing delimiters \{ and \} to be automatically sized.  (MathToWeb also supports \right.).
    Looking at the MathML for this example, we see that <mphantom>...</mphantom> tags are used to accomplish this effect.
  • On the second-last line we have \text{$Y_0$ equations}. A \text{...} call, in which there exists a nested inline math environment, $Y_0$. This is allowed in Latex and MathToWeb.
\begin{cases}
...
\end{cases}
  • subordinate
  • numbered by parent environment as a single equation
  • cases must be used inside: equation or equation*.
\begin{equation}
\tag{2.6}\label{eq:cases-eg}
\delta_{mn} = 
 \begin{cases}
  1& \text{if $n = m$}\\
  0& \text{if $n \neq m$}
 \end{cases}
\end{equation}
  which is rendered as  
δ mn = { 1 if  n = m 0 if  n m } (2.6)
Another example
\begin{subequations}
...
\end{subequations}
  • displayed
  • numbered subordinately using lower-case Latin letters (a, b, c,...) relative to the parent number.
  • With subequations you get a reference to the entire equation group (see  "\label{eq:group}"  below which is numbered 2.7).
  • The multi-equation display environments that can be used within subequations are:  gather, align and flalign.
    (The * forms of these are permissible also, however, there is not much point in this.)
\begin{subequations}\tag{2.7}\label{eq:group}
 \begin{align}
  a&=b+c+d\tag{2.7a}\label{eq:first}\\
  e&=f+g\tag{2.7b}\label{eq:second}\\
  h&=i+j+k+l\tag{2.7c}\label{eq:third}
 \end{align}
\end{subequations}
  which is rendered as  
a = b + c + d e = f + g h = i + j + k + l (2.7a)
(2.7b)
(2.7c)

Using the \intertext{...} command

MathToWeb supports the command \intertext{...} which is used to insert short interjectional remarks in the middle of multi-line display environments, while at the same time preserving alignment.

The following example was borrowed from section 3.10 of AMS User's Guide for the amsmath Package (Version 2.0)
(\tag{...} and \label{...} commands have been added).
The position of the word "and" is significant here. Notice that it is aligned on the page margin, rather than the equation margin.

\begin{align}
A_1&=N_0(\lambda;\Omega')-\phi(\lambda;\Omega'), \tag{2.8}\label{eq:align1}\\
A_2&=\phi(\lambda;\Omega')-\phi(\lambda;\Omega), \tag{2.9}\label{eq:align2}\\
\intertext{and}
A_3&=\mathcal{B}(\lambda;\omega).                \tag{3.0}\label{eq:align3}
\end{align}
                  
A 1 = N 0 ( λ ; Ω ' ) - φ ( λ ; Ω ' ) , A 2 = φ ( λ ; Ω ' ) - φ ( λ ; Ω ) , and A 3 = ( λ ; ω ) . (2.8)
(2.9)
()
(3.0)

Punctuation

General

. .  (period)
/ /   (forward slash)
| |
, ,  (comma)
; ;  (semi-colon)
: :  (colon)
: \colon
! !
? ?

Dots

\dotsb "dots with binary operators/relations"
\dotsc "dots with commas"
\dotsi "dots with integrals"
\dotsm "multiplication dots"
\dotso "other dots"
\ddots
\vdots

The commands  \cdots  and  \ldots  are also supported by MathToWeb, although the AMS literature encourages the use of the more
semantically oriented commands:   \dotsb, \dotsc, \dotsi, \dotsm and \dotso .

Examples:

a 1 + a 2 + + a n = i = 1 n a i $a_1 + a_2 + \dotsb + a_n = \sum_{i=1}^n a_i$("dots with binary operators/relations") MathML

L 1 ( x ) f ( x ) U 2 ( x ) U 1 ( x ) $L_1(x) \le \dotsb \le f(x) \dotsb \le U_2(x) \le U_1(x)$ MathML

P k = { x 0 , x 1 , , x n } $P_k = \{x_0,x_1, \dotsc, x_n\}$("dots with commas") MathML

K 1 K 2 K n $\int_{K_1} \int_{K_2} \dotsi \int_{K_n}$("dots with integrals") MathML

x ( x + 1 ) ( x + n ) $x(x+1) \dotsm (x+n)$("multiplication dots") MathML Other examples

Special 'escaped' characters

Care must be taken when using the following characters which are used internally by Latex and MathToWeb.
Each must be preceded by a \ character (a backslash) in order to have it interpreted properly, as the list below illustrates.
Note particularly, that curly braces are in this list.

\# \$ \% \& \~ \_ \^ \\ \{ \}

Note:  MathToWeb processes only the contents of Latex math environments, one of which is delimited by dollar symbols, $...$   (see AMS math environments).
If a dollar symbol is present anywhere else in a given document, either inside or outside of a math environment, it must be escaped using \$.

Example:

{ P # } $\{ P_{\#} \}$ MathML

Inserting MathToWeb comments

MathToWeb recognizes standard HTML/XML comments:    <!--    -->   .
It will skip-over any text between these delimiters, so if it is desirable to temporarily comment out certain LaTeX equations contained in your document, it can be done in this way.

Spaces

Example Syntax Command Synonym Description
uv u v - - - - - - - - normal spacing
uv u \, v \, \thinspace thin space
uv u \: v \: \medspace medium space
uv u \; v \; \thickspace thick space
uv u \quad v \quad - - - - quad space
uv u \qquad v \qquad - - - - double quad space

Example:

f ( x , y ) x y $\iint f(x,y) \;\, dx \, dy$ MathML

Accents

x˙ \dot{x} x \vec{x}
x¨ \ddot{x} x´ \acute{x}
x¯ \bar{x} x` \grave{x}
x^ \hat{x} x˘ \breve{x}
x˜ \tilde{x}

Primes

x x' or x^\prime
x x'' or x^{\prime\prime}
(Note: The  '  used above for both single and double primes is the single quotation mark from the keyboard.)

• Single or multiple characters can be underlined using code such as \underline{A} which is rendered as A .    A practical example is below.

• Any symbol can be typeset below or above a particular base character using the commands \underset and \overset.
  \underset{*}{A} A * \overset{*}{Z} Z *

f ' ( a ) = lim h 0 f ( a + h ) - f ( a ) h $f'(a) = \lim_{h \to 0} \frac{f(a+h)-f(a)}{h}$ MathML

a = a a ^ $\mathbf{a} = a \mathbf{ \hat{a} }$ MathML

r ¨ = ( x ¨ , y ¨ , z ¨ ) $\mathbf{ \ddot{r} } = (\ddot{x}, \ddot{y}, \ddot{z})$ MathML

e i = x k y i E k ${\underline{e}}_{\, i} = \frac{\partial x^k}{\partial y^i} {\underline{E}}_{\, k}$ MathML

Roots

The \sqrt command produces a square root. A different radix can be specified by making use of the optional argument (see the middle example below).

2 $\sqrt{2}$ 2 3 $\sqrt[3]{2}$ 1 - δ n N $\sqrt{\frac{1-\delta_n}{N}}$ MathML

Fractions

The \frac command takes two arguments, the numerator being the first and the denominator the second.

(At present, MathToWeb has limited support \dfrac and \tfrac (d=display-style, t=text-style), in that it will display them in the same way it does \frac.)

a b $\frac{a}{b}$

Example:

The example below was borrowed from the Short Math Guide for Latex, version 1.09,  p 12.

z = n π θ + ψ 2 ( θ + ψ 2 ) 2 + ( 1 2 log | B A | ) 2 . ()
\begin{equation}
\Re{z} = \frac{n\pi \dfrac{\theta +\psi}{2}}{
         \left(\dfrac{\theta +\psi}{2}\right)^2 + \left( \dfrac{1}{2}
         \log \left\lvert\dfrac{B}{A}\right\rvert\right)^2}.
\end{equation}

Binomials

The \binom command takes two arguments.

(At present, MathToWeb has limited support \dbinom and \tbinom (d=display-style, t=text-style), in that it will display them in the same way it does \binom.)

( a b ) $\binom{a}{b}$

Top and bottom embellishments

abcde ˜ \widetilde{abcde}
abcde ^ \widehat{abcde}
abcde \overline{abcde}
abcde \underline{abcde}
abcde \overbrace{abcde}
abcde \underbrace{abcde}
abcde \overleftarrow{abcde}
abcde \underleftarrow{abcde}
abcde \overrightarrow{abcde}
abcde \underrightarrow{abcde}
abcde \overleftrightarrow{abcde}
abcde \underleftrightarrow{abcde}

In addition, \overbrace can take a superscript and \underbrace a subscript:

\overbrace{abcde}^{123} abcde 123
\underbrace{abcde}_{123} abcde 123 Other examples

Examples:

AB + BC = AC $\overrightarrow{AB} + \overrightarrow{BC} = \overrightarrow{AC}$ MathML

( Δ n ) 2 ( n - n ¯ ) 2 $\overline{ { (\Delta n) }^2 } \equiv \overline{ { (n - \bar{n}) }^2 }$ MathML

Extensible horizontal arrows

\xleftarrow and \xrightarrow will widen automatically to accommodate the width of their superscripts and subscripts. These commands allow one optional argument (in square brackets) that represents the subscript, and have one mandatory argument (in curly braces) that represents the superscript.

  a     A   \xleftarrow[a]{A}   b     B   \xrightarrow[b]{B}

Examples:

A   α ± 2 - 1   B   H +     130 C   C $A \; \xleftarrow{\alpha \pm 2 - 1} \; B \; \xrightarrow[H^+]{{130}^\circ C} \; C$ MathML

  this converts to   $\xrightarrow{ \text{this converts to} }$ MathML

Extensible vertical arrows

\uparrow \uparrow \uparrow \uparrow \uparrow \uparrow

Example:

A 2 B 3 $\frac{A^2}{B^3} \uparrow$ MathML

Delimiter sizes

Pairing delimiters (see the next section) will not adjust their height to enclose their contents unless you specifically request it. This can be achieved using a pair of \big... prefixes (see the list below), which set the delimiters to a particular fixed size, or by using \left and \right, which causes auto-sizing.

The second example illustrates the use of the commands \left \right which auto-size the parentheses on which they act (these are absent in the first example, for comparison).

( A 2 b n ) $( \frac{A^2}{b_n} )$ MathML

( A 2 b n ) $\left( \frac{A^2}{b_n} \right)$ MathML

f 1 2 π { - π π f ( t ) e - i k t t } k $ f \mapsto \frac{1}{\sqrt{2 \pi}}
  \left\{\int_{-\pi}^\pi f(t) e^{-i k t} \, dt \right\}_{k \in \mathbb{Z}}$  
MathML


( ) \left \right \bigl \bigr \Bigl \Bigr \biggl \biggr \Biggl \Biggr
( ab) (ab) (ab) (ab) (ab) (ab)

Delimiters (extensible, pairing delimiters)

() ( )
[] [ ]
{} \{ \}or\lbrace \rbrace
|| \lvert \rvert
\lVert \rVert
\langle \rangle
\lceil \rceil
\lfloor \rfloor
\lmoustache \rmoustache

Examples:

( a b ) $\left( \frac{a}{b} \right)$ MathML

| f ( x + δ m ) - f ( x ) δ m | ζ $\left\lvert \frac{f(x+\delta_m) - f(x)}{\delta_m} \right\rvert \ge \zeta$ MathML

p 2 m = r V ( r ) $\left\langle \frac{\mathbf{p}^2}{m} \right\rangle =
   \langle \mathbf{r} \boldsymbol{\cdot} \boldsymbol{\nabla} V(r) \rangle$   
MathML

1 = n | u n u n | $1 = \sum_n \lvert u_n \rangle \langle u_n \rvert$ MathML

In the last example above, we have matched a \lvert delimiter (on the left), to a \rangle delimiter (on the right) and vise versa, demonstrating the point that any left pairing delimiter can, in fact, be matched to any right pairing delimiter.

Note:  MathToWeb pre-defines the function \abs{x}|x| so that it can be used directly.
In Latex, recommended practice is to place the following command in the preamble: \providecommand{\abs}[1]{\lvert#1\rvert}
(see section 6.2, Short Math Guide for Latex, version 1.09).

Extensible, non-pairing symbols

| \vert
\Vertor\|
/ /
\ \backslash

Examples:

u 3 4 | 1 2 $\frac{u^3}{4} \vert_1^2$ MathML

A 2 3 / B $\frac{A^2}{3} / B$ MathML

Functions (named operators)

Hyperbolic and trigonometric functions

arcsinh \arcsinh
arccosh \arccosh
arctanh \arctanh
arccsch \arccsch
arcsech \arcsech
arccoth \arccoth
sinh \sinh
cosh \cosh
tanh \tanh
csch \csch
sech \sech
coth \coth
arcsin \arcsin
arccos \arccos
arctan \arctan
arccsc \arccsc
arcsec \arcsec
arccot \arccot
sin \sin
cos \cos
tan \tan
csc \csc
sec \sec
cot \cot

The light-blue coloured operator names such as  \arcsinh  are supported by MathToWeb, but not by Latex where they would be handled using the command \DeclareMathOperator or \operatorname, see below (MathToWeb supports the latter).

Limits

lim \lim
lim inf \liminf
lim sup \limsup
lim \varprojlim
lim \varinjlim
lim \varliminf
lim \varlimsup
inj lim \injlim
proj lim \projlim

The command \textstyle can be applied to:  \lim  ,  \liminf  and   \limsup  .  See the first two limit examples below.

Other

arg \arg
deg \deg
det \det
dim \dim
exp \exp
gcd \gcd
hom \hom
inf \inf
ker \ker
lg \lg
ln \ln
log \log
max \max
min \min
Pr \Pr
sup \sup

Defining your own named operator using \operatorname{..}

Below we have defined a named operator which we call "skew":
\operatorname{skew}(x) skew ( x )

Note:  The most common Latex command for declaring new named operators is \DeclareMathOperator. This command is not yet supported by MathToWeb.

Examples:

cos 2 t = 1 + cos 2 t 2 $\cos^2 t = \frac{ 1 + \cos{2t} }{ 2 }$ MathML

log a x = ln x ln a $\log_a x = \frac{\ln x}{\ln a}$ MathML

lim n p n $\lim_{n \to \infty} p_n$ MathML

lim n p n $\textstyle\lim_{n \to \infty} p_n$ ( forcing \textstyle ) MathML

The above two examples are identical, with the exception that in the second, we have applied \textstyle to the \lim operator.
Forcing \textstyle on an operator such as \lim has the effect of shifting underscripts to subscripts and overscripts to superscripts, making the equation compact (in the vertical direction) and more suitable for inline display.
MathToWeb makes this command available for:   \lim,  \liminf  and  \limsup.

lim sup n c n n α $\limsup_{n \to \infty} \; \sqrt[n]{c_n} \le \alpha$ MathML

lim inf n c n + 1 c n $\liminf_{n \to \infty} \, \frac{c_{n+1}}{c_n}$ MathML

Placing text within an equation using \text{..}

Text can be inserted into the LaTeX of any equation environment using \text{...}.

It is important to note that, if required, inline LaTeX enviroments (i.e. $...$) can be nested within text,
e.g. \text{this inline equation, $A_i$ is nested within the text} (see the third example below).

The examples below should be adequate to demonstate the use of this command.

A means B $A \; \text{means} \; B$ (Recall that \; is a thick space. Below we use \qquad, a double quad space.)

n = - c n e i n x means lim N n = - N N c n e i n x
$\sum_{n=-\infty}^{\infty} c_n e^{inx} \qquad \text{means} \qquad \lim_{N \to \infty} \: \sum_{n=-N}^N c_n e^{inx}$ MathML

δ m n = { 1 if  n = m 0 if  n m } ()
 
\begin{equation*}
\delta_{mn} = 
 \begin{cases}
  1& \text{if $n = m$}\\
  0& \text{if $n \neq m$}
 \end{cases}
\end{equation*}
  MathML

Using \newcommand{..}[..]{..} and \renewcommand{..}[..]{..}

Use \newcommand to create your own Latex commands which you name and define using known Latex.
The command \renewcommand differs slightly from \newcommand, in that it is used to over-write an existing Latex command.
(Note: Use only lower- or upper-case letters when defining command-names, e.g. \mycommand{..}[..]{..}.)

These are good commands to use when the same Latex occurs at multiple locations in a particular document. Instead of typing it over and over, simply define a new command to represent it, and place that in your document at all the locations where it is required.

To use these commands with MathToWeb, place the \newcommand and \renewcommand declarations in HTML comments - anywhere in the document (see the example below).

The syntax of these commands is as follows:
('number of arguments', the optional argument in square brackets, must be an integer between 0 and 9 inclusive.)

\newcommand{\command-name}[number of arguments]{command text, using #1, #2 etc. to denote arguments}

Example:

x 1 i . . . x n i
<!--
\newcommand{\ki}[1]{#1_1^i ... #1_n^i}
-->
$\ki{x}$

As of version 2.0.3 (command-line variant only, at the moment), \newcommand declarations can be declared in an external text file and 'brought in' to a particular document using the -ncf option. An example of a command-line call using this option follows (the external \newcommand declarations are in myncf.txt):

>java -jar mathtoweb.jar -ncf myncf1.txt test.xml

If it is desirable to include more than one new-command file, separate them using commas, as follows:
>java -jar mathtoweb.jar -ncf myncf1.txt, myncf2.txt test.xml

Math font switches

The following math font switches are supported by MathToWeb:  \mathbf,  \mathbb,   \mathcal,  \mathfrak,  \mathit  and  \mathsf.
There use is described in more detail below.

Blackboard bold letters (no lower-case)

Usage:  \mathbb{A}

𝔸 𝔹 𝔻 𝔼 𝔽 𝔾 𝕀 𝕁 𝕂 𝕃 𝕄 𝕆 𝕊 𝕋 𝕌 𝕍 𝕎 𝕏 𝕐

Boldface letters

Usage:  \mathbf{A} (These are often used to denote vectors.)

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z     a b c d e f g h i j k l m n o p q r s t u v w x y z     1 2 3 4 5 6 7 8 9

Example:

A = r 2 - r 1 $\mathbf{A} = \mathbf{r}_2 - \mathbf{r}_1$ MathML

Calligraphic letters (no lower-case)

Usage:  \mathcal{A}

𝒜 𝒞 𝒟 𝒢 𝒥 𝒦 𝒩 𝒪 𝒫 𝒬 𝒮 𝒯 𝒰 𝒱 𝒲 𝒳 𝒴 𝒵

Fraktur letters

Usage:  \mathfrak{A}

𝔄 𝔅 𝔇 𝔈 𝔉 𝔊 𝔍 𝔎 𝔏 𝔐 𝔑 𝔒 𝔓 𝔔 𝔖 𝔗 𝔘 𝔙 𝔚 𝔛 𝔜 𝔞 𝔟 𝔠 𝔡 𝔢 𝔣 𝔤 𝔥 𝔦 𝔧 𝔨 𝔩 𝔪 𝔫 𝔬 𝔭 𝔮 𝔯 𝔰 𝔱 𝔲 𝔳 𝔴 𝔵 𝔶 𝔷

Example:

d 𝔑 = 𝔉 1 σ d Ω $d\mathfrak{N} = \mathfrak{F}_{1\sigma} \; d\Omega^\prime$ MathML

Italic letters

Usage:  \mathit{A}

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z     a b c d e f g h i j k l m n o p q r s t u v w x y z     1 2 3 4 5 6 7 8 9

Sans-serif letters

Usage:  \mathsf{A}

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z     a b c d e f g h i j k l m n o p q r s t u v w x y z     1 2 3 4 5 6 7 8 9

Greek letters

Δ \Delta
Γ \Gamma
Λ \Lambda
Ω \Omega
Φ \Phi
Π \Pi
Ψ \Psi
Σ \Sigma
Θ \Theta
ϒ \Upsilon
Ξ \Xi
α \alpha
β \beta
χ \chi
δ \delta
ε \epsilon
η \eta
γ \gamma
ι \iota
κ \kappa
λ \lambda
μ \mu
ν \nu
ω \omega
φ \phi
π \pi
ψ \psi
ρ \rho
σ \sigma
τ \tau
θ \theta
υ \upsilon
ξ \xi
ζ \zeta
ϝ \digamma
ϵ \varepsilon
ϰ \varkappa
ϕ \varphi
ϖ \varpi
ϱ \varrho
ς \varsigma
ϑ \vartheta

Bold Greek:  \boldsymbol{\alpha}

Δ Γ Λ Ω Φ Π Ψ Σ Θ ϒ Ξ     α β χ δ ε η γ ι κ λ μ ν ω φ π ψ ρ σ ε φ τ θ υ ξ ζ     ϝ ϵ ϰ ϕ ϖ ϱ ς ϑ

Example:

${(\mathbf{A} \times \mathbf{B})}_{\alpha} = \epsilon_{\alpha \beta \gamma} A_{\beta} B_{\gamma}$

( A × B ) α = ε α β γ A β B γ MathML

Bold math symbols in general

Most math symbols can be rendered in bold type using the command \boldsymbol or \pmb ("poor man's bold").
These are meant to be applied to only one symbol at a time.

Usage:  \boldsymbol{\somechar}

± normal
± bold

Example:

$D_{\infty} \sim \boldsymbol{\pi} \mathbf{D}_{\boldsymbol{\infty}} \boldsymbol{+} \boldsymbol{\dotsb}$

D π D +

Symbols

Many people will be familiar with the Short Math Guide for Latex, version 1.09 (written by Michael Downes). Several of the symbol tables below have been made to resemble the tables in this excellent publication as closely as possible.

Common symbols

\infty
\hslash
\partial
\nabla
\emptyset
\exists
\nexists
\forall
\Re
\Im
\in
\parallel
\perp
\propto
\because
\therefore

Other less common symbols

\aleph
\beth
\daleth
\gimel
\complement
\ell
\mho
\wp
\circledS
#\#
&\&
\angle
\backprime
\bigstar
\blacklozenge
\blacksquare
\blacktriangle
\blacktriangledown
\bot
\clubsuit
\diamondsuit
\flat
\heartsuit
\lozenge
\measuredangle
\natural
¬\neg
\sharp
\spadesuit
\sphericalangle
\square
\surd
\top
\triangle
\triangledown
\varnothing

Binary operator symbols

**
++
--
\amalg
*\ast
\barwedge
\bigcirc
\bigtriangledown
\bigtriangleup
\boxdot
\boxminus
\boxplus
\boxtimes
\bullet
\cap
\Cap
\cdot
·\centerdot
\circ
\circledast
\circledcirc
\circleddash
\cup
\Cup
\curlyvee
\curlywedge
\dagger
\ddagger
\diamond
÷\div
\divideontimes
\dotplus
\doublebarwedge
\gtrdot
\intercal
\leftthreetimes
\lessdot
\ltimes
\mp
\odot
\ominus
\oplus
\oslash
\otimes
±\pm
\rightthreetimes
\rtimes
\setminus
\smallsetminus
\sqcap
\sqcup
\star
×\times
\triangleleft
\triangleright
\uplus
\vee
\veebar
\wedge
\wr

Relation symbols:  <  =  >  ~   and variants

< <
> >
= =
\approx
\approxeq
\asymp
\backcong
\backsim
\backsimeq
\Bumpeq
\bumpeq
\circeq
\cong
\coloneq
\curlyeqprec
\curlyeqsucc
\doteq
\doteqdot
\eqcirc
\eqcolon
\eqslantgtr
\eqslantless
\esim  ( \eqsim )
\equiv
\fallingdotseq
\geq  ( \ge )
\geqq
\geqslant
\gg
\ggg  ( \Gg, \gggtr )
\gnapprox
\gneqq
\gneq
\gnsim
\gtrapprox
\gtrdot
\gtreqless
\gtreqqless
\gtrless
\gtrsim
\gvertneqq
\leq  ( \le )
\leqq
\leqslant
\lessapprox
\lessdot
\lesseqgtr
\lesseqqgtr
\lessgtr
\lesssim
\ll
\lll  ( \Ll, \llless )
\lnapprox
\lneqq
\lneq
\lnsim
\lvertneqq
\napprox
\ncong
\neq  ( \ne )
\nequiv
\ngeq
≧̸ \ngeqq
⩾̸ \ngeqslant
\ngtr
\nleq
≦̸ \nleqq
⩽̸ \nleqslant
\nless
\nprec
\npreceq
\nsim
\nsimeq
\prec
\precapprox
\preccurlyeq
\preceq
\precnapprox
\precneqq
\precnsim
\precsim
\questeq
\risingdotseq
\sim
\simeq
\succ
\succapprox
\succcurlyeq
\succeq
\succnapprox
\succneqq
\succnsim
\succsim
\thickapprox
\thicksim
\triangleq

Relation symbols:  arrows

\circlearrowleft
\circlearrowright
\curvearrowleft
\curvearrowright
\downdownarrows
\downharpoonleft
\downharpoonright
\Downarrow
\hookleftarrow
\hookrightarrow
\leftarrow  ( \gets )
\Leftarrow
\leftarrowtail
\leftharpoondown
\leftharpoonup
\leftleftarrows
\leftrightarrow
\Leftrightarrow  ( \iff )
\leftrightarrows
\leftrightharpoons
\leftrightsquigarrow
\Lleftarrow
\longleftarrow
\Longleftarrow
\longleftrightarrow
\Longleftrightarrow
\longmapsto
\longrightarrow
\Longrightarrow
\looparrowleft
\looparrowright
\Lsh
\mapsto
\multimap
\nLeftarrow
\nLeftrightarrow
\nRightarrow
\nearrow
\nleftarrow
\nleftrightarrow
\nrightarrow
\nwarrow
\rightarrow  ( \to )
\Rightarrow
\rightarrowtail
\rightharpoondown
\rightharpoonup
\rightleftarrows
\rightleftharpoons
\rightrightarrows
\rightsquigarrow
\Rrightarrow
\Rsh
\searrow
\swarrow
\twoheadleftarrow
\twoheadrightarrow
\Uparrow
\updownarrow
\Updownarrow
\upharpoonleft
\upharpoonright
\upuparrows

Relation symbols:  miscellaneous

϶ \backepsilon
\because
\between
\blacktriangleleft
\blacktriangleright
\bowtie
\dashv
\frown
\in
\mid
\models
\ni or \owns
\nmid
\notin
\nparallel
\nshortmid
\nshortparallel
\nsubseteq
⫅̸ \nsubseteqq
\nsupseteq
⫆̸ supseteqq
\ntriangleleft
\ntrianglelefteq
\ntriangleright
\ntrianglerighteq
\nvdash
\nVdash
\nvDash
\nVDash
\parallel
\perp
\pitchfork
\propto
\shortmid
\shortparallel
\smallfrown
\smallsmile
\smile
\sqsubset
\sqsubseteq
\sqsupset
\sqsupseteq
\subset
\Subset
\subseteq
\subseteqq
\subsetneq
\subsetneqq
\supset
\Supset
\supseteq
\supseteqq
\supsetneq
\supsetneqq
\therefore
\trianglelefteq
\trianglerighteq
\varpropto
⊊︀ \varsubsetneq
⫋︀ \varsubsetneqq
⊋︀ \varsupsetneq
⫌︀ \varsupsetneqq
\vartriangle
\vartriangleleft
\vartriangleright
\vdash
\Vdash
\vDash
\Vvdash

Integrals, sums and other variable-size operators

\int
\iint
\iiint
\iiiint
\idotsint
\oint
\oiint
\sum
\prod
\coprod
\bigcup
\bigcap
\bigsqcup
\biguplus
\bigvee
\bigwedge
\bigodot
\bigoplus
\bigotimes

The \textstyle command can be applied to any of the above operators. It must be placed so that it immediately precedes the operator on which it acts, for example $\textstyle\int xdx$ (several examples are below).

Examples:

f ( x ) d x $\int f(x)\,dx$ a b f ( x ) d x $\int_a^b f(x)\,dx$ a b f ( x ) d x $\textstyle\int_a^b f(x)\,dx$

f ( x , y , z ) d x d y d z $\iiint f(x,y,z) \;\, dx \, dy \, dz$ f ( x , y , z ) $\textstyle\iiint f(x,y,z)$

V Φ 2 φ d V $\iiint_V \Phi \boldsymbol{\nabla}^2\phi \;\, dV$

C A d r $\oint_C \mathbf{A} \boldsymbol{\cdot} \, d\mathbf{r}$

Δ S d S $\oiint_{\Delta S} \; d\mathbf{S} \circ $

f ( x 1 , , x k ) d x 1 d x k $\idotsint f(x_1,\dotsc , x_k) \:\, dx_1 \dotsc dx_k$

k = 1 n c k $\sum_{k=1}^n c_k$ k = 1 n c k $\textstyle\sum_{k=1}^n c_k$

i = 1 k ( 1 - u i ) $\prod_{i=1}^k (1-u_i)$ i = 1 k ( 1 - u i ) $\textstyle\prod_{i=1}^k (1-u_i)$

n = 1 A n $\bigcup_{n=1}^\infty A_n \in \mathcal{R}$ n = 1 A n $\textstyle\bigcup_{n=1}^\infty A_n$

n = 1 A n $\bigcap_{n=1}^\infty A_n \in \mathcal{R}$ n = 1 A n $\textstyle\bigcap_{n=1}^\infty A_n$

Δ S ( × A ) n d S $\iint_{\Delta S} (\boldsymbol{\nabla} \times \mathbf{A} ) \boldsymbol{\cdot} \mathbf{n} \; dS$

8 a 5 5 φ = 0 π / 2 θ = 0 π /2 sin θ d θ d φ
$\frac{8a^5}{5} \int_{\phi=0}^{\pi/2} \; \int_{\theta = 0}^{\pi/2} \sin{\theta} \;\, d\theta \, d \phi$

The \substack command

The \substack command is used to create multi-line subscripts or superscripts, usually on sums, but it can be used elsewhere.

A B $\sum_{\substack{A \\ B}}$ A B C D $\sum_{\substack{A \\ B}}^{\substack{C \\ D}}$

0 i m 0 j n A ij $\sum_{\substack{0 \le i \le m \\ 0 \le j \le n}} A_{ij}$

lim x x B x D I ( x , t ) $\lim_{\substack{x \to x^\circ \in B \\ x \in D}} \; I(x,t)$

The \nolimits command

The \nolimits command can be used to force limits from an over/under configuration to that of superscript/subscript. It must be placed immediately to the right of the base to which it applies (see the examples below).

a b f ( x ) d x $\int_a^b f(x)\,dx$    compare to    a b f ( x ) d x $\int\nolimits_a^b f(x)\,dx$

Note: When requiring "textstyle", MathToWeb will sometimes give more satisfactory results if \nolimits is used in addition to \textstyle (see the examples below).

a b f ( x ) d x $\textstyle\int\nolimits_a^b f(x)\,dx$ n = 1 A n $\textstyle\bigcup\nolimits_{n=1}^\infty A_n$

Matrices

Note: Although it hasn't been shown, the matrix structures below must be placed inside some sort of math environment to have them display properly in a browser. The unnumbered display environment, \begin{equation*} ... \end{equation*} works well for the purpose of testing.

\begin{matrix}
a&b\\
c&d
\end{matrix}
a b c d
\begin{smallmatrix}
a&b\\
c&d
\end{smallmatrix}
a b c d
To place pairing delimiters
such as parentheses around this:
\bigl( \begin{smallmatrix}
a&b\\
c&d
\end{smallmatrix} \bigr)
               ( a b c d )
\begin{pmatrix}
a&b\\
c&d
\end{pmatrix}
( a b c d )
\begin{bmatrix}
a&b\\
c&d
\end{bmatrix}
[ a b c d ]
\begin{Bmatrix}
a&b\\
c&d
\end{Bmatrix}
{ a b c d }
\begin{vmatrix}
a&b\\
c&d
\end{vmatrix}
| a b c d |
\begin{Vmatrix}
a&b\\
c&d
\end{Vmatrix}
a b c d

Example:

( a 11 a 1 n a m 1 a mn )
\begin{pmatrix}
 a_{11} & \dotsm & a_{1n} \\
 \vdots & \ddots & \vdots \\
 a_{m1} & \dotsm & a_{mn}
\end{pmatrix}
Another example

Boxed formulae

The \boxed{...} command places a box around its argument.

ζ ϕ ( z ) Ψ φ ( z ) z η $\boxed{ \zeta_\varphi(z) \equiv \Psi_\phi(z) \quad \forall \; z \geq \eta }$

Cross-referencing your equations



Examples

\overbrace

$\overbrace{a + ar + ar^2 + \dotsb = \frac{a}{1-r}}^{ \text{converges if and only if $|r| < 1$} }$

a + a r + a r 2 + = a 1 - r converges if and only if |r| < 1 MathML

\underbrace

$\underbrace{A_p = g_{pq}A^p}_{ \text{ For rectangular coordinates $g_{pq}=1$ if $p=q$, and $0$ if $p \neq q$ } }$

A p = g pq A p  For rectangular coordinates  g pq =1 if p=q, and 0 if p ≠ q  MathML

\ddots and \vdots

( a 11 - λ a 1 n a n 1 a nn - λ ) ( x 1 x n ) = 0 ()
\begin{equation*}  
{
 \begin{pmatrix}
 a_{11}-\lambda & \dotsm & a_{1n} \\
 \vdots & \ddots & \vdots \\
 a_{n1} & \dotsm & a_{nn}-\lambda
 \end{pmatrix}
}
{
 \begin{pmatrix}
 x_1 \\
 \vdots \\
 x_n
 \end{pmatrix}
}
{
 = \mathbf{0}
}
\end{equation*}
MathML

split    inside    equation

This example was borrowed from section 3.4 of AMS User's Guide for the amsmath Package (Version 2.0).
(One addition to this code was made, the \tag{1} command on the second line, which is required by MathToWeb, but optional in Latex.)

\begin{equation}
\tag{1}\label{e:barwq}
\begin{split}
 H_c&=\frac{1}{2n} \sum^n_{l=0}(-1)^{l}(n-{l})^{p-2}
 \sum_{l _1+\dots+ l _p=l}\prod^p_{i=1} \binom{n_i}{l _i}\\
 &\quad\cdot[(n-l )-(n_i-l _i)]^{n_i-l _i}\cdot
 \Bigl[(n-l )^2-\sum^p_{j=1}(n_i-l _i)^2\Bigr].
\end{split}
\end{equation}

H c = 1 2 n l = 0 n ( - 1 ) l ( n - l ) p - 2 l 1 + + l p = l i = 1 p ( n i l i ) [ ( n - l ) - ( n i - l i ) ] n i - l i [ ( n - l ) 2 - j = 1 p ( n i - l i ) 2 ] . (1)
MathML

cases    inside    equation

\begin{equation}
\tag{2}\label{eq:cases-eg}
H(j\omega) = 
 \begin{cases}
  e^{-j\omega\,t_0}& \text{for $\abs{\omega} < \omega_c$}\\
  0& \text{for $\abs{\omega}>\omega_c$}
 \end{cases}
\end{equation}

H ( j ω ) = { e - j ω t 0 for  | ω | < ω c 0 for  | ω | > ω c } (2)
MathML