## 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!

Awesome work!! $\frac{-b \pm \sqrt{b^2+4ac}}{2a}$

Thanks!!!

2012-06-28 08:16:24

$x^2$

2012-08-02 04:22:34

That is great! Let me test:

$\sqrt{3x-1}+(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…

2012-08-06 16:01:23

\lim_{n\rightarrow \infty}\sum_{i=0}^n \frac{1}{p_i}

2012-09-14 14:52:44

$ \lim_{n\rightarrow \infty}\sum_{i=0}^n \frac{1}{p_i} $

2012-09-14 14:53:21

Not bad if I can write Einstein’s equation!

$E=mc^2$

2012-11-14 07:59:03

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

2013-02-11 14:06:50

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

2013-02-12 15:24:00

Can you give me a link of demo to use it in Tinymce?

2013-02-14 18:30:19

$\sum_{m=1}^\infty\sum_{n=1}^\infty\frac{m^2\,n}

{3^m\left(m\,3^n+n\,3^m\right)}$

Great work !

2013-02-19 10:17:37

Are you able to get it work on any wysiwyg editor?

2013-02-19 12:35:28

$iint _{ 2 }^{ 4 }{ x{ y }^{ 2 } } .dz$

2013-03-23 18:18:24

\iint _{ 2 }^{ 4 }{ x{ y }^{ 2 } } .dz

2013-03-23 18:19:25

\[e^{\pi i} + 1 = 0\]

2013-04-16 15:06:14

This is cool!

x^2

2013-05-13 19:51:02

Again with dollar signs

$x^2$

2013-05-13 19:51:45

$x^2$

2013-05-20 13:29:12

$x^3+x^2+sqrt(4)$

2013-07-09 19:50:03

\[ 1 + \frac{q^2}{(1-q)}+\frac{q^6}{(1-q)(1-q^2)}+\cdots =

\prod_{j=0}^{\infty}\frac{1}{(1-q^{5j+2})(1-q^{5j+3})},

\quad\quad \text{for $|q|<1$}. \]

cool man..

2013-08-31 21:03:26

$x=\frac{-b \pm \sqrt{b^2 – 4ac}}{2a}$

2013-09-02 20:29:52

$I=\frac{1^3}{2}mR^2=\frac{1}{2}.1.(0,2)^2=0,02 kg.m^2$

2013-09-02 23:18:54

$a^2 + b^2 = c^2$

2013-09-16 18:52:32

Let $a = n_1p_j$ where $p_j \in \{2, 3, 5, 7, \ldots\},$ so $a \in {P_n}_1.$ Let $b = n_2p_k$ where $p_k \in \{2, 3, 5, 7, \ldots\},$ so $b \in {P_n}_2.$

Now assume that ${P_n}_1 \cap {P_n}_2$ is nonempty. Then there exists some $n_1$ and $n_2$ such that for some $p_j$ and $p_k$ such that $a = b$. Thus we have $n_1p_j = n_2p_k$.

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

So let $n_1 = mp_k$ and $n_2 = mp_j$, which implies $n_1p_j = n_2p_k$, and thus $a = b$ as desired. This means that ${P_n}_1 \cap {P_n}_2$ is guaranteed to be nonempty if we can divide any common factors from $n_1$ and $n_2$ 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.

2013-10-03 05:56:43

$$ sqrt(4) $$

2013-12-11 08:03:34

$ sqrt(4) $

2013-12-11 08:04:20

\(J_\alpha(x) = \sum\limits_{m=0}^\infty \frac{(-1)^m}{m! \, \Gamma(m + \alpha + 1)}{\left({\frac{x}{2}}\right)}^{2 m + \alpha}\)

2014-04-26 01:36:00

Amazing !

$$ \frac{\partial f}{\partial t} = \frac{\partial ^{2} f}{\partial x^{2}} $$

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

2014-06-28 21:21:09

$a^2+b^4

2014-07-08 09:20:20

$\log_2 \left( \frac{1}{x+2} \right)$

2014-11-24 12:23:46

a $x+1$

\begin{align}

x &= 1 \\

y &= 2 \\

z &= 3

\end{align}

2014-12-15 14:48:21

$\left [ – \frac{\hbar^2}{2 m} \frac{\partial^2}{\partial x^2} + V \right ] \Psi

= i \hbar \frac{\partial}{\partial t} \Psi

$\

2014-12-24 08:37:54

test

$$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$

2015-02-01 12:25:03

$$ x^2 $$

גכשדכשד $$ 5x+3^2 = 3 $$

2015-02-06 12:47:20

I wish music was as easy to work with as math… $$E\flat = D\sharp$$

2015-02-24 17:51:06

$$ x = \sqrt \frac {2x + 3y^2 + 2} {2x +y} + a^3 + b^2 + 4$$

2015-02-24 17:55:18

$\frac{1}{\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{\frac25 \pi}} = 1+\frac{e^{-2\pi}} {1+\frac{e^{-4\pi}} {1+\frac{e^{-6\pi}} {1+\frac{e^{-8\pi}} {1+\cdots} } } }$

2015-04-07 01:28:51

$$y=a cos(\frac{t}{p}~qx)$$

2015-07-22 11:58:26

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

2015-08-04 10:42:50

y = $\sqrt(x^2+2x^3)$

2015-11-28 04:40:37

\[\frac{-b\pm\sqrt{b^2-4ac}}{2a}\]

2016-02-03 10:25:58