Fork me on GitHub

Live LaTeX rendering with AngularJS and MathJax

This is a small angular module to allow live editing of math using MathJax in an AngularJS app.

Use the MathJax CDN, configure inline math with dollar signs, and allow escape characters by adding the following to your header:

<script type="text/x-mathjax-config">
	MathJax.Hub.Config({
		tex2jax: {
		    inlineMath: [['$','$'], ['\\(','\\)']],
		    processEscapes: true
		    }
	});
</script>
<script type="text/javascript" src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>

Once you have a string in scope as "exampleText", you can set up the live rendering using

<span mathjax-bind=exampleText"></span>

Here is an example. Edit the text in the box below to see the results: