Display latex table/tabular in Jupyter with latex cell magic

后端 未结 1 795
孤独总比滥情好
孤独总比滥情好 2021-02-13 06:58

According to this Rich Display System example the Jupyter notebook can display latex using the %%latex cell magic.

The example given using the align

相关标签:
1条回答
  • 2021-02-13 07:15

    Answer

    Jupyter builds on MathJax and cite "MathJax doesn't implement tabular". The link also shows the recommended array environment as tabular replacement.


    Workaround:

    Latex can also be used in Markdown cells (Celltype Markdown instead of Code). You can select the left area besides the cell and press "m" key or via Cell>Cell-Type in top menu. Then you could use html for the table.

    <table>
        <tr>
            <td>
    \begin{eqnarray}
    \nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\
    \nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\
    \end{eqnarray}
            </td>
            <td>
    \begin{eqnarray}
    \nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\
    \nabla \cdot \vec{\mathbf{B}} & = 0
    \end{eqnarray}
            </td>
        </tr>
    </table>
    

    Markdown cells are rendered so you don't see the code that generates the rendered latex. Instead you just see the rendered version until you double click it. Plus you have the option of Markdown tables

    0 讨论(0)
提交回复
热议问题