#11186 closed defect (fixed)
Missing parentheses when typesetting coefficients of multivariate polynomials over number fields
Reported by: | jsrn | Owned by: | was |
---|---|---|---|
Priority: | minor | Milestone: | sage-4.7.1 |
Component: | user interface | Keywords: | latex, multivariate polynomials, singular |
Cc: | Merged in: | sage-4.7.1.alpha4 | |
Authors: | Johan Sebastian Rosenkilde Nielsen | Reviewers: | Mariah Lenox |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
Notice the missing parenthesis when attempting to typeset a simple multivariate polynomial:
sage: K.<z> = QQ.extension(x^2 + x + 1) sage: PK.<v,w> = K[] sage: (z+1)*v (z + 1)*v sage: latex((z+1)*v) z + 1 v
This, of course, means that typesetting in the Notebook will also be wrong.
The error seems not to happen with univariate polynomials.
Attachments (1)
Change History (7)
comment:1 Changed 11 years ago by
- Status changed from new to needs_review
comment:2 Changed 11 years ago by
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.
comment:3 Changed 11 years ago by
- Reviewers set to Mariah Lenox
- Status changed from needs_review to positive_review
The patch fixes the reported problem. Ran 'make testlong' and all tests passed. Positive review!
comment:4 Changed 11 years ago by
- Milestone set to sage-4.7.1
comment:5 Changed 11 years ago by
- Merged in set to sage-4.7.1.alpha4
- Resolution set to fixed
- Status changed from positive_review to closed
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?