在Jupyter中显示带有乳胶盒魔术的乳胶表/表格 [英] Display latex table/tabular in Jupyter with latex cell magic

查看:69
本文介绍了在Jupyter中显示带有乳胶盒魔术的乳胶表/表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据此Rich Display System示例 Jupyter笔记本可以使用%%latex细胞魔术来显示乳胶.

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

使用align环境给出的示例在我的系统(Notebook Server 3.2.0-8b0eef4)上运行良好,但是当我尝试显示tabulartable时,结果就是很好地排版了Latex代码!

The example given using the align environment works fine on my system (Notebook Server 3.2.0-8b0eef4) but when I try and show a tabular or a table, the result is just nicely typesetting Latex code!

要完成这项工作,是否需要添加某种前言?

Is there some kind of preamble I need to add to make this work?

推荐答案

答案

Jupyter建立在MathJax之上,并引用" MathJax不实现表格形式".该链接还将建议的阵列环境显示为表格替换.

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

解决方法:

Latex也可以用于Markdown单元格(Celltype Markdown而不是Code).您可以选择单元格旁边的左侧区域,然后按"m"键或通过顶部菜单中的单元格">单元格类型".然后,您可以在表格中使用html.

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单元被渲染,因此您看不到生成渲染乳胶的代码.取而代之的是您只看到渲染的版本,直到您双击它. 另外,您还可以选择 Markdown表

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

这篇关于在Jupyter中显示带有乳胶盒魔术的乳胶表/表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆