Ticket #9086 (closed defect: fixed)
LaTeX representation of negative symbolic fractions broken
| Reported by: | leif | Owned by: | burcin |
|---|---|---|---|
| Priority: | blocker | Milestone: | sage-4.4.3 |
| Component: | symbolics | Keywords: | symbolic fraction, sign, minus, latex, pynac |
| Cc: | Work issues: | ||
| Report Upstream: | N/A | Reviewers: | Mike Hansen |
| Authors: | William Stein | Merged in: | sage-4.4.3.alpha2 |
| Dependencies: | Stopgaps: |
Description (last modified by leif) (diff)
When the numerator of a (negative) symbolic expression happens to be 1 (and only then), the sign is dropped in its LaTeX representation (but not its string representation):
sage: latex(-1/x)
\frac{1}{x}
sage: latex(1/-x)
\frac{1}{x}
Origin of the new doctest failure in sage/graphs/generic_graphy.py, introduced with Sage 4.4.3.alpha0.
Update:
Actually, though I tested many other cases, the same (still) happens if both the numerator and denominator are (symbolic) variables (see also http://trac.sagemath.org/sage_trac/ticket/9086#comment:12):
sage: var("x y")
(x, y)
sage: latex(-x/y)
\frac{x}{y}
sage: latex(x/-y)
\frac{x}{y}
But since it was discovered after the patch that fixes the first issue had been merged, the latter bug is now http://trac.sagemath.org/sage_trac/ticket/9314.
Attachments
Change History
Changed 3 years ago by was
-
attachment
trac_9086-apply_to_pynac.patch
added
apply to src/ repo in pynac spkg
comment:2 Changed 3 years ago by was
- Priority changed from critical to blocker
- Status changed from new to needs_review
The patch to the pynac spkg is long, but is logically nearly trivial. I just copied some code for printing a sign, which Burcin forgot.
The patch to the sage library is merely to test that this is fixed.
William
comment:4 Changed 3 years ago by mhansen
- Status changed from needs_review to positive_review
- Reviewers set to Mike Hansen
- Authors set to William Stein
This looks good to me and fixes the issue. There was a change for #9037 that didn't get included in the spkg merged so far in 4.4.3 so I've included it at
http://sage.math.washington.edu/home/mhansen/pynac-0.2.0.p1.spkg
which should be used instead of the above link.
comment:8 Changed 3 years ago by was
- Status changed from positive_review to closed
- Resolution set to fixed
- Merged in set to 4.4.3.alpha2
comment:10 follow-up: ↓ 12 Changed 3 years ago by damm
- Status changed from closed to new
- Resolution fixed deleted
- Description modified (diff)
comment:12 in reply to: ↑ 10 ; follow-up: ↓ 13 Changed 3 years ago by damm
Replying to damm: Sorry, i've changed the description and couldn't revert the change.
I think the fix didn't solve all problems:
sage: var('x y')
sage: latex(-x/y)
\frac{x}{y}
comment:13 in reply to: ↑ 12 ; follow-up: ↓ 14 Changed 3 years ago by leif
Replying to damm:
I think the fix didn't solve all problems
Indeed. Despite the ticket's name, I think this second case should be addressed on another ticket, since this one had already been merged.
comment:14 in reply to: ↑ 13 Changed 3 years ago by damm
comment:15 Changed 3 years ago by leif
- Status changed from new to closed
- Resolution set to fixed
- Description modified (diff)

Thanks for tracking this down. This patch is the culprit:
http://pynac.sagemath.org/hg/rev/cbd65a7dcf6a
I will only be able to look at this after next weekend.