By now, I am aware of three ways to accomplish this:
- MathJax.
- display-latex2 described in the other answer (written by Steve Cheng, to which I made some modifications).
- ASCIIMathML, written by Peter Jipsen.
I think the best choice by far is to use MathJax, an active project with a very professional development team. It is free, open source, and it is backed by the American Mathematical Society, the American Physical Society, and SIAM, among others. That is the way to go, if you are able to install it on your server.
(In the previous version of this answer, I mentioned several problems. They were very promptly resolved by the developers, who are truly impressive, and whom I can not praise enough.)
I wrote a very simple Greasemonkey script which allows you to use your local installation of MathJax on any web page, and in Gmail (in "basic HTML" and "print" views).
The same web page also contains a Greasemonkey script allowing you to pick and choose between the three locally installed math engines.
In the long run, the best way would be for arXiv, MathSciNet, and Gmail to use MathJax on their servers. I made a Gmail Lab request for this. If more people support it, maybe they will do it, that would be great.
Here are detailed instructions. I am hesitant to bump this question too often. So for minor edits I will update
this web site instead.
Installation instructions
This solution assumes that you have access to a web server and can install Javascript programs on it.
First, download and install MathJax and MathJax web fonts. Install MathJax on your web server. Install the MathJax fonts from the MathJax-webfonts(-beta2)/fonts/HTML-CSS/TeX/otf directory.
The customization is done by editing the file MathJax/config/MathJax.js. You need to set
webFont: null,
so that MathJax uses your locally installed MathJax TeX fonts. Next, download mathjaxthispage.user.js and save it to your Desktop. The script assumes that your MathJax installation resides in http://localhost/MathJax. If it is different, edit the script accordingly. From the Firefox menu bar, File > Open File, navigate to the downloaded script and open it. Greasemonkey will offer to install; do that. Start surfing.
Muting the TeX errors (optional)
The following settings make for a more pleasant viewing experience when browsing the pages with non-standard TeX macros, for example arXiv.org.
extensions: ["tex2jax.js", "TeX/noErrors.js", "TeX/noUndefined.js"],
and inside the TeX block, the following code
TeX: {
noErrors: {
inlineDelimiters: ["",""],
multiLine: false,
style: {
"font-family": "serif",
"font-size": "120%",
"color": "gray",
"border": ""
}
},
noUndefined: {
attributes: {
mathcolor: "red",
mathbackground: "#FFEEEE",
mathsize: "100%"
}
},
// The rest follows...
If you don't have the extensions noErrors.js and noUndefined.js in your MathJax/extensions directory, you can get them from a more recent build available at https://sourceforge.net/projects/mathjax/develop
Using the native MathMML output (optional)
With Mozilla Firefox, you have an option of using the native MathMML instead of HTML-CSS output, which is faster. For this, you will need to set the following in MathJax/config/MathJax.js :
jax: ["input/TeX","output/NativeMML"],
Next, add the following to your userContent.css file (see Customizing Mozilla):
math { font-size: 112% }
[mathvariant="double-struck"] {font-family: MathJax_AMS; }
[mathvariant="script"] {font-family: MathJax_Script; }
[mathvariant="fraktur"] {font-family: MathJax_Fraktur;}
[mathvariant="-tex-caligraphic"] {font-family: MathJax_Caligraphic; }
[mathvariant="bold-script"] {font-family: MathJax_Script; font-weight: bold;}
[mathvariant="bold-fraktur"] {font-family: MathJax_Fraktur; font-weight: bold;}
[mathvariant="monospace"]{font-family: monospace}
The first line controls the magnification of math output, and you can change it to your liking. The other lines are needed to fix a bug with Mozilla's display (otherwise, Mozilla does not display MathML correctly).
For font consistency, you could also type 'about:config' (without the quotes) in the location bar, and change the variable font.mathfont-family to
MathJax_Main, MathJax_Math, MathJax_Size1, MathJax_Size2, MathJax_Size3, MathJax_Typewritter, MathJax_AMS, MathJax_Caligraphic, MathJax_Fraktur, MathJax_SansSerif