# MathJax Wrapper for Dart

A very basic set of wrapper functions for using the MathJax javascript display engine for mathematics in Dart.

## Basic Usage

MathJax crawls through the document and processes the LaTeX and MathML present inside '\]' and '\]' tags.

For example, it will convert the latex from the following

```
<div> \[ A = \pi r^2 \] <\div>
```

to a beautifully typeset equation.

### Initialization and Static Processing

The package must be initialized to use. This imports the javascript file and processes the content present at the time.

```
mathJaxInit();
```

### Processing Dynamically Inserted Elements

Subsequent calls to mathJaxInit() will not update content added after the initial call. To have MathJax process dynamically added elements, use

```
mathJaxProcess([element]);
```

where element can be:

- dart elements;
- element id strings (without the #);
- a list where each element is either of the above; or
- null/empty, in which case the entire document is processed.

Note: there are more optional arguments to mathJaxProcess for rare occurances - see documentation for full details.

## Helper functions

At the moment, there is a single helper function,

```
String latexEquation(String s)
```

which adds the '\\`' and '\\`

' needed by MathJax, and \\begin{equation} and \\end{equation} used in LaTeX around the String s.

## See also

## Author

Dominic Jack

Feel free to contact me with issues, bug reports, suggestions, or if you'd like to expand on this minimalist base.

Note: Just to be clear, these author details are for the wrapper only. MathJax, MathML and LaTeX are large projects that have been running for quite some time, and I have no involvement with any.