Bug 310513

Summary: No LaTeX output with SAGE
Product: cantor Reporter: Antonio Rojas <arojas>
Component: generalAssignee: Alexander Rieder <alexanderrieder>
Status: RESOLVED FIXED    
Severity: normal CC: piotr5
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In: 4.10
Attachments: Log with SAGE 5.3 (works)
Log with SAGE 5.4 (doesn't work)
Possible fix

Description Antonio Rojas 2012-11-22 16:26:23 UTC
Using 0.4, KDE 4.10 beta 1

With the SAGE backend LaTeX output doesn't work anymore in the worksheets. It works fine with the Maxima backend. 

Reproducible: Always
Comment 1 piotr5 2012-11-30 13:36:13 UTC
this happens only after installing from ppa in ubuntu, with sage 4.0 installed from a tar it worked nicely until I clicked on "restart backend". also back then I needed to start sage in a console in order for cantor to work (probably by connecting to the server?)...

the major difference between those two versions is that the tar didn't install texlive, dvipng, prosper, tipa, gfortran, ffmpeg, libssl, pgf, ps2eps and some additional latex-packages, as a dependency, but likely came with those things from start.
Comment 2 Alexander Rieder 2012-12-02 14:27:36 UTC
Hi,
It all seems to work fine on my setupt here, so i might need some help tracking this bug down.
When you say "LaTeX output doesn't work anymore" do you mean that the fomulas don't get rendered with latex (so you see something like \begin{equation}2+2\end{equation}), or that you just get the regular output that you would also get when disabling the latex-mode?
Could you try disabling/reenabling the typesetting in a running session using the settings menu, and see if that makes a difference?
To give me a good idea what is going on, could you start cantor from console and, reproduce the bug and attach the output to this bug? (you can do for example cantor --backend=sage &>output.log and attach that  file, also please make sure that if you run kdebugdialog all the cantor-related things are enabled)

thank you.
Comment 3 Antonio Rojas 2012-12-03 14:48:24 UTC
I mean the formulas are not rendered, the raw LaTeX code is returned. After some more testing, it seems that it's the update to SAGE 5.4 that breaks it. It works correctly with SAGE 5.3. 

I'm attaching logs for each SAGE version, the only difference I can see is that the tmp dir seems to have changed (~/.sage/temp in 5.3 vs ~/.sage/tmp in 5.4)
Comment 4 Antonio Rojas 2012-12-03 14:49:17 UTC
Created attachment 75605 [details]
Log with SAGE 5.3 (works)
Comment 5 Antonio Rojas 2012-12-03 14:49:42 UTC
Created attachment 75606 [details]
Log with SAGE 5.4 (doesn't work)
Comment 6 Alexander Rieder 2012-12-03 18:49:47 UTC
Created attachment 75612 [details]
Possible fix

Hi,
thank you for your investigations. It looks like the Sage guys changed the way they encapsulate latex output (instead of <span "class=math"> it now is <script type=math/tex>). Could you test the small patch I attached?
Comment 7 Antonio Rojas 2012-12-04 11:28:48 UTC
Yup, everything OK with the patch
Comment 8 Alexander Rieder 2012-12-05 14:36:08 UTC
Git commit addc032ccac46540c19a0e8b0f07ce0951a21a3b by Alexander Rieder.
Committed on 05/12/2012 at 15:33.
Pushed by arieder into branch 'master'.

fix latex output with Sage 5.4

in newer Sage versions the latex output is encapsulated diffrently. Adapt the
backend to those changes.

M  +1    -1    src/backends/sage/sageexpression.cpp

http://commits.kde.org/cantor/addc032ccac46540c19a0e8b0f07ce0951a21a3b