Equation numbering in Jupyter notebooks

前端 未结 3 1499
北海茫月
北海茫月 2020-12-28 13:59

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

Equation numbering and referencing will be available in a future vers

相关标签:
3条回答
  • 2020-12-28 14:14

    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 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
    
    0 讨论(0)
  • 2020-12-28 14:22

    Here is a working example, to be entered in a markdown cell:

    \begin{equation*}
    \mathbf{r} \equiv \begin{bmatrix}
    y \\
    \theta
    \end{bmatrix}
    \label{eq:vector_ray} \tag{1}
    \end{equation*}
    
    Vector **r** is defined by equation $\eqref{eq:vector_ray}$
    

    It's self explanatory but here's some details:

    \label : name describing he equation

    \tag : the label appearing next to the equationcan be a number or letters

    \eqref : reference to the labeled equation

    This will be shown as:

    0 讨论(0)
  • 2020-12-28 14:32

    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. You will see that a button appears on the top of your notebook for resetting the numbering of equations. You will need to press that button every now and then.

    0 讨论(0)
提交回复
热议问题