Determining size of math layout

Help
2010-06-25
2013-04-29
  • Kenneth Tilton
    Kenneth Tilton
    2010-06-25

    I'd like to size things dynamically around the html being generated by jsMath. Is there any way to get that information shy of asking for the innerHtml and parsing it? btw, the jsMath-based wysiwyg editor is now letting you so some simple algebra and have it checked as you go: teamalgebra dot com (under the "Freestyle" tab).

    ken

     
  • Can you be more explicit about what you are trying to do?  JsMath doesn't have any built-in way to get the bounding box information, but you could probably use the \bbox macro to generate a SPAN whose size you could access through its offsetWidth and offsetHeight.  That, together with its style.verticalAlign value should be enough to determine the height/depth/width of the math.  You would need to use the \cssId macro around the \bbox in order to be able to locate the bbox in the DOM.

    Davide

     
  • Kenneth Tilton
    Kenneth Tilton
    2010-07-09

    I am trying to position dynamic math efficiently within widgets of a js framework (qooxdoo) that has its own positioning/sizing API, so I need to use dimensions of jsMath output to tell qooxdoo how big to make the embedded HTML widgets so they do not clip or waste space. As an example, a student is using my wysiwyg math editor to enter a series of steps solving a problem, and I want to stack them up neatly.

    The bbox macro sounds great, but I am tempted to hack a third parameter into \bbox: an onappear callback:

        \bbox

    My jsMath hack would then append dimension info to form an XHR: "\jsmdims?sid=42;oid;97;w=120;top=-10;bott=12"

    Do you think that would work?