# Revision history [back]

Hello, @Cyrille! As pointed by slelievre, I could have used a minimal working example; however, from what I understand, the following should achieve the desired result:

rows = [['a', 'b', 'c'], [100,2,3], [4,5,60]]
t = table(rows)
t_html = <center> + html(t) + </center>
html(t_html)


I have defined a simple table t with rows rows for the purpose of this example, but this should work with any other Sage table. The key lines here are the last two. SageCell is, in essence, a webpage, so it can be manipulated by means of adequate HTML tags and CSS files in any conceivable ways.

The html command can convert Sage objects into HTML notation for you. That's what I did in the third line with the html(t) part. I also surrounded this code with the center tag which is what achieves the desired effect. I stored the resulting code (as text or string) into the variable t_html (i.e., up to this point, you have the HTML code to create a centered table as text inside t_html).

Another thing the html command from Sage does is to take some HTML code and "pass it" to the browser so it renders it as part of the SageCell webpage. That's what I did in the last line.

Hope this helps!

Hello, @Cyrille! As pointed by slelievre, I could have used a minimal working example; however, from what I understand, the following should achieve the desired result:

rows = [['a', 'b', 'c'], [100,2,3], [4,5,60]]
t = table(rows)
t_html = <center> '<center>' + html(t) + </center>
'</center>'
html(t_html)


I have defined a simple table t with rows rows for the purpose of this example, but this should work with any other Sage table. The key lines here are the last two. SageCell is, in essence, a webpage, so it can be manipulated by means of adequate HTML tags and CSS files in any conceivable ways.

The html command can convert Sage objects into HTML notation for you. That's what I did in the third line with the html(t) part. I also surrounded this code with the center tag from the HTML language, which is what achieves the desired effect. I stored the resulting code (as text or string) into the variable t_html (i.e., up to this point, you have the HTML code to create a centered table as text inside t_html).

Another thing the html command from Sage does is to take some HTML code and "pass it" to the browser so it renders it as part of the SageCell webpage. That's what I did in the last line.line does. And voilá!

Hope this helps!