Export a Sage Table to a webpage/html

48 views
Skip to first unread message

ObsessiveMathsFreak

unread,
Jun 2, 2012, 10:28:54 AM6/2/12
to sage-s...@googlegroups.com
I have used the following sage code to create a nice table in the notebook
---------------------
var('n k')
N=5
K=8
H=[["$k$"]+["$L^{k}_{"+latex(n)+"}(x)$" for n in [0..(N)]]]
Pknz_draw= [ [k]+[ (0*x+ gen_laguerre(n,k,x)).expand() for n in [0..N]] for k in [0..K] ]
html.table(H+Pknz_draw,header=True)
--------------------


How can I save this table and use it in a seperate html file?

If not, in what other way could the table be exported?

Dima Pasechnik

unread,
Jun 2, 2012, 11:23:55 AM6/2/12
to sage-s...@googlegroups.com
On Saturday, 2 June 2012 16:28:54 UTC+2, ObsessiveMathsFreak wrote:
I have used the following sage code to create a nice table in the notebook
---------------------
var('n k')
N=5
K=8
H=[["$k$"]+["$L^{k}_{"+latex(n)+"}(x)$" for n in [0..(N)]]]
Pknz_draw= [ [k]+[ (0*x+ gen_laguerre(n,k,x)).expand() for n in [0..N]] for k in [0..K] ]
html.table(H+Pknz_draw,header=True)
--------------------


How can I save this table and use it in a seperate html file?

this is certainly doable; however, it won't render correctly as a stand-alone
html file, as you will have to add an invocation of mathjax or another latex-rendering library in the header of the html file.
 

If not, in what other way could the table be exported?

exporting a LaTeX table might be easier...
 

Jason Grout

unread,
Jun 2, 2012, 1:18:28 PM6/2/12
to sage-s...@googlegroups.com
On 6/2/12 9:28 AM, ObsessiveMathsFreak wrote:
> I have used the following sage code to create a nice table in the notebook
> ---------------------
> var('n k')
> N=5
> K=8
> H=[["$k$"]+["$L^{k}_{"+latex(n)+"}(x)$" for n in [0..(N)]]]
> Pknz_draw= [ [k]+[ (0*x+ gen_laguerre(n,k,x)).expand() for n in [0..N]]
> for k in [0..K] ]
> html.table(H+Pknz_draw,header=True)

Note that you can now give the header argument the actual header list:

H=["$k$"]+["$L^{k}_{"+latex(n)+"}(x)$" for n in [0..(N)]]
html.table(Pknz_draw, header=H)



> How can I save this table and use it in a seperate html file?

You could "edit" the worksheet and copy the html from the output area of
the cell.

Thanks,

Jason

Reply all
Reply to author
Forward
0 new messages