5 missing paren

Here's a solution that is easy and doesn't require you to install Greasemonkey (in particular, you can use it with Chrome), but is quite crufty. Visit a page with math on it (like this arXiv abstract), paste the following into the location bar of your browser and hit enter:

javascript:var e=document.createElement("script");e.type="text/javascript";e.src="http://www.mathjax.org/MathJax/MathJax.js";document.getElementsByTagName('head')[0].appendChild(e);setTimeout(function(){MathJax.Hub.Config({config:["MMLorHTML.js"],extensions:["tex2jax.js","TeX/noErrors.js"],tex2jax:{inlineMath:[["$","$"],["\$$","\$$"]]},jax: ["input/TeX"],MMLorHTML:{prefer:"MML"}});MathJax.Extension.tex2jax.PreProcess(document);MathJax.Hub.Process(document);},300);void(0);


If that worked, create a new bookmark in your browser with the above line as the "location". When you come to a page where you want to process the math, just click on the bookmark.

Edit(VA): Please consider installing MathJax locally. You don't want to cost the MathJax organization bandwidth. And with a local installation, you are fully in control, and can configure MathJax in a local configuration file. In that case, you can use a shorter bookmarklet (replace 'localhost' by your server):

  javascript:
var e=document.createElement("script");
e.type="text/javascript";
e.src="http://localhost/MathJax/MathJax.js";
setTimeout(function(setTimeout(function(){
MathJax.Extension.tex2jax.PreProcess(document);
MathJax.Hub.Process(document);
},200);
void(0);


## How it works

The basic idea is to load MathJax from mathjax.org like this:

var e  = document.createElement("script");
e.type = "text/javascript";
e.src  = "http://www.mathjax.org/MathJax/MathJax.js";


Then you set up MathJax and process the page like this:

MathJax.Hub.Config({
config:["MMLorHTML.js"],
extensions:["tex2jax.js","TeX/noErrors.js"],
tex2jax:{inlineMath:[["$","$"],["\$$","\$$"]]},
jax: ["input/TeX"],
MMLorHTML:{prefer:"MML"}
});
MathJax.Extension.tex2jax.PreProcess(document);
MathJax.Hub.Process(document);


This solution simply runs all this together on one line and tells the browser to execute it. MathJax loads asynchronously, so javascript will try to execute the second step before MathJax finishes loading. To avoid this, I've inserted a small (0.1 sec) pause after the first step to give MathJax a chance to load. This works well for me, but you may have to tweak this number ... it's at the very end of the line (in milliseconds).

## Issues

• As with VA's solution, this doesn't seem to work with the standard view in Gmail.
• Mathjax.org may not be happy with people loading the script from them to view random web pages.
• For me, this works in Chrome, but leaves the page in Firefox (javascript must be overwriting the contents of the page). Does anybody know how to fix that? If yes, please edit this answer (it's CW). Edit (VA): I increased the timeout to 0.3 sec and added 'void();' at the end. In my tests, it now works in Chrome, Firefox, Internet Explorer, and Opera.

## MathML

If your browser supports MathML, this solution should produce MathML output, but I haven't tested this yet (because it doesn't work in Firefox for me). If you can get MathML output, please leave a comment saying so. If you had to do something special, please edit this answer (it's CW).

Edit(VA): I believe the only browsers supporting MathML now are Firefox and IE with MathPlayer installed. Using the default output (HTML-CSS) should work very well if you have installed MathJax fonts on your machine. Or you can wait until the official STIX fonts come out (it has been 13 years of delays but maybe they are really coming out on May 17?) and install those.

Also, noErrors.js and noUndefined.js are not currently part of the standard MathJax distribution. But they can be obtained from the recent builds as explained in the other answer.

4 added 1 characters in body

Here's a solution that is easy and doesn't require you to install Greasemonkey (in particular, you can use it with Chrome), but is quite crufty. Visit a page with math on it (like this arXiv abstract), paste the following into the location bar of your browser and hit enter:

javascript:var e=document.createElement("script");e.type="text/javascript";e.src="http://www.mathjax.org/MathJax/MathJax.js";document.getElementsByTagName('head')[0].appendChild(e);setTimeout(function(){MathJax.Hub.Config({config:["MMLorHTML.js"],extensions:["tex2jax.js","TeX/noErrors.js"],tex2jax:{inlineMath:[["$","$"],["\$$","\$$"]]},jax: ["input/TeX"],MMLorHTML:{prefer:"MML"}});MathJax.Extension.tex2jax.PreProcess(document);MathJax.Hub.Process(document);},300);void();
"input/TeX"],MMLorHTML:{prefer:"MML"}});MathJax.Extension.tex2jax.PreProcess(document);MathJax.Hub.Process(document);},300);void(0);


If that worked, create a new bookmark in your browser with the above line as the "location". When you come to a page where you want to process the math, just click on the bookmark.

Edit(VA): Please consider installing MathJax locally. You don't want to cost the MathJax organization bandwidth. And with a local installation, you are fully in control, and can configure MathJax in a local configuration file. In that case, you can use a shorter bookmarklet (replace 'localhost' by your server):

  javascript:
var e=document.createElement("script");
e.type="text/javascript";
e.src="http://localhost/MathJax/MathJax.js";
setTimeout(function({
MathJax.Extension.tex2jax.PreProcess(document);
MathJax.Hub.Process(document);
},200);
void(0);


## How it works

The basic idea is to load MathJax from mathjax.org like this:

var e  = document.createElement("script");
e.type = "text/javascript";
e.src  = "http://www.mathjax.org/MathJax/MathJax.js";


Then you set up MathJax and process the page like this:

MathJax.Hub.Config({
config:["MMLorHTML.js"],
extensions:["tex2jax.js","TeX/noErrors.js"],
tex2jax:{inlineMath:[["$","$"],["\$$","\$$"]]},
jax: ["input/TeX"],
MMLorHTML:{prefer:"MML"}
});
MathJax.Extension.tex2jax.PreProcess(document);
MathJax.Hub.Process(document);


This solution simply runs all this together on one line and tells the browser to execute it. MathJax loads asynchronously, so javascript will try to execute the second step before MathJax finishes loading. To avoid this, I've inserted a small (0.1 sec) pause after the first step to give MathJax a chance to load. This works well for me, but you may have to tweak this number ... it's at the very end of the line (in milliseconds).

## Issues

• As with VA's solution, this doesn't seem to work with the standard view in Gmail.
• Mathjax.org may not be happy with people loading the script from them to view random web pages.
• For me, this works in Chrome, but leaves the page in Firefox (javascript must be overwriting the contents of the page). Does anybody know how to fix that? If yes, please edit this answer (it's CW). Edit (VA): I increased the timeout to 0.3 sec and added 'void();' at the end. In my tests, it now works in Chrome, Firefox, Internet Explorer, and Opera.

## MathML

If your browser supports MathML, this solution should produce MathML output, but I haven't tested this yet (because it doesn't work in Firefox for me). If you can get MathML output, please leave a comment saying so. If you had to do something special, please edit this answer (it's CW).

Edit(VA): I believe the only browsers supporting MathML now are Firefox and IE with MathPlayer installed. Using the default output (HTML-CSS) should work very well if you have installed MathJax fonts on your machine. Or you can wait until the official STIX fonts come out (it has been 13 years of delays but maybe they are really coming out on May 17?) and install those.

Also, noErrors.js and noUndefined.js are not currently part of the standard MathJax distribution. But they can be obtained from the recent builds as explained in the other answer.

3 prettified the code

Here's a solution that is easy and doesn't require you to install Greasemonkey (in particular, you can use it with Chrome), but is quite crufty. Visit a page with math on it (like this arXiv abstract), paste the following into the location bar of your browser and hit enter:

javascript:var e=document.createElement("script");e.type="text/javascript";e.src="http://www.mathjax.org/MathJax/MathJax.js";document.getElementsByTagName('head')[0].appendChild(e);setTimeout(function(){MathJax.Hub.Config({config:["MMLorHTML.js"],extensions:["tex2jax.js","TeX/noErrors.js"],tex2jax:{inlineMath:[["$","$"],["\$$","\$$"]]},jax: ["input/TeX"],MMLorHTML:{prefer:"MML"}});MathJax.Extension.tex2jax.PreProcess(document);MathJax.Hub.Process(document);},300);void();


If that worked, create a new bookmark in your browser with the above line as the "location". When you come to a page where you want to process the math, just click on the bookmark.

Edit(VA): Please consider installing MathJax locally. You don't want to cost the MathJax organization bandwidth. And with a local installation, you are fully in control, and can configure MathJax in a local configuration file. In that case, you can use a shorter bookmarklet (replace 'localhost' by your server):

  javascript:var%20e=document.createElement("script");e.type="text/javascript";e.src="http://localhost/MathJax/MathJax.js";document.getElementsByTagName('head')[0].appendChild(e);setTimeout(function(){MathJax.Extension.tex2jax.PreProcess(document);MathJax.Hub.Process(document);},200);void(0)

javascript:
var e=document.createElement("script");
e.type="text/javascript";
e.src="http://localhost/MathJax/MathJax.js";
setTimeout(function({
MathJax.Extension.tex2jax.PreProcess(document);
MathJax.Hub.Process(document);
},200);
void(0);

How it works

The basic idea is to load MathJax from mathjax.org like this:

var e  = document.createElement("script");
e.type = "text/javascript";
e.src  = "http://www.mathjax.org/MathJax/MathJax.js";

Then you set up MathJax and process the page like this:

MathJax.Hub.Config({
config:["MMLorHTML.js"],
extensions:["tex2jax.js","TeX/noErrors.js"],
tex2jax:{inlineMath:[["$","$"],["\$$","\$$"]]},
jax: ["input/TeX"],
MMLorHTML:{prefer:"MML"}
});
MathJax.Extension.tex2jax.PreProcess(document);
MathJax.Hub.Process(document);

This solution simply runs all this together on one line and tells the browser to execute it. MathJax loads asynchronously, so javascript will try to execute the second step before MathJax finishes loading. To avoid this, I've inserted a small (0.1 sec) pause after the first step to give MathJax a chance to load. This works well for me, but you may have to tweak this number ... it's at the very end of the line (in milliseconds).

Issues

As with VA's solution, this doesn't seem to work with the standard view in Gmail.
Mathjax.org may not be happy with people loading the script from them to view random web pages.
For me, this works in Chrome, but leaves the page in Firefox (javascript must be overwriting the contents of the page).  Does anybody know how to fix that? If yes, please edit this answer (it's CW). Edit (VA): I increased the timeout to 0.3 sec and added 'void();' at the end. In my tests, it now works in Chrome, Firefox, Internet Explorer, and Opera.

MathML

If your browser supports MathML, this solution should produce MathML output, but I haven't tested this yet (because it doesn't work in Firefox for me). If you can get MathML output, please leave a comment saying so. If you had to do something special, please edit this answer (it's CW).

Edit(VA): I believe the only browsers supporting MathML now are Firefox and IE with MathPlayer installed. Using the default output (HTML-CSS) should work very well if you have installed MathJax fonts on your machine. Or you can wait until the official STIX fonts come out (it has been 13 years of delays but maybe they are really coming out on May 17?) and install those.

Also, noErrors.js and noUndefined.js are not currently part of the standard MathJax distribution. But they can be obtained from the recent builds as explained in the other answer.


 
 
 
2 Now works with other browsers. Install MathJax locally!
 
Post Undeleted by Anton Geraschenko♦♦
Post Deleted by Anton Geraschenko♦♦