MathJax icon indicating copy to clipboard operation
MathJax copied to clipboard

Referring to labels inside "split" or "aligned" environments seems broken

Open asmaier opened this issue 3 years ago • 3 comments

Issue Summary

It seems that referring to an equation which has it's label inside an aligned or split environment just generates (???)

Steps to Reproduce:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
  <meta charset="utf-8" />
  <title>Test</title>
  <script>MathJax = { tex: { tags: 'all' } }; </script>
  <script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml-full.js" type="text/javascript"></script>
</head>
<body>
Test equation has number <span class="math inline">\(\eqref{test}\)</span>. 
<span class="math display">\[\begin{aligned}E=mc^2 \label{test} \end{aligned}\]</span>
</body>
</html>

will render as Bildschirmfoto 2022-06-23 um 22 09 25

Moving the \label outside of the \aligned environment will generate the correct equation label

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
  <meta charset="utf-8" />
  <title>Test</title>
  <script>MathJax = { tex: { tags: 'all' } }; </script>
  <script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml-full.js" type="text/javascript"></script>
</head>
<body>
Test equation has number <span class="math inline">\(\eqref{test}\)</span>. 
<span class="math display">\[\begin{aligned}E=mc^2 \end{aligned} \label{test}\]</span>
</body>
</html>

will render as Bildschirmfoto 2022-06-23 um 22 10 02

The same happens when the \aligned environment is replaced by a \split environment.

Technical details:

  • MathJax Version: 3.2
  • Client OS: (e.g., Mac OS X 10.15.7)
  • Browser: (e.g., Chrome 102.0.5005.115)

asmaier avatar Jun 23 '22 20:06 asmaier

Thanks for the report. I will need to look into the issue.

dpvc avatar Jun 26 '22 21:06 dpvc