Wrong equation number when typesetting specific elements
Issue Summary
My usecase is that I want to typeset only some elements of a page, so for this I used the elements
configuration. The problem is that when I have multiple labeled equations defined with \begin{equation}
in one given html element, these are wrongly numbered. This is not happening if the given html element contains \begin{eqnarray}
with equations.
Steps to Reproduce:
- Configure mathjax using the configurations specified below
- Add 2
myMathjaxElement
elements in you page, one that has multiple\begin{equation}
equations, and one that has only one . An example:
<div class="myMathjaxElement">
\begin{equation}
\vec{F} = -F \hat{j} \label{eq1}
\end{equation}
\begin{equation}
\vec{F} = -F \hat{j} \label{eq2}
\end{equation}
\begin{equation}
\vec{F} = -F \hat{j} \label{eq3}
\end{equation}
</div>
<div class="myMathjaxElement">
\begin{equation}
\vec{F} = -F \hat{j} \label{eq4}
\end{equation}
</div>
- Observe the result
Expected result: equations are correctly numbered Actual result: equations are wrongly numbered, see image:
Adittional info: the same will happen if I am dynamically typesetting these myMathjaxElement
elements using typesetPromise
.
Also, as specified in the description, this is not happening if I use \begin{eqnarray}
to write my equations
Technical details:
- MathJax Version: 3.2.2
- Client OS: Fedora Linux 36 (Workstation Edition)
- Browser: Firefox 105.0.1
I am using the following MathJax configuration:
MathJax = {
startup: {
elements: document.getElementsByClassName("myMathjaxElement"),
},
tex: {
tags: 'ams'
}
};
and loading MathJax via
<script async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
An HTML file to reproduce the problem:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Testing MathJax v3 Equation Numbering</title>
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script>
MathJax = {
startup: {
elements: document.getElementsByClassName("myMathjaxElement"),
},
tex: {
tags: 'ams'
}
};
</script>
<script async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
</head>
<body>
<h1>A test of Equation References</h1>
<div class="myMathjaxElement">
\begin{equation}
\vec{F} = -F \hat{j} \label{eq1}
\end{equation}
\begin{equation}
\vec{F} = -F \hat{j} \label{eq2}
\end{equation}
\begin{equation}
\vec{F} = -F \hat{j} \label{eq3}
\end{equation}
</div>
<div class="myMathjaxElement">
\begin{equation}
\vec{F} = -F \hat{j} \label{eq4}
\end{equation}
</div>
</body>
</html>