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
snssswc
Awesome work!! $\frac{-b \pm \sqrt{b^2+4ac}}{2a}$
Thanks!!!
sean
$x^2$
Mauricio Piacentini
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…
Thieme Hennis (@hennis)
\lim_{n\rightarrow \infty}\sum_{i=0}^n \frac{1}{p_i}
Thieme Hennis (@hennis)
$ \lim_{n\rightarrow \infty}\sum_{i=0}^n \frac{1}{p_i} $
Andres Riofrio
Not bad if I can write Einstein’s equation!
$E=mc^2$
HO AN De
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
Christian Perfect
Do you mean in WordPress? I haven’t got it to work in WordPress’s wysiwyg editor.
Alpha
Can you give me a link of demo to use it in Tinymce?
Houcem
$\sum_{m=1}^\infty\sum_{n=1}^\infty\frac{m^2\,n}
{3^m\left(m\,3^n+n\,3^m\right)}$
Great work !
HO AN De
Are you able to get it work on any wysiwyg editor?
Navin
$iint _{ 2 }^{ 4 }{ x{ y }^{ 2 } } .dz$
Navin
\iint _{ 2 }^{ 4 }{ x{ y }^{ 2 } } .dz
Testing
\[e^{\pi i} + 1 = 0\]
Jay
This is cool!
x^2
Jay
Again with dollar signs
$x^2$
demo
$x^2$
Dont Work
$x^3+x^2+sqrt(4)$
toak
\[ 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..
Bill
$x=\frac{-b \pm \sqrt{b^2 – 4ac}}{2a}$
lonely_prince
$I=\frac{1^3}{2}mR^2=\frac{1}{2}.1.(0,2)^2=0,02 kg.m^2$
demo
$a^2 + b^2 = c^2$
Drew
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.
Ada
$$ sqrt(4) $$
Ada
$ sqrt(4) $
Junny
\(J_\alpha(x) = \sum\limits_{m=0}^\infty \frac{(-1)^m}{m! \, \Gamma(m + \alpha + 1)}{\left({\frac{x}{2}}\right)}^{2 m + \alpha}\)
amazing
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 !
dsfds
$a^2+b^4
schartz
$\log_2 \left( \frac{1}{x+2} \right)$
tets
a $x+1$
\begin{align}
x &= 1 \\
y &= 2 \\
z &= 3
\end{align}
akash
$\left [ – \frac{\hbar^2}{2 m} \frac{\partial^2}{\partial x^2} + V \right ] \Psi
= i \hbar \frac{\partial}{\partial t} \Psi
$\
r
test
$$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$
aaa
$$ x^2 $$
גכשדכשד $$ 5x+3^2 = 3 $$
Rock
I wish music was as easy to work with as math… $$E\flat = D\sharp$$
Rock
$$ x = \sqrt \frac {2x + 3y^2 + 2} {2x +y} + a^3 + b^2 + 4$$
Yash
$\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} } } }$
test
$$y=a cos(\frac{t}{p}~qx)$$
test
\texttt{dst} (I) = \fork{\texttt{src}(I)^power}{if \texttt{power} is integer}{|\texttt{src}(I)|^power}{otherwise}
test wrote
y = $\sqrt(x^2+2x^3)$
kom
\[\frac{-b\pm\sqrt{b^2-4ac}}{2a}\]