MathJAX is a library for rendering Math expressions within a web page. It supports both MathML and LaTex expressions.

## Install MathJax library, using the script

For users with a Unix machine, you can use the following bash scripts to download and install MathJax.

- TAO 2.5: mathjaxdl_tao25.sh
- TAO 2.6: mathjaxdl_tao26.sh
- TAO 3.0: MathJax_Install_TAO_3x.sh

Be sure to have `wget`

(or `curl`

with 3.0 version), `tar`

and `gzip`

installed and available in your `PATH`

. Then just launch it (as a user, not root) from the root of your TAO distribution.

## Install MathJax library manually

MathML is not rendered natively in all browsers. Firefox and Safari are among the only one that render it natively. To ensure a consistent cross-browser experience in TAO, we rely on a third-party MathML library called MathJax. Because of license compatibility issue, it cannot be included within the default TAO package. That is why you need to install this library separately to enable math expression in your items.

You can download it freely here and unzip it into the following folder: `{YOUR_TAO_ROOT}/taoQtiItem/views/js/mathjax`

. Your file system should look like the enclosed screenshot below.

## Shrink MathJax

MathJax is a huge lib which weighs above 20MB unzipped. It is recommended to shrink it so only required files remain to display MathML properly in TAO. Indeed, on compilation, every compiled item containing MathML would have the whole library copied. So using the instruction below can help reducing its size down to 4.2MB. This solution has been tested so math expressions are still correctly rendered on most used browsers: Firefox, Chrome, Safari and IE8.

Frist delete the following folders:

- mathjax/docs/
- mathjax/test/
- mathjax/unpacked/
- mathjax/fonts/HTML-CSS/TeX/otf/
- mathjax/fonts/HTML-CSS/TeX/svg/

Then in the `mathjax/config/`

folder, delete all files but `TeX-AMS-MML_HTMLorMML-full.js`

, which is the only config file used in TAO.

An already shrunk Mathjax archive is available here.

## Keep MathJax sources untouched

To keep the full MathJax package, just add the `—keep-full`

option when the script is called.