22

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!

Latex not working

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

LondonRob
  • 73,083
  • 37
  • 144
  • 201

1 Answers1

19

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 table two cells Latex Html mixed

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

CodingYourLife
  • 7,172
  • 5
  • 55
  • 69
  • 2
    Can I propose a change to this solution? The last part (in the update) is actually the answer I was looking for. The first part is a workaround, and could be included *after* the main solution. – LondonRob Mar 01 '17 at 13:32
  • 1
    Ok I changed title Update to Answer and moved it to top and rest as Workaround. – CodingYourLife Mar 01 '17 at 23:52