Ask Your Question

Printing stuff from Sage notebook

asked 2011-10-24 09:45:26 -0500

G-Sage gravatar image

updated 2011-10-25 03:11:17 -0500

I run some code, I get some output. I want to print that output. Maybe it includes a picture of a graph and some writing as well. How can I print this? Earlier today, in this situation, I copied the image and pasted it into Word. I then copied the text and copied it into Word. That worked. I also tried highlighting it all and printing selection in Firefox. That did not work. It didn't print the picture and it didn't print some of the text. I'm hoping there's just a built in way to do this.

Just to be clear, I have a bunch of code that has been run, maybe I only want to print the output of one bit instead of printing pages and pages to have one page with the stuff I actually am interested in.

Update: Here's my suggestion. I run a program, there is some output. I click the print button NEXT TO THAT OUTPUT and it prints that output only. If I want to print everything, I push the one at the top of the page, which I already knew about. Maybe this is a huge pain. If so, that's fine. But, it's my suggestion!


edit retag flag offensive close merge delete



That does sound like a good suggestion. Consider [sending a feature request to sage](

process91 gravatar imageprocess91 ( 2011-10-25 03:47:17 -0500 )edit

3 answers

Sort by ยป oldest newest most voted

answered 2011-10-24 11:18:45 -0500

kcrisman gravatar image

updated 2011-10-24 11:38:14 -0500

There is the "print" option that is fairly large as a button along the top...

Also, see sws2tex for a more sophisticated thing that usually works pretty well, except with 3D plots.

The options "Edit" and "Text" along the top are also fairly useful for this.

edit flag offensive delete link more


And to print just one page, most print facilities in computers have options to print just one or two specified pages...

kcrisman gravatar imagekcrisman ( 2011-10-24 11:19:12 -0500 )edit

Half of what I want to print is on the bottom half of one page, half is on the top half of the next, for example.

G-Sage gravatar imageG-Sage ( 2011-10-24 11:20:30 -0500 )edit

@G-Sage Can you simply put newlines to move the content onto one page?

process91 gravatar imageprocess91 ( 2011-10-24 19:21:49 -0500 )edit

I think I would delete everything I DON'T want to print from a copy of the worksheet.

Dirk Danckaert gravatar imageDirk Danckaert ( 2011-10-25 10:45:30 -0500 )edit

@Dirk Danckaert I don't want the code, but I want the output... if I delete all the code, the output goes away. I guess I could leave a blank line or something.

G-Sage gravatar imageG-Sage ( 2011-10-25 11:20:56 -0500 )edit

answered 2014-02-18 04:06:31 -0500

russ_hensel gravatar image

Poking around on this I found that %hideall on the first line of the cell worked. This is on a notebook version 5.1 under virtual box

edit flag offensive delete link more



Later when editing the worksheet the cell was almost unreachable, to get at it I deleted the %hideall in the text mode, make sure you use the save at the top of the text box ( by text I mean the text mode accessed with the upper right <edit> button).

russ_hensel gravatar imageruss_hensel ( 2014-02-19 05:01:22 -0500 )edit

answered 2011-10-26 00:49:08 -0500

Ivan Andrus gravatar image

You can add %hide to the beginning of a cell to hide the code and only show the output, but it looks like the whole cell still gets printed ( with Safari 5.1.1). Bug #5718 was about this, but was fixed 2 years ago. I have opened bug #11955.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2011-10-24 09:45:26 -0500

Seen: 1,002 times

Last updated: Feb 18 '14