https://bugs.freedesktop.org/show_bug.cgi?id=66081

          Priority: medium
            Bug ID: 66081
          Assignee: [email protected]
           Summary: Improve grouping of binary operators
          Severity: normal
    Classification: Unclassified
                OS: All
          Reporter: [email protected]
          Hardware: All
            Status: UNCONFIRMED
           Version: 4.2.0.0.alpha0+ Master
         Component: Formula Editor
           Product: LibreOffice

This has been reported on the MathJax mailing list:
https://groups.google.com/forum/#!msg/mathjax-users/_naUsEP0Rxs/OH33AWIc5akJ

If you type e.g.

"a + 2 b"

the grouping in the parsed tree will be

"{a + 2} b"

rather than 

"a + {2 b}"

Note that "a + 2 * b" will produce the correct "a + {2 * b}".

Also, binary operations like

a*b*c + d*e*f + g*h*i

are grouped like this

{ { { {{a*b}*c} + {{d*e}*f} } + {{g*h}*i} }

while operators of same priority could just be grouped together like this:

{ {a*b*c} + {d*e*f} + {g*h*i} }

This is not really visible in the editor, but one can see many <mrow> elements
if you export to MathML.

I think the solution to the first problem will be to interpret "2 b" as a
Product (using the terminology of the grammar in
http://cgit.freedesktop.org/libreoffice/core/tree/starmath/source/parse.cxx#n1170),
so that it becomes of priority higher than Sum. If we fix bug 55853 without
breaking https://issues.apache.org/ooo/show_bug.cgi?id=11752, then "2b"
(without space) should become of priority higher than SubSup. I guess this can
be done by grouping token variable and number tokens in one Term here:
http://cgit.freedesktop.org/libreoffice/core/tree/starmath/source/parse.cxx#n1420.

The second problem is less serious (the operator priorities are respected), so
that could just be fixed in mathmlexport.cxx where binary operators of same
priority will be grouped in one <mrow>. We can use the priority from the MathML
operator dictionary
(http://www.w3.org/TR/MathML3/appendixc.html#oper-dict.entries-table) but the
simplest will be to use the nGroup property of the token associated to the
binary op node.

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to