ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 13 Sep 2016 13:42:20 +0200how to render html or latex tables in jupyter notebook?https://ask.sagemath.org/question/34782/how-to-render-html-or-latex-tables-in-jupyter-notebook/Dear all,
I moved a few of my sagenb worksheets to jupyter, but I don't seem to be able to nicely display tables. For example:
blah = [('Header1', 'Header2'), (1,2), (3,4), (5,6)]
html.table(blah)
returns the html code for the table, but does not render it. Is there a way to display a nicely typeset table in the jupyter notebook using the sage kernel?
Cheers
StanFri, 09 Sep 2016 14:34:33 +0200https://ask.sagemath.org/question/34782/how-to-render-html-or-latex-tables-in-jupyter-notebook/Comment by kcrisman for <p>Dear all,
I moved a few of my sagenb worksheets to jupyter, but I don't seem to be able to nicely display tables. For example:</p>
<pre><code>blah = [('Header1', 'Header2'), (1,2), (3,4), (5,6)]
html.table(blah)
</code></pre>
<p>returns the html code for the table, but does not render it. Is there a way to display a nicely typeset table in the jupyter notebook using the sage kernel?
Cheers
Stan</p>
https://ask.sagemath.org/question/34782/how-to-render-html-or-latex-tables-in-jupyter-notebook/?comment=34783#post-id-34783Did you try `pretty_print()` around the html? That may be the new way to do it.Fri, 09 Sep 2016 14:52:53 +0200https://ask.sagemath.org/question/34782/how-to-render-html-or-latex-tables-in-jupyter-notebook/?comment=34783#post-id-34783Comment by kcrisman for <p>Dear all,
I moved a few of my sagenb worksheets to jupyter, but I don't seem to be able to nicely display tables. For example:</p>
<pre><code>blah = [('Header1', 'Header2'), (1,2), (3,4), (5,6)]
html.table(blah)
</code></pre>
<p>returns the html code for the table, but does not render it. Is there a way to display a nicely typeset table in the jupyter notebook using the sage kernel?
Cheers
Stan</p>
https://ask.sagemath.org/question/34782/how-to-render-html-or-latex-tables-in-jupyter-notebook/?comment=34786#post-id-34786Alternately, see https://groups.google.com/forum/#!topic/sage-devel/8erxWppKxXMFri, 09 Sep 2016 16:44:56 +0200https://ask.sagemath.org/question/34782/how-to-render-html-or-latex-tables-in-jupyter-notebook/?comment=34786#post-id-34786Comment by kcrisman for <p>Dear all,
I moved a few of my sagenb worksheets to jupyter, but I don't seem to be able to nicely display tables. For example:</p>
<pre><code>blah = [('Header1', 'Header2'), (1,2), (3,4), (5,6)]
html.table(blah)
</code></pre>
<p>returns the html code for the table, but does not render it. Is there a way to display a nicely typeset table in the jupyter notebook using the sage kernel?
Cheers
Stan</p>
https://ask.sagemath.org/question/34782/how-to-render-html-or-latex-tables-in-jupyter-notebook/?comment=34787#post-id-34787And finally, you may want to add `%%html` or `%html` at the top of such a cell and see if that gives what you want.Fri, 09 Sep 2016 16:45:22 +0200https://ask.sagemath.org/question/34782/how-to-render-html-or-latex-tables-in-jupyter-notebook/?comment=34787#post-id-34787Comment by nbruin for <p>Dear all,
I moved a few of my sagenb worksheets to jupyter, but I don't seem to be able to nicely display tables. For example:</p>
<pre><code>blah = [('Header1', 'Header2'), (1,2), (3,4), (5,6)]
html.table(blah)
</code></pre>
<p>returns the html code for the table, but does not render it. Is there a way to display a nicely typeset table in the jupyter notebook using the sage kernel?
Cheers
Stan</p>
https://ask.sagemath.org/question/34782/how-to-render-html-or-latex-tables-in-jupyter-notebook/?comment=34788#post-id-34788on sage 7.4beta1 I get in the jupyter notebook:
DeprecationWarning: use table() instead of html.table()
(and a nicely rendered html table) If I do:
table(blah)
I get the desired result immediately. I'm not sure if 7.3 already does this as well, but upgrading or waiting until 7.4 is released and then upgrading should make your life easier.Fri, 09 Sep 2016 21:15:36 +0200https://ask.sagemath.org/question/34782/how-to-render-html-or-latex-tables-in-jupyter-notebook/?comment=34788#post-id-34788Comment by stan for <p>Dear all,
I moved a few of my sagenb worksheets to jupyter, but I don't seem to be able to nicely display tables. For example:</p>
<pre><code>blah = [('Header1', 'Header2'), (1,2), (3,4), (5,6)]
html.table(blah)
</code></pre>
<p>returns the html code for the table, but does not render it. Is there a way to display a nicely typeset table in the jupyter notebook using the sage kernel?
Cheers
Stan</p>
https://ask.sagemath.org/question/34782/how-to-render-html-or-latex-tables-in-jupyter-notebook/?comment=34811#post-id-34811Thanks a lot! I hadn't realised that I was still running Sage 6.8, as I had problems with 7.3. I can confirm now that table(blah) displays nicely in 7.3Tue, 13 Sep 2016 13:42:20 +0200https://ask.sagemath.org/question/34782/how-to-render-html-or-latex-tables-in-jupyter-notebook/?comment=34811#post-id-34811Answer by slelievre for <p>Dear all,
I moved a few of my sagenb worksheets to jupyter, but I don't seem to be able to nicely display tables. For example:</p>
<pre><code>blah = [('Header1', 'Header2'), (1,2), (3,4), (5,6)]
html.table(blah)
</code></pre>
<p>returns the html code for the table, but does not render it. Is there a way to display a nicely typeset table in the jupyter notebook using the sage kernel?
Cheers
Stan</p>
https://ask.sagemath.org/question/34782/how-to-render-html-or-latex-tables-in-jupyter-notebook/?answer=34791#post-id-34791Just use `table(blah)` instead of `html.table(blah)`.
In the Sage REPL the table will be rendered as text:
sage: blah = [('A', 'B', 'C'), (0, 1, 2), (3, 4, 5), (6, 7, 8)]
sage: table(blah)
A B C
0 1 2
3 4 5
6 7 8
In a Juypter notebook Sage worksheet the table will be rendered as html.
Here is a screenshot from
[this sage-devel post by Volker Braun](https://groups.google.com/d/msg/sage-devel/8erxWppKxXM/RNbtkjw6CgAJ).
![HTML table in Jupyter notebook Sage worksheet](https://lh3.googleusercontent.com/-mROFT73lCRs/V9MyE0CAH6I/AAAAAAAAb8A/w5ZN6NyVDg0LLGuBV6O3p-MR5uQWCq7AACLcB/s1600/table.png)Sat, 10 Sep 2016 10:03:39 +0200https://ask.sagemath.org/question/34782/how-to-render-html-or-latex-tables-in-jupyter-notebook/?answer=34791#post-id-34791