Automatic numbering equation using Jupyterlab 4/Mathjax 3

I’ve tried all old suggestions and required installation that I could find even Copilot instruction… but could not succeed with numbering (automatically /tag{} is working) my equations.

In the Markdown box I’ve tried:

"```{math}
:label: eq_1
w_{t+1} = (1 + r_{t+1}) s(w_t) + y_{t+1}

and

"
\begin{equation}
\label{eq:Ein}
E=MC^2
\end{equation}$$
"

I'm using:
python                    3.12.8
pylatex                   1.4.2
jupyterlab                4.3.5            
jupyterlab-latex          4.3.0              
jupyterlab_pygments       0.3.0             
jupyterlab_server         2.27.3            
jupyterlab_widgets        3.0.13            
jupyter-notebook-lab-extension 7.3.2
jupyter-widgets-jupyterlab-manager 5.0.13
jupyterlab-latex 4.3.0
jupyterlab-pygments  0.3.0
Thanks

Are you sure it is the Python version and not Jupyter version involved?

(Plus could you please fix formatting in what you posted if possible? I wasn’t able to try them because cannot paste. Or sort out what exactly to paste. You could link to a gist of the notebook maybe if it is the discourse forum that is messing things up because of all the symbols it needs to escape?)


I need more time to investigate as I feel I am missing something basic, but here are some preliminary notes:

I was not seeing solutions work that I thought had worked before but I wasn’t using Python 3.12. I was starting from here and using the ‘launch binder’ badge that says Python 3.10 in Jupyter Notebook 7.2.

The examples I got from Maths Overview — Subject Matter Authoring Using Jupyter Notebooks where it says “Typesetting Equations demonstration notebook for further examples” don’t seem to work. ( I note those parallel the example in the documentation here and that despite having the same code, the new rendering displayed there at present doesn’t show equation numbering.)

What I found though that works sort of is from here. But I think I had to hardcode in numbering? Maybe?

This seemed to work:

Markdown cell #1:

This equation renders with number 1 numbering on side:

\begin{equation*}
\mathbf{r} \equiv \begin{bmatrix}
y \\
\theta
\end{bmatrix}
\label{eq:vector_ray} \tag{1}
\end{equation*}

More text

Markdown cell #2:

This equation renders with number 2 numbering on side:

\begin{equation}
\mathbf{r} \equiv \begin{bmatrix}
y \\
\theta
\end{bmatrix}
\label{eq:vector_ray2} \tag{2}
\end{equation}

More text

Markdown cell #3:

This equation renders with number 3 numbering on side:

\begin{equation}
    a = b + c \label{eq:some_eq3} \tag{3}
\end{equation}

More text

I know JupyterBook and Myst tackle this differently.

Thanks,

  1. I’m not sure what cause the problem. I happens in both Jupiter notebook and lab… I’ve never try Jupiter book/
  2. There is automatic formatting in this form which change the appearance for what I’m typing.
  3. I know the \tag{} option and it works (It is not automatic, and I have a very long document). but both \label{} and ref doesn’t work for me.

You may want to see the research someone else has done here.

Thanks for the pointer. Unfortunately, as of today the outcome is negative: what I tried doesn’t work. I also posted a status update in the original (opened 2018) Jupyterlab issue Numbering and Cross-referencing equations in Markdown doesn't work. · Issue #4039 · jupyterlab/jupyterlab · GitHub. Perhaps some useful feedback will come out of this thread.

@shayrap, thanks for bringing the topic to the Jupyter forum. Could you please update the title of the thread (if it’s possible to do) to “Automatic numbering equation using Jupyterlab 4/Mathjax 3” because, like @fomightez, I believe these infos are more relevant than Python version 3.12.

1 Like

I edited the title as suggested.

1 Like