From a079190bee4a273e87c7cf47dc178a69bf338fa7 Mon Sep 17 00:00:00 2001 From: Michele Mesiti Date: Wed, 1 Oct 2025 09:32:41 +0200 Subject: [PATCH] Sphinx Equation exercise merged with the one above Moved remark about older sphinx versions to an admonition --- content/sphinx.md | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/content/sphinx.md b/content/sphinx.md index 9ff9ca73..50cbfb39 100644 --- a/content/sphinx.md +++ b/content/sphinx.md @@ -308,20 +308,8 @@ int main() - We can also use Jupyter notebooks (*.ipynb) with Sphinx. It requires the [myst-nb](https://myst-nb.readthedocs.io/) extension to be installed. -````` - - -## Exercise: Sphinx and LaTeX - -`````{exercise} Sphinx-3: Rendering (LaTeX) math equations - -Math equations should work out of the box. In some older versions, you might need -to edit `conf.py` and add `sphinx.ext.mathjax`: -```python -extensions = ['myst_parser', 'sphinx.ext.mathjax'] -``` -Try this (result below): +- Math equations with LaTeX should work out of the box. Try this (result below): ````markdown This creates an equation: ```{math} @@ -337,6 +325,17 @@ a^2 + b^2 = c^2 ``` This is an in-line equation, {math}`a^2 + b^2 = c^2`, embedded in text. + + +````{admonition} Older versions of Sphinx +In some older versions, you might need +to edit `conf.py` and add `sphinx.ext.mathjax`: +```python +extensions = ['myst_parser', 'sphinx.ext.mathjax'] +``` +```` + + `````