# Support for automatic equation numbering and labeling of equations

Mathjax supports automatic equation numbering:
http://cdn.mathjax.org/mathjax/latest/test/sample-eqnum.html

And equation references:
http://cdn.mathjax.org/mathjax/latest/test/sample-eqrefs.html

The extra code to support this seems to be something like:

<script type="text/x-mathjax-config;executed=true">
MathJax.Hub.Config({ TeX: { equationNumbers: {autoNumber: "AMS"} } });
</script>


Would this be an useful feature at MSE ?

• Are you suggesting to number/label all equations so that? Would it be an option to turn this off if one doesn't want the equations numbered? – Thomas Oct 4 '13 at 22:53
• @Thomas: This seems to be about allowing for both starred and un-starred versions of many LaTeX environments (e.g., \gather for automatically numbered equations, and \gather* for unnumbered). Currently math.SE only supports unnumbered equations (augmented by \tag{}). The unfortunate bit is that we use un-starred names for these unnumbered environments, meaning that implementing this feature would also require that all posts be (automatically, hopefully) processed to change each \gather to \gather*, and similarly for the other environments. – user642796 Oct 5 '13 at 5:40
• I think using \tag as needed is a better solution than something that requires updating a lot of posts. – Lord_Farin Oct 5 '13 at 8:29
• Didnt think about the old posts... Hmm lord farin is probably right – Kasper Oct 5 '13 at 8:50
• @Lord_Farin: The old MO used an old version of MathJax which would occasionally (often?) require the doubling of backslashes (so $\{ x \in X \cdots$ would be typed \\{ x \in X \cdots) and it was not always obvious when this would be required. When they switched over to the SE 2.0 network no-one manually went through and updated all of these codes; the conversion was automated as much as possible. If we request this feature we would also have to request scripts to be written/run that would "fix" all of our present posts. I don't believe that this is a reason to vote against this proposal. – user642796 Oct 5 '13 at 10:33
• Perhaps the most troubling bit would be that math.SE would have to go down for some period of time while all of this is updated. Then again, this might be a good thing. – user642796 Oct 5 '13 at 10:35
• @Arthur That takes some of the worries away. Nonetheless, I still consider this (more or less) a solution looking for a problem that it fixes. In the MO case, the advantage was clear: SE1.0 wasn't maintained and had some serious issues. Not so for this one. – Lord_Farin Oct 5 '13 at 10:57
• @Lord_Farin I think the main benefit of this would be that it works the same way as latex works. – Kasper Oct 5 '13 at 11:52
• @ArthurFischer: Ok, that is what I thought, but I wasn't sure. So how would the $$...$$ work with this? – Thomas Oct 5 '13 at 13:21
• @Thomas It is explained here: docs.mathjax.org/en/latest/… – Kasper Oct 5 '13 at 13:39
• @Kasper: That is a long document and I couldn't quickly find an answer. My specific question is: if we turn on this automatic labeling, will stuff between $$...$$ automatically be labeled? – Thomas Oct 5 '13 at 21:51
• @Thomas "Equations can be numbered in two ways: either number the AMSmath environments as LaTeX would, or number all displayed equations (the example above uses AMS-style numbering)." Using the setting: equationNumbers: {autoNumber: "AMS"} you get the exact same result as latex. So $$...$$ won't be automatically numbered. – Kasper Oct 5 '13 at 21:59

I'd also like to see this implemented, though it should only be activated on posts that will have been edited since in order to avoid suddenly having labels on everything put in unstarred environments like align and equation. As Arthur suggested similar to the now fixed \\ escaping issue this could probably be automated in an easy way by appending a star to all the relevant environments.
As a sidenote, it is possible to tag/label/(eq)ref equations (see source), although the preview of blocks containing \labels will be broken...