Theorem environment

I am writing lecture notes for a course using jupyter. I can write math equations, but I can’t figure out how to use a theorem-proof environment. More specifically, I would like to write theorem statements (numbered), proofs, and cross-reference them in the jupyter notebook. Any help in this regard will be appreciated. I am new to jupyter.


@choldgraf and others from the JupyterBook team may have a better take than mine on this, but to first approximation, the support for LaTeX offered by Jupyter is based on MathJax, and that tool aims to only implement math-mode macros, not all of LaTeX (basically, whatever fits in between dollar signs).

Now, with JupyterBook, which goes through a separate rendering phase , you have a few more options. This issue may provide you with some extra pointers in that direction. But note that such formatting will not necessarily work in the live notebook and only after being processed by JupyterBook/Sphinx.

We’ve got a PR to get jupyterlab-latex up and running with JupyterLab 3. While it works directly with the .tex.pdf on the server, we could likely get sub-document links to work with the PDF, such that one could have

  • the-theorems.tex which (continuously) generated the-theorems.pdf
  • the-notebook.ipynb which could deep link to specific anchors in the PDF

Another direction we’ve yet to fully explore, but have discussed, is doing a novel plugin for jupyterlab-markup which would delegate math (or full-blown) LaTeX rendering to the server, emitting application/pdf or image/svg+xml outputs… though linking inside these would be trickier… but would have the advantage of a single, literate document doing nearly everything in the interactive/executable state… though getting “dead pixel” pdf of that monstrosity might be more challenging.

1 Like