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)

  • 15
    $\begingroup$ 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. $\endgroup$ Commented Nov 6, 2010 at 12:11
  • 17
    $\begingroup$ We were just now lamenting the lack of TeX support in chat. Would it be possible to reconsider this? $\endgroup$ Commented May 11, 2011 at 19:26
  • 1
    $\begingroup$ 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. $\endgroup$
    – SBF
    Commented Dec 2, 2011 at 9:36
  • 28
    $\begingroup$ 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... $\endgroup$ Commented Dec 6, 2011 at 15:12
  • $\begingroup$ 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. $\endgroup$
    – kahen
    Commented Oct 22, 2012 at 0:51
  • $\begingroup$ Corresp. feature request: Why is there no support for MathJax in chat? $\endgroup$
    – Grigory M
    Commented Jul 16, 2014 at 13:30
  • $\begingroup$ There is a user script now; see here. (I tried to post this as an answer, but it was auto-converted. Huh.) $\endgroup$
    – Raphael
    Commented Sep 19, 2015 at 16:41
  • $\begingroup$ Is or how is mathjax available for mobiles? $\endgroup$
    – draks ...
    Commented Apr 11, 2017 at 17:04

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.

To get the bookmarks mentioned above, 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. This is how I installed ChatJax on my iPhone.

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

On April 30, 2017, the MathJax CDN will be shutting down.

The bookmarks listed above will need to be reinstalled. I have updated the bookmarks to use the CDN at cdnjs.cloudflare.com. Make sure you reload this installation page so that the new bookmarks are not hidden behind a stale cache.

  • 52
    $\begingroup$ I would nominate you to a Hacker badge if I could. $\endgroup$
    – Asaf Karagila Mod
    Commented Dec 6, 2011 at 8:58
  • 22
    $\begingroup$ @Asaf: It's okay, I got a Necromancer badge for this answer. :-) $\endgroup$
    – robjohn Mod
    Commented Dec 6, 2011 at 10:30
  • 1
    $\begingroup$ 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. $\endgroup$
    – Zhen Lin
    Commented Dec 6, 2011 at 11:39
  • $\begingroup$ @ZhenLin: Thanks! I have added your automatic processing addition. $\endgroup$
    – robjohn Mod
    Commented Dec 6, 2011 at 13:06
  • 1
    $\begingroup$ 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. $\endgroup$
    – robjohn Mod
    Commented Jan 4, 2012 at 13:53
  • $\begingroup$ How persistent is the (Cloudfront) site hosting MathJax.js? $\endgroup$ Commented Jan 5, 2012 at 10:20
  • $\begingroup$ @Willie: if you are asking about "d3eoax9i5htok0", this explains the weird domain name. $\endgroup$
    – robjohn Mod
    Commented Jan 5, 2012 at 22:15
  • $\begingroup$ @robjohn: thanks. That's precisely what I was wondering about. BTW: thanks for the bookmark! $\endgroup$ Commented Jan 6, 2012 at 9:04
  • 1
    $\begingroup$ Alert! Linux and Windows versions have different bookmarking with Google Chrome but the combo SHIFT+CTRL+B should show you the bookmark -bar. $\endgroup$
    – hhh
    Commented Mar 20, 2012 at 7:54
  • 1
    $\begingroup$ @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. $\endgroup$
    – robjohn Mod
    Commented Jun 6, 2012 at 17:09
  • $\begingroup$ For some odd reason, single $...$ -thing does not work in Twitter but the double $$...$$ -thing works, odd, investigating... $\endgroup$
    – hhh
    Commented Sep 2, 2012 at 1:28
  • $\begingroup$ note to myself: click on Firefox bookmark whenever I enter math chat $\endgroup$ Commented Mar 2, 2013 at 19:58
  • $\begingroup$ @Theta30 I bet some greasemonkeying could save you that click $\endgroup$ Commented Mar 21, 2013 at 14:34
  • $\begingroup$ Does this only work for SE or any website? $\endgroup$
    – Meow
    Commented Apr 6, 2013 at 21:40
  • $\begingroup$ 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. $\endgroup$
    – robjohn Mod
    Commented Apr 7, 2013 at 3:31

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]);


There is ChatJax++ now, a user script that enables MathJax in SE chat in a smart way, i.e. it requires no user interaction and renders new messages automatically.


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

  • $\begingroup$ We can no longer edit your answer to get the textbox because community Wiki answers cannot be edited. $\endgroup$
    – user400188
    Commented May 19, 2020 at 7:36

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.


You must log in to answer this question.

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