Ticket #6677(closed defect: fixed)

Opened 4 years ago

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

Reported by: Owned by: burcin burcin minor sage-4.1.2 misc John Palmieri Burcin Erocal Sage 4.1.2.alpha0

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.

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:

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.