Closed johanrosenkilde closed 13 years ago
I wrote a simple patch to fix the issue and added a doctest for it.
However, sage.libs.singular.polynomial.latex (used for typesetting Singular polynomials) is still very different from -- and seemingly more simple -- than the generic sage.rings.polynomial.polynomial_element.latex; this is perhaps a bit disconcerting and should be looked?
Author: Johan S. R. Nielsen
Attachment: 11186_missing_parenthesis_multi_singular.patch.gz
Patches sage.libs.singular.polynomial.pyx
Slightly improved my patch as I discovered that negative coefficients we typeset with a parenthesis. My fix simplifies some existing code as well.
I discovered simultaneously that in univariate polynomials, certain coefficients will get parentheses around them, even when not needed, such as sqrt{-1} (because it contains a '-' even though it's inside the squareroot). As I copied some code from there, multivariate polynomials now also have this behaviour. This broke a doctests, which I changed.
This is not optimal behaviour, but I didn't want to patch univariate polynomials here (the patch might not be simple either -- parsing TeX, eew). Also, I "introduced" the error in multivariate polynomials to this for two reasons: first of all, without a solution to this sqrt-problem, it's a side-effect of "doing the right thing most of the time"; namely in cases such as the one in the ticket description. And this error is worse than a superfluous parenthesis once in a while. Thirdly, I think that it's nice, if all polynomials render more or less the same way.
The patch fixes the reported problem. Ran 'make testlong' and all tests passed. Positive review!
Reviewer: Mariah Lenox
Merged: sage-4.7.1.alpha4
Changed author from Johan S. R. Nielsen to Johan Sebastian Rosenkilde Nielsen
Notice the missing parenthesis when attempting to typeset a simple multivariate polynomial:
This, of course, means that typesetting in the Notebook will also be wrong.
The error seems not to happen with univariate polynomials.
Component: user interface
Keywords: latex, multivariate polynomials, singular
Author: Johan Sebastian Rosenkilde Nielsen
Reviewer: Mariah Lenox
Merged: sage-4.7.1.alpha4
Issue created by migration from https://trac.sagemath.org/ticket/11186