Math Rendering Example

When using thebe you may need to load other assets onto the page in order for certain jupyter outputs to display as expected. thebe loads css and other assets for core @jupyterlab and ipywidgets modules, but leaves the rest to the consumer.

In this case, we're using Mathjax as a latex typesetter, so we need to preload that on our page (view html source for details).

To use this demo you to to have a jupyter server available and able to receive connections from localhost. To start a local server, use the following command:

jupyter lab --NotebookApp.token= --NotebookApp.allow_origin='*' --no-browser

maths with ipython display

from IPython.display import Math
Math(rf'\int_{{t=0}}^1 \frac{{1}}{{1+t^2}}\,\text{{d}}t = ')
    

maths with LaTeX magic

%%latex
\begin{align}
\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 \\
\nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\
\nabla \cdot \vec{\mathbf{B}} & = -42
\end{align}