Ask Your Question

Huge output saved in nice format

asked 2012-12-21 11:20:44 +0100

G-Sage gravatar image

updated 2015-01-13 18:23:58 +0100

FrédéricC gravatar image

What I want to do: Hello, for part of a proof, I used Sage to do some calculations on 53 graphs. The output is long (I could make my program make the output shorter but it'd still be somewhat long) and I want to be able to save it and put it on a webpage. I'm thinking the format would be PDF but I'm open to other suggestions. By the way, my output will have both graph pictures and text.

What I have tried: I don't really know what to do. What I have tried is to do the calculations in Sage and then save that as a PDF using Firefox. I don't think I ever figured that out. A friend of mine helped me do the same with Safari and that "worked". But, it's not formatted nicely. If the output is long on one line, that part doesn't show up in the PDF. And, each time it changes from one page to the next, some of the output is lost. It doesn't split it up correctly.

So, does any one know a good way to do this? Any help would be greatly appreciated.

edit retag flag offensive close merge delete



Have you tried SageTeX, or is that not appropriate? Your description is somewhat vague.

kcrisman gravatar imagekcrisman ( 2012-12-21 15:24:09 +0100 )edit

I agree with kcrisman. Can you be more specific about what sort of format you're looking for? If you don't like the SageTeX idea, it shouldn't be hard to write some code which produces one LaTeX file (hence one PDF file) for each graph, along with an html index file linking to all of them.

John Palmieri gravatar imageJohn Palmieri ( 2012-12-21 16:57:57 +0100 )edit

2 Answers

Sort by » oldest newest most voted

answered 2012-12-21 14:15:30 +0100

Jesustc gravatar image

LaTeX :)

For the data, you just have to generate a basic function to print matrices like LaTeX tables, and write them in a LaTeX file. Or use the LaTeX representations that are already on sage for almost every object.

For images, just one function that takes a 'plot' object, saves it in a convenient folder as e.g. pdf, and adds a '\includegraphics{}' to your latex files.

Also, you can easily generate sections, an index... Well, I guess you know LaTeX already ;)

edit flag offensive delete link more


There are hundreds of graph pictures. That'd take days. It's a great idea, but I don't think it will work in this case. Thanks.

G-Sage gravatar imageG-Sage ( 2012-12-21 14:24:17 +0100 )edit

Then why not directly a webpage? As before: save the images to the webpage folder and insert the links to the images in the html document. With some CSS, you can make it quick and pretty.

Jesustc gravatar imageJesustc ( 2012-12-21 14:30:18 +0100 )edit

answered 2013-01-01 16:26:20 +0100

G-Sage gravatar image

updated 2013-01-01 16:30:21 +0100

I googled how to save Firefox output as PDF and found out you can't unless you download some sort of add-on. But, I found that you can do it easily in Google Chrome by doing Ctrl+P and then changing the destination to "Save as PDF". And, after I downloaded Chrome and tried this, I also noticed that it doesn't split up lines of output or graph pictures into two different pages. It does add large portions of white space occasionally, but I made my output much smaller on the side, so the benefits of not splitting up outputs outweighs the negative of extra white space.

I thought I would put this up in case any one else looks at this question sometime.

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


Asked: 2012-12-21 11:20:44 +0100

Seen: 726 times

Last updated: Jan 01 '13