Get contents of div and convert to LateX code

58 views
Skip to first unread message

Garnet Borch

unread,
May 22, 2013, 8:07:12 PM5/22/13
to mathja...@googlegroups.com
Hello all!

I've got a div filled with both text and math equations and I'd like to copy the contents of that div to another but display all the math as latex code. What would be the easiest way do do that?

I'm able to retrieve the first math equation and convert it to latex using MathJax.Hub.getAllJax("textbox")[0]; and latex= jax.SourceElement().text;, but I can't find a way to copy the entire contents of the div.... Any suggestions?

Garnet

Garnet Borch

unread,
May 23, 2013, 2:59:31 PM5/23/13
to mathja...@googlegroups.com
Hm... don't answer this. I've realised it won't work for what I'm trying to do.

Here's the long story:

I'm creating an editor where people can input equations with parameters or variables in them and then generate a preview in which the parameters/variables are converted to numbers.

Right now, I can input a variable (as a textbox) and when you right click on it, you can specify the minimum, and maximum values as well as an increment. When the user generates the preview, the textbox is replaced by a random number within the max and min and withing the specified increment.

For example,  the user could input:
"Lorem Ipsum [textbox]" then right click and choose min=1, max=10 and inc=2
and the preview would be:
"Lorem Ipsum 4"

Now what I want to do is put that variable/parameter into a rendered equation. So that I can have something like:
"Lorem Ipsum $\sqrt{ [textbox] }$" where everything is rendered and the user can right click the textbox that's within the square root
and have the preview be:
"Lorem Ipsum $\sqrt{4}$" (again, rendered)

Is it possible to have this kind of functionality with MathJax?
The text box doesn't have to be a text box, it could be something as simple as blue text (anything to distinguish it).

Thanks,

Garnet

Davide P. Cervone

unread,
May 24, 2013, 9:49:20 AM5/24/13
to mathja...@googlegroups.com
You might want to look at the form input extension at


which provides something like what you are looking for.  Be sure to note, however, that this is limited to MathJax's HTML-CSS output, or to browsers with native MathML support (e.g., not IE with MathPlayer).  It works with MathJax's SVG output except in IE.

Davide


--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages