WYSIWYG editor

898 views
Skip to first unread message

smartmouse

unread,
Feb 15, 2012, 11:52:00 AM2/15/12
to MathJax Users
Hello, i'm using Mathjax in my forum (SMF) and I would like to place a
WYSIWYG editor to make easy to post math's expressions. Do you know if
is it possible?

Thank you.

leathrum

unread,
Feb 15, 2012, 4:04:29 PM2/15/12
to MathJax Users
It certainly should be possible, but you have some decisions to make
in the process. First of all, you need to decide which of MathJax's
input formats you will be using -- this will actually become an
intermediate format, between the WYSIWYG editor and MathJax. For
LaTeX as the input format, there are lots of online WYSIWYG LaTeX
editors, such as DragMath (which is implemented as a Java applet):

http://www.dragmath.bham.ac.uk/demo.html

I suspect that editors such as this one:

http://www.codecogs.com/latex/eqneditor.php

aren't really what you are looking for -- this gives a button-based
editor which generates LaTeX, and shows the output, but isn't really
WYSIWYG. There are also lots of editors which run independently, so
don't embed in a web page, such as MathType from Design Science. You
might also want to look at Lyx, but it probably does more than you
need.

There are also online editors for MathML and ASCIImath, the other two
input methods for MathJax v2.0 (ASCIImath input is new in MathJax
v2.0). I turned up quite a few editors for all of the input formats
with Google searches.

The problem with all of these editors is getting the output from the
editor into MathJax. The editor may or may not have a way to do that
in JavaScript -- if it does, then you should be able to set up
JavaScript calls to get the LaTeX output from the editor into your
page (more specifically, into the DOM) and call the MathJax
typesetting routine to process it. What you do is going to depend
very much on which editor you choose.
Message has been deleted

smartmouse

unread,
Feb 15, 2012, 8:25:30 PM2/15/12
to MathJax Users
I'm not an expert with coding, do you think is it free to integrated
one of them in "post template" of my SMF forum?
Do you know any way to do it?

I mean something like this:
hxxp://img195.imageshack[DOT]us/img195/5240/forum2q.png

The author is unreachable!


Thank you for your reply!

leathrum

unread,
Feb 15, 2012, 9:10:20 PM2/15/12
to MathJax Users
From your screenshot, it is looking like you actually do want
something like the editor at the codecogs.com link I gave above. You
can embed that editor in a page -- see the instructions at this link:

http://www.codecogs.com/latex/embedded.php

Note that the LaTeX code winds up in the contents of a <textarea>
element. You can get the contents using JavaScript calls -- in the
example at the above link, the <textarea> has ID "testbox", so you
would need something like

document.getElementById("testbox").value

to get access to the contents of the <textarea>. You can then take
that LaTeX code, wrap it in the LaTeX delimiters "\\(" and "\\)" (as
JavaScript strings, you need to double-escape to get the right
backslashes), write the result into the innerHTML of a <div> or <span>
and issue a MathJax "Typeset" command for that element. For
documentation on how to issue that "Typeset", look at my favorite
MathJax link:

http://www.mathjax.org/docs/1.1/typeset.html

This still leaves several pieces to put together, but the JavaScript
should be relatively short, appropriate for the code in the onclick
attribute of a <button> element, so that you click the button to get
the LaTeX into MathJax and typeset at the location in the page where
the <div> is located. There are other ways to do this, but this looks
pretty close to what you described.

smartmouse

unread,
Feb 16, 2012, 4:46:12 AM2/16/12
to MathJax Users
Thank you for your great help.
I'm not so expert in coding. Do you know how to put it in the SMF post
template?
In addition how to make the text area of SMF post as output field
instead of that text box included with the editor?

Sorry for my english...

leathrum

unread,
Feb 16, 2012, 11:27:08 AM2/16/12
to MathJax Users
I'm not familiar with SMF, so I don't know much about how their
templates work -- sorry, but at that point, I'm afraid I won't be of
much help. Is there an SMF discussion group? You might be able to
post a question there linking to this thread, and someone there could
hep you put the pieces together in the template.

As for the output field, when you embed the editor, you specify the
CSS ID of a <textarea> in your page -- that could be any <textarea>,
including the one specified for the SMF post, as long as you can give
that <textarea> an ID in the template. But that gets back into SMF
templates, where you lose me.

bosb...@gmail.com

unread,
Dec 5, 2012, 9:25:30 AM12/5/12
to mathja...@googlegroups.com, smart...@gmail.com
I have written a smf mod to support Mathjax.
You can write $<your math>$, $$<your math>$$ for latex style,  qq<your math>qq,  `<your math>` for ASCIIMathML.
It will not add mathjax buttons to the editor.

15 Şubat 2012 Çarşamba 18:52:00 UTC+2 tarihinde smartmouse yazdı:
simplemathjax-1.0.zip
Message has been deleted

smart...@gmail.com

unread,
Dec 5, 2012, 10:11:17 AM12/5/12
to mathja...@googlegroups.com, smart...@gmail.com, bosb...@gmail.com
Please make something like this:

Reply all
Reply to author
Forward
0 new messages