Fix various issues in content-mathml.js

S.Y. Lee
2023-03-19T19:06:40Z

HTML code for test examples

```HTML
Set Operations

Unions
A B A B C A B C D A B C A B C A B C D S L S
Complement
A B
Combined
a B C a b B C a B C A B C A B C D A B C A B C A B C D A B C D A B C D A B S L S A B C D A B C D A B C D
Arithmetic Operations

Additions
A B C D A B C D
Multiplications
A B C D A B C D
Divisions
A B A B C D
Quotients
A B A B C D A B C D
Subtractions
A B A B C D A B A
Powers
A b A b c A b c d A b c
Factorials
a a
Combined
A B C D A B C D A B C D A B C D a
Matrices

Selector
A m A m n A m n A m n o p
Matrix Transpose
A A A
Logical Operations
A B C D A B C D A B C D A B C D A B C D A B C D A B C D A B C D A B C D A B C D A B C D a a f a
Sums, Products
x a b x y x a b x y x a b x y x a b x y y a b x a b x y
Integrals
x 0 a f x x 0 a x 0 a f x y 0 b x 0 a x y
n-ary set operations
A L A A L A B A L A B
Exponential
a a a b a b a b a b a b
Vectors

Gradient, Curl, Divergence, Laplacian
x y z x y z x x y z x x y z x x x y z x
Combined
x x x a x a x a x a x x x x x
Functions
f x f x f x f g x
Derivatives
f f f g x f x x 2 f x x f x g x x f x g x x x f x
Partial Derivatives
x m y n k f x y x y 2 f x y x y f x y x 2 y 3 f x y x a y b f x y x a y 3 f x y x y 2 f x y f x y 1 1 3 f 1 1 1 1 f 1 1 f g a b f g a x y x y 1 x y x y 1 2 x y x y a b x y x y a 2 x y x y
Complex numbers
a b a b c a b a b c d ```

I've found a lot of issues in mathml-content-to-presentation converter, regarding parenthesis. For example, different set operators like `union` and `intersect` should be parenthesized correctly according to the `apply` scope, but they were ignored. I also see the same problem in the logical operators.

Also, things like nested powers should be parenthesized, or things become undistinguishable.

I've also made the summations and integrals to parenthesis according to the scope, and made summation to have same precedence as addition, and products, integrals as same as the multiplication. There can be some redundant parenthesis appearing for integrals, but this was the first step for making things correct and consistent.

Also, I have examples of derivatives giving errors or not printed correctly

and also fixed some redundant parenthesis for printing vector operators.