mathnet / mathnet-symbolics

Math.NET Symbolics
http://symbolics.mathdotnet.com
MIT License
349 stars 66 forks source link

LaTeX.format. Braces for degree #10

Closed FoggyFinder closed 8 years ago

FoggyFinder commented 8 years ago

I think in the output string in LaTeX format should be curly brackets ({ }) in the degree .

Example:

"x^(4+sin(x))"
|> Infix.parseOrUndefined
|> LaTeX.format
|> printfn "%s"

Print: x^\left(4 + \sin{x}\right)

Display:

0

I think there should be this string:

x^{\left(4 + \sin{x}\right)}

Display:

1

cdrnet commented 8 years ago

Yes, indeed - thanks!

cdrnet commented 8 years ago

Would we still want to keep the parentheses?

FoggyFinder commented 8 years ago

I agree - they are redundant

cdrnet commented 8 years ago

Yes, let's drop them in this case (controlled by priorities).

So we'd expect parentheses for (x^y)^z, but not for x^(y^z) (when formatted as TeX)?

Would be great to have some more test cases for the unit tests in this area.

FoggyFinder commented 8 years ago

A matter of taste, I like both version:

0

cdrnet commented 8 years ago

I've changed the logic to emit braces rather aggressively, which should resolve this. The parenthesis are as before. Thanks again for reporting this.