I want to use jsMath for a wysiwyg math editor, but that means having some way of showing the user where they are if they cursor back to somewhere within the math expression to make a change. Ideally this would be a blinking caret to show the insertion point, but it could just be non-blinking and done as a background color or underscore or something. If jsMath cannot display the caret maybe if I can at least get precise text metrics info I could overlay the math with a caret. Is anything like this feasible? Thx.
My suggestion would be to define a macro that inserts the caret. For example, something like
which uses \rlap to make the caret take up no horizontal room, a kern to move it backwards so it is centered between characters, and a \dlap (a jsMath extension) that "down-laps" the caret, meaning it is pushed below the baseline and takes no vertical space. With this definition, "a\caret b" would put the caret between the "a" and "b".
so that document.getElementById("caret") will get you the element containing the caret symbol.
Hope that gets you started.
Wow, I now have my math editor ported to the Web! You have no idea how much code I can throw away now. :) I am going with jsMath for now because I like the extensions not yet ported to MathJax and because I have to think it will be faster for not doing the intermediate translation to MML. Anyway, thanks for a great effort. I'll let you know as soon as there is a web site up.
Log in to post a comment.