As for the Click macro, I understand the desire for it, but have not
yet worked out the details of how to deal with event handling in the
HTML-CSS output. Whatever we do needs to be something that is (or can
be) mirrored in ALL the output jax, since the user can change from one
to another via the MathJax contextual menu. One of the things that
concerns me here is that the bounding boxes of the spans for the
various elements do not always correspond to the glyphs they contain
(e.g., many are zero height in order to make the placement of their
contents work properly, and others have height that is the line height
even when their contents are much larger). This may not be the case
for mo, mi, and mn, but the event handling that I have in mind needs
to be usable for other elements (like mfrac) as well, and so would
have to deal with those issues. The current spans are not well suited
to that.
So at this point, I don't think these changes will be added to the
core. If course, you can override the methods that require these
changes in your own extension (as I'm sure you are doing now), though
that is certainly more cumbersome to maintain.
Best of luck with your application. Please keep us informed of your
progress.
Davide
This suggestion also has problems. For one thing, it doesn't properly
remove arguments from the original string nor insert them into the
macro, but that could be fixed. The real problem is that the string
handled by TEX.Parse() must be a complete TeX expression that can be
processed in isolation, but TeX macros can contain partial expressions
that interact with the previous and following content. For example,
you can do
\def\bbb{\begin{array}}
\def\eee{\end{array}}
\bbb{cc}
a&b\\
c&d
\eee
which is equivalent to
\begin{array}{cc}
a&b\\
c&d
\end{array}
Your implementation would not handle this properly (try it out in your
test page and see). Similarly, you could do
\def\R{{\bf R}^}
f\colon\R2\to\R3
to get a function mapping R^2 to R^3. Again, your approach will fail
to handle this. Macro substitutions are not like function calls
(which create their own local environments); they are just string
replacements (which is why they are implemented the way they are). I
don't think you are going to manage this through separate Parse
instances.
While I understand your desire to have this reverse mapping, it is
probably not something that is going to be included in the core
MathJax functionality.
Davide