How to extract a self-contained MathJax rendering tree (HTML/CSS) ?

203 views
Skip to first unread message

Jaro

unread,
Nov 10, 2010, 9:46:10 AM11/10/10
to MathJax Users
Dear contributors,
in my scenario MathJax can't be applied directly (it does not work
within TinyMCE's
editor area with designMode="On"). I'd like to render any math
expression externally,
capture the HTML/CSS rendering and update the editor's iframe.

What are the dependencies (styles, scripts, configuration) of the
MathJax output tree
in order to be become self-contained ?
Thank you
Jaro

Davide P. Cervone

unread,
Nov 11, 2010, 7:16:45 PM11/11/10
to mathja...@googlegroups.com
I don't think you will be successful at transferring MathJax output
from one DOM to another, in general. The math layout is actually
dependent on some of the details of the actual location that the math
is placed (MathJax investigates the location of the mathematics to
determine things like the font size of the surrounding text, and so
on), so creating the mathematics at one location and moving it to
another is not going to work well, in general. Also, as you suggest,
there is CSS that needs to be included, and that is generated on the
fly as mathematics is rendered, and it is not easy to determine what
CSS you would need to duplicate.

I would recommend that you load MathJax within the iframe itself and
run it there. I see from http://tinymce.moxiecode.com/punbb/viewtopic.php?pid=82698
that you have already tried this, with only limited success. I do
not know anything about TinyMCE's internals, and I don't know much
about designMode either. The documentation from Microsoft at http://msdn.microsoft.com/en-us/library/ms533720(VS.85).aspx
says that "You cannot execute script when the value of the
designMode property is set to On," so perhaps that is the source of
the problem. I'm wondering if you can set designMode to off before
loading MathJax or running and set it back to on afterward? Just a
thought.

Davide

Jaro

unread,
Nov 12, 2010, 4:43:02 AM11/12/10
to MathJax Users
Davide,
thank you for answering. Given the complexity of MathJax rendering
I expected a negative answer ;o( Anyway, TinyMCE's editor iframe
executes MathJax in "contentEditable" mode, but then some other
issues arise. Switching "designMode" is an alternative, but would
impact all scripts injected by the editor and have unpredictable
results.
Cheers
Jaro


On Nov 12, 1:16 am, "Davide P. Cervone" <d...@union.edu> wrote:
> I don't think you will be successful at transferring MathJax output  
> from one DOM to another, in general.  The math layout is actually  
> dependent on some of the details of the actual location that the math  
> is placed (MathJax investigates the location of the mathematics to  
> determine things like the font size of the surrounding text, and so  
> on), so creating the mathematics at one location and moving it to  
> another is not going to work well, in general.  Also, as you suggest,  
> there is CSS that needs to be included, and that is generated on the  
> fly as mathematics is rendered, and it is not easy to determine what  
> CSS you would need to duplicate.
>
> I would recommend that you load MathJax within the iframe itself and  
> run it there.  I see fromhttp://tinymce.moxiecode.com/punbb/viewtopic.php?pid=82698
>   that you have already tried this, with only limited success.  I do  
> not know anything about TinyMCE's internals, and I don't know much  
> about designMode either.  The documentation from Microsoft athttp://msdn.microsoft.com/en-us/library/ms533720(VS.85).aspx

Davide P. Cervone

unread,
Nov 12, 2010, 6:47:22 AM11/12/10
to mathja...@googlegroups.com
OK. Sorry not to be more helpful. Best of luck with the plugin, and
please keep up apprised of your results. Of course, you can continue
to ask questions here as they come up.

Davide

Reply all
Reply to author
Forward
0 new messages