Skip to main content

Instant MathJax preview of LaTeX typed into HTML textareas

I’ve completely rewritten my write maths, see maths library to be a little jQuery plugin that attaches itself to editable areas on pages, like contenteditable elements, textareas, and input boxes. When your cursor is inside some LaTeX, a little preview box appears just above it with the LaTeX rendered through MathJax. I’ve made a demo page on GitHub, and the code itself is available there too. It also works in TinyMCE, if you’re into that sort of thing.

The first I thing I did with it was to write a WordPress plugin which applies the plugin to the comment boxes underneath posts (source code). I’ve installed it on this site and The Aperiodical, so you can use LaTeX with confidence, knowing that it’ll appear how you want on the page. Please try it in the comments box below!

Comments

Comments

That is great! Let me test:
3x1+(1+x)2
It would be cool to integrate with Aloha Editor in some way. The problem is how to define the workflow, but looks very cool…

Hi, great works.
May I have the link to the code where you integrate writemaths with wysiwyg editor? I cannot get it to work. Thanks for your help

Do you mean in WordPress? I haven’t got it to work in WordPress’s wysiwyg editor.

1+q2(1q)+q6(1q)(1q2)+=j=01(1q5j+2)(1q5j+3),for |q|<1.

cool man..

Let a=n1pj where pj{2,3,5,7,}, so aPn1. Let b=n2pk where pk{2,3,5,7,}, so bPn2.

Now assume that Pn1Pn2 is nonempty. Then there exists some n1 and n2 such that for some pj and pk such that a=b. Thus we have n1pj=n2pk.

Note that pkpj=pkpj is clearly true, and multiplying both sides of the equation by some integer m gives us mpkpj=mpkpj.

So let n1=mpk and n2=mpj, which implies n1pj=n2pk, and thus a=b as desired. This means that Pn1Pn2 is guaranteed to be nonempty if we can divide any common factors from n1 and n2 and be left with only prime numbers.

(A) is out as 1 is not prime. (B) is is out because if we divide 7 and 21 by their common factor 7, we are left with 1 and 7, and 1 is not prime. (D) is out because 24/4=6 which is not prime. (E) is out because 5/5=1 is not prime. (C) is correct as 12/4=3 and 20/4=5, which are both prime.

Amazing !

ft=2fx2

I will try to install it on my own wordpress. Thanks a lot !

\texttt{dst} (I) = \fork{\texttt{src}(I)^power}{if \texttt{power} is integer}{|\texttt{src}(I)|^power}{otherwise}