# 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...

I would like this. It's a 1-line add to the MathJax configuration script, and it has numerous advantages.

I see no reason why you would ever want to not number an equation: Maybe you're not referring to it later in your answer, but someone else might want to be able to say:

"In Eq. 4 of this SE answer..."

rather than having to say:

"In the second equation after Eq. 2 and the 4th equation before Eq. 3, for this SE answer, ..."

Simply: I see no reason not to do it.

• I don't quite see it this way. 1) All equations are not born equal. 2) If you refer to an equation from another answer on the site you might as well also copy/paste it (do give the source) for the convenience of your readers. 3) If you refer to equation number $n$ on a given answer, and that answer is edited in such a way that the numbering changes, you have created confusion. 4) I often "number" the two equations I want to refer to as $(*)$ and $(**)$. A forced numbering would introduce double numbering, and make the originally consistent post a mess. – Jyrki Lahtonen Jul 31 at 5:03
• I was thinking about when referring to an equation in conversation or somewhere else. It's extremeley bad practice to not label an equation, and I've never seen a publication that allows equations to be labelled () and (*) instead of (1) and (2). But if you want to do that in LaTeX or in the proposed MathJax configuration, you can. So I still see zero reason not to implement the AMS automatic equation numbering. – Nike Dattani Jul 31 at 10:47