Author view: MathML and TeX Encoding

Having trouble installing Oxygen? Got a bug to report? Post it all here.
Mutzel
Posts: 10
Joined: Fri Oct 14, 2011 12:11 pm

Author view: MathML and TeX Encoding

Post by Mutzel »

Hi,

I have a problem viewing formula in author view.

We capture our formulas as MathML (coming from Word or via Mathflow Editor). When I switch to author view I can see the whole formula. So far everthing works fine.
Now, during the process we generate a TeX represenation of the formula. When I switch to author view agein I see only little parts of the formula. Is this something that can be fixed?

The Tex is captured with the annotation element inside the mathml:

Code: Select all


<formula>
<m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
<m:semantics>
<!-- MathML code -->
<m:annotation encoding="TeX">{tex code}</m:annotation>
</m:math>
</formula>
I would like to upload 2 images and a zip file with xml data, but it seems not possible yet.

Thanks for your help!
Andrea
Radu
Posts: 9421
Joined: Fri Jul 09, 2004 5:18 pm

Re: Author view: MathML and TeX Encoding

Post by Radu »

Hi Andrea,

Whenever you want to upload additional resources other than images you will either have to contact us using the support email address support@oxygenxml.com or via our tech support web form:

http://www.oxygenxml.com/techSupport.html

Now coming back to the question, for now Oxygen does not support at all rendering (or editing) TEX equations in the Author mode, probably in your case it presents directly the text content from that m:annotation node. As in your case the MathML equation is also available inside the XML content you could add in the CSS a rule to hide the content of the TEX node completely, for example something like:

Code: Select all

*[encoding="TeX"]{
display:none;
}
or show some static content in-place:

Code: Select all

*[encoding="TeX"]{
visibility:-oxy-collapse-text;
content:"TEX EQUATION";
}
Are the users who edit the document required to modify the TEX formula directly in the Author mode?
Ideally you would not have in the XML document a formula in both forms because it is redundant to do so, you would generate the TEX form at publishing time.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Mutzel
Posts: 10
Joined: Fri Oct 14, 2011 12:11 pm

Re: Author view: MathML and TeX Encoding

Post by Mutzel »

Hi Radu,

I sent a zip-file to the support and hope you can view the files.

We already escape the tex-encoding via the stylesheet. The thing is, whenever we even use the annotation element we can't view the MathML formula in author view. So the rendering is different than without the annotations. I would like to see the MathML formula no matter what annotations I generate.

Thank you and regards
Andrea
Radu
Posts: 9421
Joined: Fri Jul 09, 2004 5:18 pm

Re: Author view: MathML and TeX Encoding

Post by Radu »

Hi Andrea,

I took a look at the samples. In the case which does not get properly rendered (the one which also contains the annotation with the TEX expression) the entire equation is contained in a <semantics> element. Oxygen uses by default the JEuclic library to render MathML and this particular library seems to have trouble rendering the equation when this wrapper element is used.
I tried to use the commercial MathFlow libraries to render the MathML:

http://www.oxygenxml.com/doc/ug-oxygen/ ... ditor.html

and it rendered the equation correctly in both cases so this looks like a bug in JEuclid.

But I got the equation to render correctly also in JEuclid by surrounding the entire fraction in a <mstyle> element like:

Code: Select all

<semantics>
<mstyle>
<mtext>NPH recovery rate=</mtext>
<mfrac>
<mrow>
<msub>
<mrow>
<mtext>NPH grading</mtext>
</mrow>
<mrow>
<mtext>postoperative</mtext>
</mrow>
</msub>
<mo>-</mo>
<msub>
<mrow>
<mtext>NPH grading</mtext>
</mrow>
<mrow>
<mtext>preoperative</mtext>
</mrow>
</msub>
</mrow>
<mrow>
<msub>
<mrow>
<mtext>NPH grading according to Kiefer [2]</mtext>
</mrow>
<mrow>
<mtext>preoperative</mtext>
</mrow>
</msub>
</mrow>
</mfrac>
<mo>×</mo>
<mn>10</mn>
</mstyle>
<annotation encoding="TeX">\hbox{NPH recovery rate=}{{\hbox{NPH
grading}}_{\hbox{postoperative}}-{\hbox{NPH
grading}}_{\hbox{preoperative}}\over{{\hbox{NPH grading according to Kiefer
[2]}}_{\hbox{preoperative}}}}\times 10</annotation>
</semantics>
I do not know that much MathML I'm afraid but I think it's a bug in JEuclid and your original equation (the one with the added annotation) should have worked without additional changes in it.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Radu
Posts: 9421
Joined: Fri Jul 09, 2004 5:18 pm

Re: Author view: MathML and TeX Encoding

Post by Radu »

I added an issue here:

https://sourceforge.net/p/jeuclid/bugs/42/

If you are interested you can follow it and maybe we'll get more info from the JEuclid developers.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Mutzel
Posts: 10
Joined: Fri Oct 14, 2011 12:11 pm

Re: Author view: MathML and TeX Encoding

Post by Mutzel »

Hi Radu,

thank you very much for analysing this problem and reporting the bug.

We will test your solution with mstyle and follow this issue at sourceforge.

Regards,
Andrea
Post Reply