Menu:

Since a lot of mathematicians would like to incorporate formulae into their webpages but using online is not necessarily what people consider to be nice and easy (or let's rather say it used to be that way), I would like to use this platform to advertise MathJax.

MathJax is an open source JavaScript display engine designed to render , MathML, AsciiMath, and more requiring minimal to none-at-all HTML skills. Furthermore it can be used/"installed" without admin rights on your server and works with many a browser, including IE, Firefox, Chrome, Safari, Opera, Konquerer, iPad/iPhone/iTouch/iWhateverAppleReleasedLastWeek, Android, BlackBerry, and many more. Cutting to the chase, I will just finish off with quoting the MathJax webpage and tell you how to get up and running (I'll just focus on as I think it will be most convenient for the majority of users)

"No more setup readers. No more browser plugins. No more installations... It just works."

The easy way

Enabling on your webpage consists of two steps.

  1. Add the lines
    
    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
    </script>
    		    
    directly above the
    </head>
    tag at the beginning of your HTML file. This will load the most recent MathJax libraries including AMS Math support.
  2. In order to display you need to use
    
    <script type="math/tex">
      % insert LaTeX code here
    </script>
    		    
    This will trigger inline , e.g.,
    
    This is a <script type="math/tex">\LaTeX</script> example.
    		    
    yields

    This is a example.

    Of course, there is also display style. If you want to use display style you need to change the type-attribute from "math/tex" to "math/tex; mode=display", e.g.,
    
    I believe in  <script type="math/tex; mode=display">\tag{$*$}\forall X:\ 
    \left(\ \emptyset\notin X\ \Rightarrow\ \exists f:\ X\to\bigcup X\ \forall x\in X:\ 
    f(x)\in x\ \right).</script> Therefore, I am a religious man.
    		    
    yields

    I believe in Therefore, I am a religious man.

    This last example also demonstrates the use of '\tag' to label your formulae and shows that '$' works the way we expect it to.

Now, that's all you need. Happy ing!

A wee less basic coding

Unfortunately human nature makes us stick to our routines. So most of us will not like to use these script-tags. How are we going to circumvent that? Well, we need to configure MathJax (in fact, the '?config=TeX-AMS-MML_HTMLorMML' extension already forces a specific configuration which should be sufficient for beginners and includes the configuration I am going to add; still the following lines allow you to define your own delimiters which is why I talk about this). Extending


<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
		    
to

<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
  MathJax.Hub.Config({
    tex2jax: { inlineMath: [['$','$'],['\\(','\\)']] }
  })
</script>
		    
will turn out quite handy. With these three additional lines we defined new delimiters. Each set of delimiters is of the form

['<some string of symbols>','<another string of symbols>']

where the first string of symbols marks the delimiter to begin the sequence of code to be interpreted as and the second string marks the end. In other words, the bracket

['$','$']

tells MathJax that '$' marks beginning and end of snippets. Defining these delimiters enables you to use '$\LaTeX$' for inline math and '$$' for display style; by the way, the latter should also work without explicitly 'configuring' MathJax. However, note that if you choose to allow '$' to act as a delimiter then you will end up with problems if you try to use the '$' symbol as the browser will always interpret it as delimiter.

The other bracket in the bracket of the MathJax configuration lines define other delimiters. These are


\( \LaTeX \)
		      
for inline math mode and

\[ \LaTeX \] 
		      
for display syle. Both these delimiters should also work without explicit configuration of MathJax.

The outermost brackets of

[['$','$'],['\\(','\\)']]

are to mark the list of defined delimiters and you may add as many delimiters as you wish to that list (separated by commas).

Local Installations

There are various reasons for you to consider getting a copy of MathJax in your file system. The easiest way to do so, is to visit the MathJax download section and download your preferred release. If you open the mathjax/test directory you can run the index.html with your preferred browser and test the MathJax default configuration (you should also ensure that the image fallback works properly). Then you are all set to actually link MathJax into your webpage. Therefore you need replace the snippet


<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
		    
we added in the very first step by

<script type="text/javascript" src="path/to/MathJax.js">
</script>
		    
If you unpacked MathJax into your main folder then the relative path should be just

mathjax/MathJax.js
		    
That's it! Be careful though, there might be other MathJax.js files deep down in the mathjax directory. You will definitely want to use the one in the top directory (that is, where the LICENSE and README files are). Do not use the MathJax.js file in the 'unpacked' directory or any other well-hidden.

If you have admin rights of your server then you can also use git to obtain and maintain MathJax. To retrieve the current version from the GitHub repository use


git clone git://github.com/mathjax/MathJax.git MathJax
		    
You can check for updates with

cd MathJax
git remote show origin
		    
and if updates are available, use

cd MathJax
git pull origin
		    
to retrieve the current version. Note that the current version might not be the most stable version. To be safe you may want to use one of the tagged versions. You can see all tagged versions using

cd MathJax
git tag -1
		    
and install your preferred version via

cd MathJax
git checkout tag_name
		    
where 'tag_name' needs to be replaced by your preferred tag. In order to upgrade to a new release, repeat this for the latest release tag. You may also check for patched versions via

cd MathJax
git branch
		    
which will return a list of available branches. Main releases have separate branches and a '-latest' appended. You can check them out precisely the way you retrieve tagged version, i.e.,

cd MathJax
git checkout v2.1-latest
		    
will install the current patch of the v2.1 tagged release, for instance. You can update a branch using

cd MathJax
git pull origin v2.1-latest
		    

I hope this short introduction was helpful. For further information (and a proper documentation), please visit the MathJax webpage.