Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The appearance of tables strongly depends of the active CSS attributes applying to them. For example, as shown in the screen capture below, if you add and evaluate the following code in a Jupyter notebook, you will get tables more similar to those in SageCell:

    border: 1px solid gray;
    border-collapse: separate;
    border-spacing: 2px;}
table.table_form td {
    border: 1px solid gray;
    padding: 5px 15px; 
    color: #00a;
    background-color: #f8f8f8;
    text-align: left;

image description

Now, consider the code

rows = [[100,2,3], [4,5,60]]
t = table(rows, frame=True)

The output is

<div class="notruncate">
<table border="1" class="table_form">
<tr class ="row-a">
<td><script type="math/tex">100</script></td>
<td><script type="math/tex">2</script></td>
<td><script type="math/tex">3</script></td>
<tr class ="row-b">
<td><script type="math/tex">4</script></td>
<td><script type="math/tex">5</script></td>
<td><script type="math/tex">60</script></td>

Look at the second line. The border attribute of table is not longer supported in HTML5. Since it has no effect in a modern browser, the frame is not shown.

In SageCell, however, the frame option works. So I imagine that the base code has been modified somehow. Quite surely the same patch could be applied for Jupyter notebooks.

Reading $SAGE_SRC/sage/misc/, it seems that the problem comes from lines 720-723, that is,

if self._options['frame']:
        frame = 'border="1"'
        frame = ''

Perhaps it would suffice to replace frame = 'border="1"' by

frame = 'style="border-style: solid"'

or something similar.