Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • M MathJax
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 304
    • Issues 304
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 15
    • Merge requests 15
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • MathJax
  • MathJax
  • Issues
  • #2999
Closed
Open
Issue created Feb 15, 2023 by Oana-Lavinia Florean@oanalavinia

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:

  1. Configure mathjax using the configurations specified below
  2. 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>
  1. Observe the result

Expected result: equations are correctly numbered Actual result: equations are wrongly numbered, see image:

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>
Assignee
Assign to
Time tracking