Recent Changes · Search:

Support the Project

Wikipublisher

PmWiki

edit SideBar

 

Equations: Typesetting mathematical equations

What support is there for including equations in Web pages?


Mediæval writing desk

The Wikipublisher library includes a recipe based on the LatexRender php class library, which allows authors to display equations on the Web and in print. Equation (1) illustrates the capabilities and shows the equation is numbered automatically.

(1)\displaystyle\int_{0}^{1}\frac{x^{4}\left(1-x\right)^{4}}{1+x^{2}}dx = \frac{22}{7}-\pi

The recipe uses LATEX and ImageMagick to generate a gif image of the equation for Web display. This approach guarantees that the Web and print versions are the same. To insert an equation, wrap TEX equation markup in the {$ ... $} tags.

By default, equations are unnumbered. The above example uses the {$uniqueID, ... $} markup variant, which assigns a label and number. Authors can refer to a labelled equation using the EQ(uniqueID) cross-reference markup (like the FIG, TAB and DIV cross-reference markup). The Eq(uniqueID) variant capitalises the first letter. The following equation is unnumbered with colour:

{\color{red} e^{2\pi i}-1\,=\,0}

Authors can also write multi-line equations, e.g. equation (2):

(2)\mathbf{X} =
\left( \begin{array}{ccc}
x_{11} & x_{12} & \ldots \\
x_{21} & x_{22} & \ldots \\
\vdots & \vdots & \ddots
\end{array} \right)

The above markup techniques are suitable for inline equations or ones that “stand alone”. However, we often want to put several equations together, aligned on the = sign or other relational symbol. If 2 or more consecutive lines start and end with {$ ... $} markup, this is interpreted as a set of aligned equations. In the following example, the first equation line starts with {$*; the * suppresses the numbering that LATEX will otherwise generate for this environment.

(a + b)^3 &= (a + b) (a + b)^2 \\
                  &= (a + b) (a^2 + 2ab + b^2) \\
                  &= a^3 + 3a^2b + 3ab^2 + b^3

Discussion of TEX equation markup is beyond the scope of this tip. There are more examples at LATEX Equations and Aligned Equations.

Interested readers may wish to view the source of the current page.

Category: markup

« 00024 · Edit Form · 00026 »

Creative Commons License
Edit · History · Print · Recent Changes · Search · Links
Page last modified on 21 November 2016 at 03:05 PM