- #1
Saladsamurai
- 3,020
- 7
Yeah. I know it is going to be a pain. But I need to do it for work.
If you are not familiar with MathML, it is similar to LaTeX. Here is an example:
The expression [tex]x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}[/tex]would me represented in MathML as
Now my objective is to have my code (written in VBA excel) take in this MathML and output it as something that I can plug into the function toolbar in Excel. For example the above would come out (omitting the tricky plus-minus symbol)as:
=( -b + (b^2-4*a*c)^(1/2))/(2*a)
Now what I have accomplished so far is to have all of the code read onto VBA and inserted into an array such that each element of the ML is an element of the array.
For example: Array(1) = <mrow> Array(2) = <mi> Array(3) = x Array(4) = <mi>
and soooo on...
Now I have to figure out how to turn it into regular old 'typed math.'
Any suggestions? (Besides give up )
I figure the fact that the ML could be seen having been typed from 'left to right" should help... but I am having trouble seeing how to attack this.Even the most "trivial" of suggestions would be appreciated.
Thanks!
EDIT: Okay let's add in some of these element's definitions:
mrow—displays its subelements in a horizontal row.
mi—represents an identifier such as the name of a function or variable.
mo—represents an operator or delimiter.
mn—represents a number.
If you are not familiar with MathML, it is similar to LaTeX. Here is an example:
The expression [tex]x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}[/tex]would me represented in MathML as
Code:
<mrow>
<mi>x</mi>
<mo>=</mo>
<mfrac>
<mrow>
<mo form="prefix">−</mo>
<mi>b</mi>
<mo>±</mo>
<msqrt>
<msup>
<mi>b</mi>
<mn>2</mn>
</msup>
<mo>−</mo>
<mn>4</mn>
<mo>⁢</mo>
<mi>a</mi>
<mo>⁢</mo>
<mi>c</mi>
</msqrt>
</mrow>
<mrow>
<mn>2</mn>
<mo>⁢</mo>
<mi>a</mi>
</mrow>
</mfrac>
</mrow>
</math>
Now my objective is to have my code (written in VBA excel) take in this MathML and output it as something that I can plug into the function toolbar in Excel. For example the above would come out (omitting the tricky plus-minus symbol)as:
=( -b + (b^2-4*a*c)^(1/2))/(2*a)
Now what I have accomplished so far is to have all of the code read onto VBA and inserted into an array such that each element of the ML is an element of the array.
For example: Array(1) = <mrow> Array(2) = <mi> Array(3) = x Array(4) = <mi>
and soooo on...
Now I have to figure out how to turn it into regular old 'typed math.'
Any suggestions? (Besides give up )
I figure the fact that the ML could be seen having been typed from 'left to right" should help... but I am having trouble seeing how to attack this.Even the most "trivial" of suggestions would be appreciated.
Thanks!
EDIT: Okay let's add in some of these element's definitions:
mrow—displays its subelements in a horizontal row.
mi—represents an identifier such as the name of a function or variable.
mo—represents an operator or delimiter.
mn—represents a number.
Last edited: