Bug 327259

Summary: LaTeX output doesn't work with Sage 5.12
Product: [Applications] cantor Reporter: Antonio Rojas <arojas>
Component: generalAssignee: Alexander Rieder <alexanderrieder>
Status: RESOLVED FIXED    
Severity: normal CC: karaytanto
Priority: NOR    
Version: 0.4   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In: 4.12
Attachments: possible patch

Description Antonio Rojas 2013-11-07 07:52:07 UTC
LaTeX output doesn't work with Sage 5.12. This is due to http://trac.sagemath.org/ticket/15271
According to the comments in that bug report, the call to "sage.misc.latex.pretty_print_default(true)" doesn't work in the command line interface (and will not work anymore), it should be replaced with "%display typeset"

Reproducible: Always
Comment 1 Yassine SAKOUM 2013-11-10 21:06:08 UTC
i confim this bug
Comment 2 Alexander Rieder 2013-11-11 21:51:55 UTC
Created attachment 83503 [details]
possible patch

thanks for the report. The above patch should fix the problem by switching to the %display command for newer sage versions. The current threshold for "old" is version 5.7 (as this was the last version before Bug 316299).
Does anyone now/can anyone check if this method works with all versions >5.7 or if i need to introduce a finer grading of versions  than just old/new?
I will commit this patch in the next couple of days once I've done some more serious testing.
Comment 3 Alexander Rieder 2013-11-24 20:20:47 UTC
Git commit c3626842a34bd324d271a54b05076840cbd6e616 by Alexander Rieder.
Committed on 24/11/2013 at 20:22.
Pushed by arieder into branch 'KDE/4.12'.

fix typesetting for newer sage versions

Since version 4.12 sage doesn't support the command sage.misc.latex.pretty_print_default anymore.
Instead we use the %display ipython magic. In order to keep the code clean the
specific commands have moved to a dedicated python function "__cantor_enable_typesetting(enable)"
that gets declared on init and called by the backend when needed.
This patch also introduces a finer handling of version numbers instead of just having a simple
"legacy mode".

Tested with Sage versions 5.10 (old commands) and 5.12 (new command)
FIXED-IN: 4.12

M  +3    -3    src/backends/sage/sagecompletionobject.cpp
M  +90   -29   src/backends/sage/sagesession.cpp
M  +24   -2    src/backends/sage/sagesession.h

http://commits.kde.org/cantor/c3626842a34bd324d271a54b05076840cbd6e616
Comment 4 Alexander Rieder 2013-11-24 20:23:17 UTC
Git commit 9ae291155b5cc2bcb21ead0452092de57f81a9a9 by Alexander Rieder.
Committed on 24/11/2013 at 20:22.
Pushed by arieder into branch 'master'.

fix typesetting for newer sage versions

Since version 4.12 sage doesn't support the command sage.misc.latex.pretty_print_default anymore.
Instead we use the %display ipython magic. In order to keep the code clean the
specific commands have moved to a dedicated python function "__cantor_enable_typesetting(enable)"
that gets declared on init and called by the backend when needed.
This patch also introduces a finer handling of version numbers instead of just having a simple
"legacy mode".

Tested with Sage versions 5.10 (old commands) and 5.12 (new command)
FIXED-IN: 4.12
(cherry picked from commit c3626842a34bd324d271a54b05076840cbd6e616)

M  +3    -3    src/backends/sage/sagecompletionobject.cpp
M  +90   -29   src/backends/sage/sagesession.cpp
M  +24   -2    src/backends/sage/sagesession.h

http://commits.kde.org/cantor/9ae291155b5cc2bcb21ead0452092de57f81a9a9