Ticket #6677 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

[with patch, positive review] Sequence doesn't know how to typeset itself

Reported by: burcin Owned by: burcin
Priority: minor Milestone: sage-4.1.2
Component: misc Keywords:
Cc: Work issues:
Report Upstream: Reviewers: John Palmieri
Authors: Burcin Erocal Merged in: Sage 4.1.2.alpha0
Dependencies: Stopgaps:

Description

It seems that Sequence objects forgot how to typeset themselves somewhere between 3.4.2 and 4.1.

In 3.4.2:

sage: res = solve(x^2-2,x)
sage: latex(res)

\left[x  =  -\sqrt{ 2 }, 
 x  =  \sqrt{ 2 }\right]

In 4.1:

sage: latex(res)

\text{[
x == -sqrt(2),
x == sqrt(2)
]}
sage: latex(res[0])
x = -\sqrt{2}

Attached patch adds a _latex_ method to sage.structure.sequence.Sequence.

Attachments

trac_6677-sequence_latex.patch Download (1.2 KB) - added by burcin 4 years ago.
trac_6677-referee.patch Download (620 bytes) - added by jhpalmieri 4 years ago.
apply on top of the other patch

Change History

comment:1 Changed 4 years ago by burcin

  • Status changed from new to assigned

Trac doesn't let me upload the patch. Here it is if anybody wants to review it in the meantime:

 http://sage.math.washington.edu/home/burcin/trac_6677-sequence_latex.patch

Changed 4 years ago by burcin

comment:2 Changed 4 years ago by jhpalmieri

  • Priority changed from major to minor
  • Reviewers set to John Palmieri
  • Summary changed from [with patch, needs review] Sequence doesn't know how to typeset itself to [with patch, positive review] Sequence doesn't know how to typeset itself

Okay, I see why this used to work and doesn't anymore: we used to test elements when formatting for LaTeX using isinstance(x, list), and sequences returned True for this. Now we test using type(x) and looking it up in a dictionary, and there is no entry for "sage.structure.sequence.Sequence". The patch here solves the problem for sequences and includes a doctest. I have a trivial referee's patch (adds 'r' to the triple quotes at the beginning of the docstring, since there are backslashes in it).

Changed 4 years ago by jhpalmieri

apply on top of the other patch

comment:3 Changed 4 years ago by mvngu

  • Status changed from assigned to closed
  • Resolution set to fixed
  • Merged in set to Sage 4.1.2.alpha0

Merged both patches.

Note: See TracTickets for help on using tickets.