donderdag 25 augustus 2011

Mathematics in a Blog

I'm experimenting with mathJax, www.mathjax.org. That's a way to write LaTeX formulas in html documents which the reader sees displayed just as they ought to be. Well, that's the theory.

$$\sqrt{\vphantom{I}} n \bigl(\hat\theta_{\text{MLE}}-\theta_0\bigr)~\Rightarrow ~ \mathcal N\,\bigl(\, 0\,, \mathcal I(\theta_0)^{-1}\bigr)$$

$$\Pr(T_E\gg t_E)~=~\prod_{A\subseteq E}\,\,\prod_{s_A\in(0_A,t_A]}\, \Biggl(\prod_{B\subseteq A}\Pr\Bigl(T_{A\setminus B}\gg s_{A\setminus B}\Bigm|T_A\ge s_A\Bigr)^{(-1)^{|B|}}\Biggr)$$

So I'ld like to hear from you, dear reader. What do you see? Does it look OK? Did you have to wait a long time?

So, how is it done? The LaTeX formulas are typed in completely standard LaTeX, surrounded by double dollar signs. At top of the html source for this page the following code is included: < script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" >
< /script > (I added a space after each start-angle-bracket, so that the html tags for starting and ending a java script are not recognised as such).

Finally, let me add as images what real LaTeX makes of the two formulas:

3 opmerkingen:

1. MathJax is mooi. Gek genoeg zien de fonts er in bijvoorbeeld mathoverflow.net er beter uit dan in jouw post - gebruiken zij een andere font set?

2. @Mark, this is one of the mysteries of MathJax which I'm struggling with. Which browser you use also makes a big difference. Does it make a difference which fonts I have on my own machine?

Firefox on OSX and Safari on iOS give beautiful results. Safari on OSX uses italic fonts for everything (numerals, text) even though LaTeX should know, and apparently does try to tell html, to use upright fonts.

3. Ziet er prima uit in Chrome op OSX en laadde heel snel. Wij gebruikten op wiskundemeisjes.nl een wordpress-plugin die plaatjes van LaTeX-code maakte. Dit is mooier.