# Ticket #9086(closed defect: fixed)

Opened 3 years ago

## LaTeX representation of negative symbolic fractions broken

Reported by: Owned by: leif burcin blocker sage-4.4.3 symbolics symbolic fraction, sign, minus, latex, pynac N/A Mike Hansen William Stein sage-4.4.3.alpha2

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.

## Change History

### comment:1 Changed 3 years ago by burcin

• Keywords latex, pynac added; latex removed

Thanks for tracking this down. This patch is the culprit:

I will only be able to look at this after next weekend.

### Changed 3 years ago by was

apply to sage library

### Changed 3 years ago by was

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

### comment:5 Changed 3 years ago by was

Mike, Can you give #9037 a positive review?

### comment:6 Changed 3 years ago by mhansen

Positive review up at #9037.

### comment:7 Changed 3 years ago by was

• Milestone changed from sage-4.4.4 to sage-4.4.3

### 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:9 Changed 3 years ago by mvngu

• Merged in changed from 4.4.3.alpha2 to sage-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:11 Changed 3 years ago by damm

• 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}