According to this Rich Display System example the Jupyter notebook can display latex using the %%latex
cell magic.
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?
The Jupyter Notebook uses MathJax to render LaTeX inside HTML / Markdown. Just put your LaTeX math inside $ $ . Or enter in display math mode by writing between $$ $$ .
%%writefile lets you output code developed in a Notebook to a Python module. The sys library connects a Python program to the system it is running on. The list sys. argv contains the command-line arguments that a program was run with.
Jupyter Book uses MathJax for typesetting math in your HTML book build. This allows you to have LaTeX-style mathematics in your online content.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With