Dear Klaus, You're right. But it also happens from a shell, so it's a Sage bug not a sage-mode bug. After evaluating pretty_print, then _ stops being updated. It looks like this is an old bug #9683 which has gotten no attention. I think I figured out the problem and how to solve it, but I don't have the time tonight to test it. I updated the ticket with my idea, namely stop setting __builtin__._ in pretty_print. If you want what should be a relatively easy patch, go for it. Otherwise, I'll try to get to it in the next few days.
I'm not sure about the latex(sqrt(2)) issue, I haven't looked at that. Feel free to remind me and/or open a trac ticket (though you should search for one first). -Ivan On Nov 25, 2012, at 12:27 AM, Klaus Dohmen <[email protected]> wrote: > Dear Ivan, > > the workaround works. There is, however, a strange behaviour of the > underscore (_), for instance (after sage-view is enabled): > > sage: 1 > 1 > sage: 2 > 2 > sage: _ > 1 ;; should be 2 > > Also, in constrast to the notebook, latex(sqrt(2)) (as an example) does > not give the latex expression of sqrt(2), instead it is rendered. > > Thanks for opening the ticket and for your kindful help. > > Best regards, > > Klaus. > > > > > > > Ivan Andrus <[email protected]> schrieb am Sat, 24. Nov 22:12: >> To delete the old version you can just delete the whole >> "/opt/sage/current/local/share/emacs" directory and reinstall. Installing >> the new version should overwrite everything, but you're probably right that >> it's better to completely start over. Sage might still think it has both >> packages installed, but it doesn't matter. You are right there is no way to >> uninstall an spkg. >> >> The reason they have different names is that sage parses the version as >> being everything after the first hyphen. Hence with the old version, it >> thinks the package is sage, and the version is mode-0.7. The new version >> naming fixes this. I'm sure you can find a few other packages that have >> this problem. So that's why I changed it. It really should be harmless >> though. >> >> Anyway, I guess I should have tested this on my machine before replying. >> Personally I don't use the pretty printing for non graphics since it messes >> up copying, so I didn't notice. Something was changed with a recent version >> of Sage in the html that it outputs. Until I get a chance to fix this >> properly in the spkg you can add the following to your .emacs (after the >> require): >> >> (setq sage-view-start-string "<html><script type=\"math/tex\">") >> (setq sage-view-final-string "</script></html>") >> >> FWIW, I have opened a ticket on bitbucket: >> https://bitbucket.org/gvol/sage-mode/issue/12/support-new-version-of-html-pretty-print >> >> -Ivan >> >> On Nov 24, 2012, at 8:47 PM, Klaus Dohmen <[email protected]> wrote: >> >>> Dear Ivan, >>> >>> I tried the new version without success. Inline graphics are ok (though >>> I do not know how to scale them), but other inline output is html. >>> >>> Maybe this is caused by a new problem which arose since the names of the >>> two versions of sage-mode differ in their fifth position: >>> >>> sage-mode-0.7.spkg >>> sage_mode-0.8.spkg >>> >>> The latter did not replace the first on my system because of the >>> underscore (_). Now I have two versions of sage-mode installed. How do I >>> get rid of sage-mode-0.7.spkg? I tried to change '_' to '-' in the name >>> of the newer package, and then install, but then, when extracing, sage >>> complains that the directory sage-mod-0.8 does not exist. >>> >>> I need to resolve that problem first. Interestingly, I did not found a >>> command-line option for sage for removing packages. >>> >>> Best greetings, >>> >>> Klaus. >>> >>> >>> >>> Ivan Andrus <[email protected]> schrieb am Sat, 24. Nov 15:24: >>>> IIRC this was fixed with sage-mode version 0.8. You didn't mention which >>>> version, so I'm assuming the 0.7 which is part of Sage. Can you try >>>> installing from >>>> >>>> http://boxen.math.washington.edu/home/iandrus/sage_mode-0.8.spkg >>>> >>>> If that fixes the problem, then you might consider reviewing trac ticket >>>> #13182: >>>> >>>> http://trac.sagemath.org/sage_trac/ticket/13182 >>>> >>>> If the problem persists, then I'll dig into it. You might also have to >>>> >>>> (require 'sage-view) >>>> >>>> -Ivan >>>> >>>> On Nov 24, 2012, at 12:15 PM, Klaus Dohmen <[email protected]> wrote: >>>> >>>>> I am using emacs with sage-mode. When I run >>>>> >>>>> 1+1 >>>>> >>>>> it outputs html-code, instead of a LaTeX-rendered output: >>>>> >>>>> <html><script >>>>> type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}2</script></html> >>>>> >>>>> How can I change this? My configuration file contains the lines >>>>> >>>>> (add-to-list 'load-path (expand-file-name >>>>> "/opt/sage/current/local/share/emacs")) >>>>> (setq sage-dir "/opt/sage/current") >>>>> (require 'sage sage") >>>>> (setq sage-command "sage") >>>>> (add-hook 'sage-startup-after-prompt-hook >>>>> (lambda () (interactiv)e'Sage Version 5.4, Release Date: >>>>> 2012-11-09''Sage Version 5.4, Release Date: 2012-11-09' >>>>> (sage-view 1))) >>>>> >>>>> I am using 'Sage Version 5.4, Release Date: 2012-11-09' on Ubuntu 12.04. >>>>> >>>>> Thanks for your help in advance. >>>>> >>>>> Klaus. >>>>> >>>>> >>>> >>> >> > > -- > Prof. Dr. Klaus Dohmen > Hochschule Mittweida > University of Applied Sciences > Dept. of Mathematics > 09648 Mittweida, Germany > > > -- > You received this message because you are subscribed to the Google Groups > "sage-support" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > Visit this group at http://groups.google.com/group/sage-support?hl=en. > > -- You received this message because you are subscribed to the Google Groups "sage-support" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sage-support?hl=en.
