Regina, I'm aligned with all of your comments below.
I just visited the Forums and found 243 threads on OpenOffice Math, <https://forum.openoffice.org/en/forum/viewforum.php?f=12>. These go back to 2007. There is also a link there to documentation on OpenOffice.org: There's "Getting Started with Math" and also a "Math Guide", <https://wiki.openoffice.org/wiki/Documentation/OOo3_User_Guides/Chapters>. The Math Guide provides a nice informal guide to the StarMath 5.0 notation, with many examples. I think we could start there looking for a grammar. I fear the bug you see is not a bug, but a pitfall with how the StarMath notation works. There are warnings about similar cases in the Guide. Using {...} is very important. It appears that "2b" is treated as two terms, a numeral followed by a symbol. So a+2b ends up parsing the same as {a+2}b. That is a little odd, but it makes for a very simple language, and the user does have control. To show how this is done in a kind of mindless way and the MathML might be quite unexpected, notice what is displayed, versus what the MathML is for "a+b times c newline {a+b} times c newline a+{b times c} newline a times b + c newline a times {b+c} newline {a times b}+c" - Dennis -----Original Message----- From: Regina Henschel [mailto:rb.hensc...@t-online.de] Sent: Thursday, November 13, 2014 13:46 To: dev@openoffice.apache.org Subject: Re: grammar for StarMath Hi Dennis, Dennis E. Hamilton schrieb: > I'm interested in your long-term task. I think that would be useful > to do. I'm willing to work on that with you, especially if there is > no hurry. That is great. My current state is very early: looking around and collecting information, and trying to understand the source code and get a structured view on it. From my side, there is no hurry. I have still my daily job as teacher and therefore most things I do for OpenOffice (or ODF) I do in the holidays. And outside the holidays I am often time-poor, which you notice from my slow reaction. So please do not expect quick improvements. I'm happy, that you already contribute ideas. Find some comments inside. > > I don't think there is any operator precedence in StarMath 5.0, which > is why it is important to use explicit { ... }. It would be > interesting to know what the rule for implicit multiplication might > be also, concerning the "2b" in a+{2b}. That should be easy to > check, and also to determine how clean unary versus binary operations > are distinguished. I need to find a way to read the generated node tree. The errors in the MathML export might originate in the filter or in an insufficient node tree. > > I'm not clear that a grammar is easy to derive in the sense of BNF. > One way would be to try enough of the operators, brackets, etc., and > see how they map. One could also look at the parser in the code. > Before going too far down that road, perhaps the OpenOffice Forums > have something in their collection of material. You are right. Forum and mailing list have different users. > > I expect that the parser is relatively simple with many reserved > works, providing more of a markup notation than a formula notation. > (I suspect the result is presentation of a formula more than it is > something that can be interpreted as a formula in the sense of > evaluation or symbolic manipulation.) I just looked at the > commands.src file in AOO/trunk/main/staremath/source/ and I think > that tells you a lot about the grammar. I couldn't find anything > about the attributes. Experiments may be needed there. > > My thinking is that there are some useful tests to run. In > particular, will OpenOffice Math work properly on an ODF Formula > document that has no annotation? (I.e., the StarMath portion is > missing.) If the StarMath is required, there is a pretty significant > defect in either ODF 1.2 Part 1 or in the implementation, since there > is not enough information for someone to interoperate one way, the > other, or both. The defect in not in ODF. ODF refers to MathML 2.0 and has no own specifications. From point of standardization, OpenOffice should not write StarMath into ODF documents, but use it only for the old OOoXML format. MathML 2.0 itself is well maintained by the W3C. Therefore I think that all problems have their origin in the implementation in OpenOffice. You can test the import filter without generating .odf documents, when you start Math module and then use Tools > Import formula. You need a complete .mml document, a <math>..</math> fragment will not work. Seamonkey (Firefox) shows .mml documents without plug-in, so a comparison exists. Currently I have not installed Amaya (unfortunately W3C stopped development), but Amaya is suitable for comparisons too. The other way is of cause to simple delete the annotation. I had done that, when I tested, whether the MathML part of my introduced colors works. > > If OpenOffice Math will open a MathML that has no (recognizable) > annotation, you could check the example you have, and others, by > seeing what StarMath AOO shows when such a MathML is loaded. > > That would provide information for deducing the grammar. In > particular, it would help understand where {...} are needed for some > of the attributes, how brackets and {...} interact, etc. > > Is this interesting? Such starting would result in a collection of test files, which are needed later on anyways. Therefore it is surely useful. It might result in a lot of issues. Kind regards Regina > > - Dennis > > -----Original Message----- From: Regina Henschel > [mailto:rb.hensc...@t-online.de] Sent: Wednesday, November 12, 2014 > 00:18 To: dev@openoffice.apache.org Subject: Re: grammar for > StarMath > > Hi Dennis, > > thank you for looking at it. But I'm looking for a BNF or other form > of derivation rules or any kind of informal specification. > > The exported MathML is known to have structural deficits, for example > 'a + 2 b' will result in <mrow> <mi>a</mi> <mo > stretchy="false">+</mo> <mn>2</mn> </mrow> <mi>b</mi> which is a > structure '{a+2} b', where it should be a structure 'a + {2 b}'. > > It is a long-term task (in which I'm interested) to get a better > representation of the formulas in MathML and so be able to drop > StarMath. And therefore I'm looking for some developer information > about StarMath. If such does not exist, the way through examining > code and examples will be harder. > > Kind regards Regina > > > Dennis E. Hamilton schrieb: >> I have an incomplete result. You may have already explored this. >> >> First, saving an AOO Formula (.odf) as a StarMath 5.0 Formula >> (.smf) does not seem to be exported. There is no import for it >> either. >> >> You can still save as an OpenDocument.org .sxm formula or an ODF >> Formula (.odf). They are nearly identical. >> >> Both .sxm and .odf are Zip Packages and nearly identical. In >> particular, the content.xml is a MathML formula that has a StarMath >> 5.0 formula as an annotation. It is exactly the same formula that >> you end up editing in the lower window of the Apache OpenOffice >> Math (or LibreOffice Math) application. So the upper window shows >> the MathML rendering, and the lower window shows the StarMath 5.0! >> And the content.xml carries both. >> >> In effect, the Elements Tool and the hand editing that you do is >> creating StarMath that is then displayed via MathML in the upper, >> graphical-formula window. >> >> That doesn't provide the StarMath grammar except by example, but it >> is a way to build them experimentally and see. >> >> Finally, this led me to the Help Topic "Math formula editor" and >> click the Formulas link to get to "Welcome to the OpenOffice Math >> Help" page. The subtopic "Formula Reference Tables" seems to be >> the key. The color function is under "Attributes". >> >> StarMath uses {...} for precedence/grouping control in the same >> manner as TeX and LaTeX formulas. >> >> We can probably figure out the grammar by making examples of all >> the operators and other oddities. >> > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org > For additional commands, e-mail: dev-h...@openoffice.apache.org > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org > For additional commands, e-mail: dev-h...@openoffice.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org For additional commands, e-mail: dev-h...@openoffice.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org For additional commands, e-mail: dev-h...@openoffice.apache.org