JupyterBook Demonstration#
This document demonstrates some of the features provided by the documentation. It can serve as a starting point for your own documentation.
This documentation is formatted using an extension to Markdown called MyST which allows full interoperability with Sphinx, the system used to build the documentation. Here we demonstrate some features. For more details, please see:
Math#
You can use LaTeX math with [MathJaX][].
Example#
Here we implement a simple example of a pendulum of mass \(m\) hanging down distance \(r\) from a pivot point in a gravitational field \(g>0\) with coordinate \(\theta\) so that the mass is at \((x, z) = (r\sin\theta, -r\cos\theta)\) and \(\theta=0\) is the downward equilibrium position:
Note
On [CoCalc][], only a subset of the math will render in the live Markdown editor. This
uses KaTeX, which is much faster than [MathJaX][], but more limited. The final
documentation will use [MathJaX][], and loads the macros defined in
Docs/_static/math_defs.tex.
SI Units#
In LaTeX, I like to use the siunitx package. This is not currently supported in
MathJax (they could not get funding),
but can be mocked up with some defines.
The idea is that we use the macros for HTML, but substitute the appropriate
\usepackage{siunitx} in the LaTeX files. (This second step is currently not implemented)
Jupyter Notebooks#
This document is actually a Jupyter notebook, synchronized with Jupytext. The top of the document contains information about the kernel that should be used etc. These are parsed using MyST-NB and the output of cells will be displayed. For example, here is a plot demonstrating Liouville’s Theorem.
Details
We start a code-block with:
```{code-cell}
:tags: [hide-input, full-width]
...
```
This indicates that it is a code cell, to be run with python 3, and has some tags to make the cell and output full width, but hiding the code. (There is a link to click to show the code.)
If you need more control, you can glue the output to a variable, then load it as a proper figure, insert it in a table, etc.
Manim#
We provide experimental support for Manim Community – the community edition of the animation software used by the 3Blue1Brown project. Here we demonstrate an animation of the Jacobi elliptic functions.
UsageError: Cell magic `%%manim` not found.
Warning
We need a Manim >= 0.15.0 to get this to work, resolving issue 2441 by embeding the video in the output.