This repo is based on the Gruntfile here and the guidance here. It's a good idea to read those pages before using this tool.
You'd use this repo for quickly generating a customised, stripped-down version of MathJax for offline use. You customise what is going to be left in your offline version, and the Grunt script discards everything else.
If you're happy to use the offline version we've created for TeX input with SVG output, unzip build.zip
and place these contents into your own mathjax
or similar folder:
extensions
jax
MathJax.js
LICENSE
We've done this in the build
folder here for demo purposes. You can see that in action here.
You'll also need to add a MathJax config to your page (as a Javascript object). See index.html
here for an example. Note that the config script element appears before the link to MathJax.js
.
If you want a different offline package:
-
You must have Grunt installed. If you don't yet, follow the official instructions. Or:
start by updating npm:
npm update -g npm
then run
npm install -g grunt-cli
-
Open this folder in a terminal and run
npm install
to install the necessarynode_modules
. -
The master version of MathJax is tracked as a Git submodule in this repo. To get the files, run
git submodule init && git submodule update
in this folder. That will clone the latest version of MathJax into theMathJax-master
folder. In future, to update the MathJax files,cd MathJax-master && git fetch && git merge
. -
Copy into the root of this repo only these from
MathJax-master
:- all folders
MathJax.js
LICENSE
(Some of the files in
MathJax-master
have the same names as ones we need in this repo's root, such aspackage.json
andREADME.md
. Don't overwrite those! This is also why we have edited the list undernotcode
in the Gruntfile, or we'd lose our files, too.) -
In
Gruntfile.js
, change which lines we've commented out already in thetemplate
task (lines 324 to 365). You comment out a line to keep a component. Anything not commented out gets removed (cleaned) from your offline MathJax. -
Run
grunt template
. -
Use the MathJax files that remain in the project root for your website.