OK, so chat is now available... but; it has been suggested that for Mathematics we should have TeX support.

The current TeX processing has some non-trivial client impact. Before I even attempt trying to hack this in, is this something that the community would want / use?

(this would only apply to maths rooms, and would presumably only apply to posts written with what is, for other sites, the fixed-font indent - i.e 4 spaces)

Well first of all, there currently aren't that many users of that chat room. Unless more people show up to use it, $\TeX$-ing it up may well end up to be a waste of your time. – J. M. Nov 6 '10 at 12:11
We were just now lamenting the lack of TeX support in chat. Would it be possible to reconsider this? – Glen Wheeler May 11 '11 at 19:26
Half a year has passed after the comment by @Glen. If there are any news? Chat still seem to have a lack of TeX support. – Ilya Dec 2 '11 at 9:36
My old comment is now irremediably false, as there's now a bunch of us discussing math and a bunch of other stuff animatedly on chat... – J. M. Dec 6 '11 at 15:12
Is there anyone who is enough of a coding wizard that can put things together into a working Greasemonkey script that continually re-TeXs the page? Having to click a bookmark is crazy when things like this script exist and don't require clicking anywhere for it to work. – kahen Oct 22 '12 at 0:51
Corresp. feature request: Why is there no support for MathJax in chat? – Grigory M Jul 16 '14 at 13:30
There is a user script now; see here. (I tried to post this as an answer, but it was auto-converted. Huh.) – Raphael Sep 19 at 16:41

5 Answers 5

There are four bookmarks which are located on this installation page:

  1. start ChatJax installs MathJax and starts a loop that renders $\LaTeX$ as needed. This is intended for use in chat, where the contents of the page are not static. Reloading the page will stop the loop, so the bookmark needs to be run again.

  2. render MathJax installs MathJax and renders $\LaTeX$ once per execution. This is intended for use on web pages where the contents of the page are static.

  3. rendering off disables MathJax while editing. This is useful when rendering is slow while editing questions and answers.

  4. rendering on enables MathJax after being disabled by rendering off.

If you are simply interested in getting the bookmarks mentioned above, there is no need to read further. Just go to this installation page.

There is a section at the bottom of the installation page to install ChatJax on a browser that cannot add bookmarks using drag-and-drop or a contextual menu.

If you are still having trouble installing on an iOS device, see this answer on Ask Different.

I would nominate you to a Hacker badge if I could. – Asaf Karagila Dec 6 '11 at 8:58
@Asaf: It's okay, I got a Necromancer badge for this answer. :-) – robjohn Dec 6 '11 at 10:30
To get automatic processing, register the code above as a callback to the global AJAX complete event: $('html').ajaxComplete(function() { ... }); Warning: this is just a hack and will cause MathJax to be reloaded on each use. – Zhen Lin Dec 6 '11 at 11:39
@ZhenLin: Thanks! I have added your automatic processing addition. – robjohn Dec 6 '11 at 13:06
Here is how to handle the bookmark bar in Chrome. Create an empty bookmark, copy all of the text above starting with "javascript:(function(){if(window.MathJax'" into the destination for a bookmark in the bar. – robjohn Jan 4 '12 at 13:53
How persistent is the (Cloudfront) site hosting MathJax.js? – Willie Wong Jan 5 '12 at 10:20
@Willie: if you are asking about "d3eoax9i5htok0", this explains the weird domain name. – robjohn Jan 5 '12 at 22:15
@robjohn: thanks. That's precisely what I was wondering about. BTW: thanks for the bookmark! – Willie Wong Jan 6 '12 at 9:04
Alert! Linux and Windows versions have different bookmarking with Google Chrome but the combo SHIFT+CTRL+B should show you the bookmark -bar. – hhh Mar 20 '12 at 7:54
@Willie: the cloudfront.net url seems to be down, so I am switching to the mathjax.org url since that is what the main site uses. – robjohn Jun 6 '12 at 17:09
For some odd reason, single $...$ -thing does not work in Twitter but the double $$...$$ -thing works, odd, investigating... – hhh Sep 2 '12 at 1:28
note to myself: click on Firefox bookmark whenever I enter math chat – Theta33 Mar 2 '13 at 19:58
@Theta30 I bet some greasemonkeying could save you that click – Tobias Kienzler Mar 21 '13 at 14:34
Does this only work for SE or any website? – Alyosha Apr 6 '13 at 21:40
The render MathJax and start ChatJax bookmarks will work on any website. The rendering off and rendering on bookmarks only work on websites that use MathJax. – robjohn Apr 7 '13 at 3:31

yes please! That would be excellent!


Revision 3. This one actually has a working loop, and uses jQuery instead of directly injecting a script element.

Unfortunately, it seems that new chat messages no longer trigger the ajaxComplete event, so my hack has to be replaced with a different one. This one runs MathJax on a 1-second cycle.



Source code:

(function () {
    if (window.MathJax === undefined) {
        jQuery.getScript('http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML', function () {
                "HTML-CSS": {
                    preferredFont: "TeX",
                    availableFonts: ["STIX", "TeX"],
                    linebreaks: {
                        automatic: true
                    EqnChunk: (MathJax.Hub.Browser.isMobile ? 10 : 50)
                tex2jax: {
                    inlineMath: [
                        ["$", "$"],
                        ["\\\\(", "\\\\)"]
                    displayMath: [
                        ["$$", "$$"],
                        ["\\[", "\\]"]
                    processEscapes: true,
                    ignoreClass: "tex2jax_ignore|dno"
                TeX: {
                    noUndefined: {
                        attributes: {
                            mathcolor: "red",
                            mathbackground: "#FFEEEE",
                            mathsize: "90%"
                messageStyle: "none"


            theLoop = function () {
                MathJax.Hub.Queue(['Typeset', MathJax.Hub]);
                window.setTimeout(theLoop, 1000);
    } else {
        MathJax.Hub.Queue(['Typeset', MathJax.Hub]);


With MathJax 2.x the way to load it dynamically has changed and the documentation says that one should use a new method.

It seems to me that it ought to be possible to turn this into a Greasemonkey script that runs automatically when receiving new input.


For those of us who struggle to get ChatJax running on an iPad, you need to fake it into a bookmarklet that you can copy and paste into the Safari URL line, then save as a bookmark. Make an .html file on your desktop that you will save, put in Dropbox, and open with Safari on your iPad.

That .html file should have a textbox in it that you can copy here (go into edit mode):

ChatJax Bookmarklet


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .