beta test: sagews to html export/printing

118 views
Skip to first unread message

Harald Schilly

unread,
Dec 2, 2016, 6:50:13ā€ÆAM12/2/16
to sage-cloud-members, sage-...@googlegroups.com
Hello friends of SMC!

In the past year, there were numerous reports about problems exporting sagews files to PDF. We've worked on incrementally improving it, but that never covered all cases. It's simply the truth, that the intermediate Latex representation can't cover all the cases HTML can express.

However, going several steps back and some forward, I've worked on a new way how to deal with this. An HTML export filter generates self-contained HTML files for sagews worksheets. This means, you can use that instead of PDF files to download and send around, since it has no dependencies on anything in SMC. Styling and all images are embedded into it as a single file! If you still need a PDF file, you can use your browser's (or operating system's) PDF printer to generate it: that's usually called "print to file" in the printer dialog.

Right now, we would be happy if you test this and give us feedback. To do this, hold down the "ctrl" or "command" key while you click on the print button in a sagews. A different dialog should show up and once it's finished, you can either open or download the html file.

There are also new features and long-standing bugfixes:

* automatically detecting the title: I.e. the first header in a %md or %html output cell will be used as the title
* folded cells do not show up in the output
* printer friendly syntax highlighting
* full utf8 unicode in code input lines
* feature parity of formula processing
* no problems with copy/pasting from code cells
* ... and it's probably 10x faster.

If you encounter files that cause troubles and errors, please report them to he...@sagemath.com

-- Harald

Dominique Laurain

unread,
Dec 3, 2016, 3:11:38ā€ÆAM12/3/16
to sage-cloud, sage-clou...@googlegroups.com
Hello Harald,

This is my first test....with a simple worksheet...and...

There is a duplicated and not wanted text output in the produced HTML :

"SquaredArea_Ellipse = 4.06156559715611 vs (pi*p*q)^2 = 4.06156559715612Ā SquaredArea = 4.06156559715611Ā Solving max of f0(hh) = hh |--> -1/9*pi^2*(2*hh - 1)*(hh + 2)*(hh - 2)Ā f0(1/2) = 0.000000000000000 vs f0(s/2) = 0.000000000000000Ā f1 = hh |--> -2/9*pi^2*(3*hh - 4)*(hh + 1)Ā root for extrema hh0 = 1.33333333333333Ā root for extrema hh1 = -1.00000000000000Ā f0(hh0) = 4.06156559715611 "

Can you remove (fix) it ?

Beta-tester Dom.

*************

My public worsheet and the result

Harald Schilly

unread,
Dec 3, 2016, 6:13:29ā€ÆAM12/3/16
to sage-cloud, sage-cloud-members
Thank you for testing. I have no idea how to deal with this case,
though, but I'll look into it.

-- Harald

Harald Schilly

unread,
Dec 3, 2016, 6:48:55ā€ÆAM12/3/16
to Harald Schilly, sage-cloud, sage-cloud-members
On Sat, Dec 3, 2016 at 12:12 PM, Harald Schilly <harald....@gmail.com> wrote:
Thank you for testing. I have no idea how to deal with this case,
though, but I'll look into it.

Ā 
Ok, I found a solution for this. It will be deployed with one of our next updates.

-- haraldĀ 

Dominique Laurain

unread,
Dec 3, 2016, 10:45:59ā€ÆAM12/3/16
to sage-cloud, sage-clou...@googlegroups.com
Thank you Harald

Harald Schilly

unread,
Dec 4, 2016, 9:32:05ā€ÆAM12/4/16
to sage-cloud, sage-cloud-members
On Sat, Dec 3, 2016 at 4:45 PM, Dominique Laurain
<dominique...@orange.fr> wrote:
> Thank you Harald

Sure, thank's for testing!

That next update will also be about "getting back to the original
sagews worksheet". In particular, it will be possible to download the
original sagews file from within that html file. This means, the
html-converted file can be hosted anywhere and it's not hard to
continue working with the actual worksheet later on. An idea for the
future is to automatically convert such an html file to a sagews
worksheet, once it is uploaded and opened in SMC.

-- harald

John Cremona

unread,
Dec 8, 2016, 8:48:48ā€ÆAM12/8/16
to sage-cloud, sage-cloud-members
Thanks to Harald for implementing this, which I have just tried out.
(I know that this was in part prompted by my question abot converting
sagews to pdf.)

It would be nice to be able to control the page width. In the example
(attached -- might be of independent interest to William) whe I
display it only themiddle third of the screen is used, with very large
margins. But I suppose that this is because the intention is to be
able to print to pdf?

John
> --
> You received this message because you are subscribed to the Google Groups "sage-cloud" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-cloud+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-cloud/CAGG4CB6oDjiE4Vc2mXWyR1%2B_qWyRtERjmd5T6rJQqgFeHCO2PA%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
X_0(37).sagews.html

Harald Schilly

unread,
Dec 8, 2016, 8:57:56ā€ÆAM12/8/16
to sage-cloud, sage-cloud-members
Hello John. With HTML there is always a bit of interpretation open how
the page will exactly look like. On a screen (which is usually
landscape) it makes little sense to have super long lines to fill the
whole width. That's bad for readability. When printed on paper, you
usually have it in portrait mode, right? There it's ok to only have
small margins.

The trick here is, that when you actually print it the margins are
computed differently. Attached is a screenshot of how my Chrome does
the layout in the print preview.

I don't know which browser you have, but all modern ones should
understand this dual-mode between screen and print medium.

And final word: I know that firefox might only print the very first
page. That's a bug I don't know how to work around and I've even found
an issue ticket dating back to 2004 about this.

-- harald
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-cloud/CAD0p0K4EKXzV3TtxXhkstwWu_dztn21JoZUaeL9Za3_vh9Jrug%40mail.gmail.com.
x_0(37)_print_preview_chrome.png

Harald Schilly

unread,
Dec 8, 2016, 9:01:29ā€ÆAM12/8/16
to sage-cloud, sage-cloud-members
... and well, thank's again for testing this. Looking at the first few
lines some didn't make sense. Looks like the margins are too small and
parts are cut off (e.g. q^10 is missing). I did test this, but
obviously not with your example... I hope that's not some sort of
browser bug.

-- harald

John Cremona

unread,
Dec 8, 2016, 9:33:36ā€ÆAM12/8/16
to sage-cloud, sage-cloud-members
I was using chrome (I even installed it on a machine just for this)
after getting the warnings about firefox. In my browser I didn't see
any cutoff. But in fact for the pretty version there is no need to
see so many terms of the expansions, they are needed for the
computation but for the reader only the fiirst few terms are important
to see. I can fix that by changing the lines which cause the series
to output, adding something like "+O(q^3)".

By the way, I have been running SMC locally using the docker image
William posted instructions here for recently, and it is great. I
wonder how to update it, and whether the projects I started with it
will remain in existence if I do? At the moment I regularly download
the .sagews files since I don't really know what I am doing with
that.... (I am too mean, and my grants too inflexible, to be able to
pay for SMC properly.)

John
> --
> You received this message because you are subscribed to the Google Groups "sage-cloud" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-cloud+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-cloud/CAGG4CB61MPR1zRERS9DDVitVg1%2BXH4%3DcC25ENnH0c62gahqJ6Q%40mail.gmail.com.

William Stein

unread,
Dec 8, 2016, 12:53:43ā€ÆPM12/8/16
to sage-cloud, sage-cloud-members
On Thu, Dec 8, 2016 at 6:33 AM, John Cremona <john.c...@gmail.com> wrote:
> By the way, I have been running SMC locally using the docker image
> William posted instructions here for recently, and it is great. I
> wonder how to update it,

> and whether the projects I started with it
> will remain in existence if I do? At the moment I regularly download
> the .sagews files since I don't really know what I am doing with
> that....


I updated

https://github.com/sagemathinc/smc/blob/master/src/dev/docker/README.md

to (hopefully) answer all of your questions! If not -- tell me.


>
> John
>
> On 8 December 2016 at 14:00, Harald Schilly <harald....@gmail.com> wrote:
>> ... and well, thank's again for testing this. Looking at the first few
>> lines some didn't make sense. Looks like the margins are too small and
>> parts are cut off (e.g. q^10 is missing). I did test this, but
>> obviously not with your example... I hope that's not some sort of
>> browser bug.
>>
>> -- harald
>>
>> --
>> You received this message because you are subscribed to the Google Groups "sage-cloud" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to sage-cloud+...@googlegroups.com.
>> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-cloud/CAGG4CB61MPR1zRERS9DDVitVg1%2BXH4%3DcC25ENnH0c62gahqJ6Q%40mail.gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups "sage-cloud" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-cloud+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-cloud/CAD0p0K6RLgtFkPRWQOZoZzVcp0a7TGVta06fxZR6PeuZnWkLDA%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.



--

Best Regards,
William Stein

CEO, SageMath, Inc.

John Cremona

unread,
Dec 9, 2016, 7:30:31ā€ÆAM12/9/16
to sage-cloud
On 8 December 2016 at 17:53, William Stein <wst...@sagemath.com> wrote:
> On Thu, Dec 8, 2016 at 6:33 AM, John Cremona <john.c...@gmail.com> wrote:
>> By the way, I have been running SMC locally using the docker image
>> William posted instructions here for recently, and it is great. I
>> wonder how to update it,
>
>> and whether the projects I started with it
>> will remain in existence if I do? At the moment I regularly download
>> the .sagews files since I don't really know what I am doing with
>> that....
>
>
> I updated
>
> https://github.com/sagemathinc/smc/blob/master/src/dev/docker/README.md
>
> to (hopefully) answer all of your questions! If not -- tell me.

Thanks a lot. I followed the instructions there to the letter (except
for prefixing most commands with sudo) and I successfully upgraded. A
project currently open in my browser worked fine (I just restated th
sagews which was running).

On security: I see that this runs on port 80. On the plus side this
means that I can connect remotely without having to do anything fancy,
knowing the machine's name is enough. On the other hand so can anyone
else in the world (so I will not reveal the machine's address here!).
By contrast the old Sage notebook server ran on another port which my
university did not let traffic through, so no-one off campus connect
unless they had an account on the machine and could use ssh
tunnelling. Would that work here (replacing port 80 on the command
line)?

John
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-cloud/CA%2BjwZMh_VHHy4-WKu6bQ1tcR8doqjipS9oN4uVzkFeOsBdD97Q%40mail.gmail.com.

William Stein

unread,
Dec 9, 2016, 12:48:51ā€ÆPM12/9/16
to sage-cloud
On Fri, Dec 9, 2016 at 4:29 AM, John Cremona <john.c...@gmail.com> wrote:
>> to (hopefully) answer all of your questions! If not -- tell me.
>
> Thanks a lot. I followed the instructions there to the letter (except
> for prefixing most commands with sudo) and I successfully upgraded. A
> project currently open in my browser worked fine (I just restated th
> sagews which was running).

Thanks for testing them.

> On security: I see that this runs on port 80. On the plus side this
> means that I can connect remotely without having to do anything fancy,
> knowing the machine's name is enough.

Use 443 to encrypt everything (i.e., https).

> On the other hand so can anyone
> else in the world (so I will not reveal the machine's address here!).
> By contrast the old Sage notebook server ran on another port which my
> university did not let traffic through, so no-one off campus connect
> unless they had an account on the machine and could use ssh
> tunnelling. Would that work here (replacing port 80 on the command
> line)?

Yes, you can do exactly that. I've written a new section of the docs
to address your question. Let me know if it works for you after you
test it:

https://github.com/sagemathinc/smc/blob/master/src/dev/docker/README.md#ssh-port-forwarding
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-cloud/CAD0p0K7uJZK8BOvSc2rQL1HkgDO37NNsj7WYaq_RTXTYG6EpqA%40mail.gmail.com.

Aaron Tresham

unread,
Dec 15, 2016, 4:42:00ā€ÆPM12/15/16
to sage-cloud, sage-clou...@googlegroups.com
If you print a sagews with an animation, then the HTML printout just shows "null." Is this the desired behavior? It might be nice if the first scene of the animation were displayed. I have no idea if this is feasible, and it's certainly low priority for me, but I thought I'd mention it. Sorry if this has been brought up before.

Aaron

Harald Schilly

unread,
Dec 16, 2016, 4:40:47ā€ÆAM12/16/16
to sage-cloud, sage-cloud-members
On Thu, Dec 15, 2016 at 10:42 PM, Aaron Tresham <atre...@gmail.com> wrote:
> If you print a sagews with an animation ...

When coding this, that's one of the things I've not even looked at.
Can you send us a link to that worksheet to he...@sagemath.com ? I am
not sure what you mean by animation and that way, I'll additionally
have a test case to look into.

-- harald

Aaron Tresham

unread,
Dec 23, 2016, 7:52:28ā€ÆPM12/23/16
to sage-cloud, sage-clou...@googlegroups.com
I just noticed when converting a sagews with an animation to html today that the first scene of the animation now appears. I think that's a nice change. Thank you.

Aaron

Harald Schilly

unread,
Dec 24, 2016, 6:07:00ā€ÆAM12/24/16
to sage-cloud, sage-cloud-members
On Sat, Dec 24, 2016 at 1:52 AM, Aaron Tresham <atre...@gmail.com> wrote:
> I just noticed when converting a sagews with an animation to html today that
> the first scene of the animation now appears. I think that's a nice change.
> Thank you.

Hello, actually, it should be the whole animation. I wasn't sure if it
is already live or not. The technical implementation could be better,
but for some occasional animations it should work.

If anyone is interested what we're talking about, here is a published
html file of such an animation. Notice, that your browser should show
a small play button below the graph to start the video.

https://cloud.sagemath.com/14eed217-2d3c-4975-a381-b69edcb40e0e/raw/scratch/animation.sagews.html

-- harald

Aaron Tresham

unread,
Dec 24, 2016, 12:20:03ā€ÆPM12/24/16
to sage-cloud, sage-clou...@googlegroups.com
Wow, that's great. I didn't even try to push the play button yesterday. This is live, and working fine for me.

Thanks again!
Reply all
Reply to author
Forward
0 new messages