Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Equation numbering in Jupyter notebooks

The fact is, that in official documentation Jupyter - motivating examples stands

Equation numbering and referencing will be available in a future version of the Jupyter notebook.

I know there is a lot of discussion about this topic. There are some people who claim to solve this issue with some workarounds.

But for ordinary user it is hard to understand the workarounds, or how dirty/useful the hacks really are.

So my questions are:

  1. what means the "available in future version"? Does it mean something like "new month/year" or something like "probably never because it is too impossible"?

  2. If any of the workarounds provided on the Internet safe for a human consumption? I mean is it worthy? Because it is possible to use Sphinx or something else for creation of tutorials, it will be more work, but it will be more work that implementing some hacks, installing plug-ins and so on?

Note: For somebody it could seems to be a question requiring opinion based answer, but I am pretty sure it is not. Any advice can help me (or others users) to make a good/bad decision.

like image 898
matousc Avatar asked Dec 20 '16 12:12

matousc


People also ask

How do you enumerate a formula in a Jupyter Notebook?

Go to your Jupyter Notebook editor (I am using Anaconda right now), Edit menu, the last item 'nbextensions config'. It opens a page where you can see a list of extensions, one of which is "Equation Auto Numbering". Enable it and restart your notebook.

What are the numbers in Jupyter Notebook?

Every code cell has a number, such as 1, or 2. The Notebook labels the cell with its number. The code that will be executed has the label In[ followed by the cell number, meaning Input. If there is a variable on its own at the end, that will generate an Output cell, labeled with Out[ followed by the cell number.

How do you add numbers in an equation in latex?

You have to wrap your equation in the equation environment if you want it to be numbered, use equation* (with an asterisk) otherwise. Inside the equation environment, use the split environment to split the equations into smaller pieces, these smaller pieces will be aligned accordingly.


Video Answer


1 Answers

I believe that essentially all information relevant to this question can be found in this long Github issue thread.

The conversation there has been ongoing for (at this moment) 3.5 6.5 8 years and is still active. Important highlights:

  • You can very simply turn on numbering by executing a cell with the following content:

    %%javascript MathJax.Hub.Config({     TeX: { equationNumbers: { autoNumber: "AMS" } } }); 
  • There is an extension for equation numbering.

  • Developer minrk has suggested that this extension is the right approach and could be merged into master (but the functionality would be turned off by default).

To install the extension via pip:

pip install jupyter_contrib_nbextensions 

To install the extensions via Anaconda:

conda install -c conda-forge jupyter_contrib_nbextensions  

After using one of the ways to install provided above, enable the extension:

jupyter contrib nbextension install --user jupyter nbextension enable equation-numbering/main 
like image 191
David Ketcheson Avatar answered Sep 20 '22 14:09

David Ketcheson