10
$\begingroup$

I can write a math equation as below: \begin{equation} \begin{cases} 2x+y-3=0 .... (1) \\ 3x-5y+7=0 .... (2) \end{cases} \end{equation}

In this example, the equation number is added manually, is it possible to generate automatically? then if I have multiple equations, it can be numbered automatically.

$\endgroup$

migrated from math.stackexchange.com Aug 6 '17 at 7:43

This question came from our site for people studying math at any level and professionals in related fields.

  • 1
    $\begingroup$ Use $$2x+y-3 \tag {1} $$ $\endgroup$ – hamam_Abdallah Aug 5 '17 at 22:02
  • 1
    $\begingroup$ If you're asking how to auto-number here, on Math.SE using MathJax, then (I think) the answer is: you can't. However, in a true $\TeX$ word processor (TeXShop, etc), you would get numbering for free. (By the way, as @Salahamam_Fatima notes, you should use \tag{} for your equation numbers, as in \tag{1}, \tag{2}, etc. The parenthesized numbers will appear aligned at the far right; no need for separating dots.) $\endgroup$ – Blue Aug 5 '17 at 22:08
  • $\begingroup$ @Salahamam_Fatima \tag sounds like tag the whole equation array as one number, if I add it to two equation one by one, it will report "multiple tag" error. $\endgroup$ – lucky1928 Aug 5 '17 at 22:09
  • 2
    $\begingroup$ @lucky1928: It seems a little hacky, but you can get tag to work inside of cases, if you wrap the equations in an additional align. For instance, $$\begin{cases} \begin{align}2x+\phantom{5}y-3&=0\tag{1}\\ 3x-5y+7&=0 \tag{2}\end{align}\end{cases}$$ yields $$\begin{cases} \begin{align} 2x+\phantom{5}y-3&=0\tag{1} \\ 3x-5y+7&=0 \tag{2} \end{align} \end{cases}$$ (But now, the brace is a bit too far to the left. Hmmm ...) $\endgroup$ – Blue Aug 5 '17 at 22:14
  • $\begingroup$ In LaTeX (as opposed to MathJax, which is what is used here) there are control sequences that will cause these to be generated by the software. That way if you have $50$ of them and you want to insert another after the $20\text{th}$ one, you don't have to manually re-number the ones that come after that. But sometimes you have to run LaTeX twice on the same file to get this result. That's because the first time it runs, it stores information in an auxiliary file and then uses that the second time it runs. $\endgroup$ – Michael Hardy Aug 5 '17 at 23:26
  • 4
    $\begingroup$ It appears that the MathJax folks added an autonumber feature in v.2.0. See the new features write-up here, and scroll down to the section on Automatic Equation Numbering (about 15% down the page). They note that the feature is turned off by default. $\endgroup$ – hardmath Aug 6 '17 at 19:25
  • 2
    $\begingroup$ @hardmath: if this is turned on for this site then will the numbering be for entire page or for each post on a page (this is what we need)? Perhaps this can be experimentally tested by moderators. $\endgroup$ – Paramanand Singh Aug 7 '17 at 7:50
  • $\begingroup$ Not a direct answer, but a note on semantics of displayed math: A brace signifies a single logical equation that happens to consist of two or more equations. Either the brace should get one single number, or--if each equation deserves its own number--the brace should go. ;) (Separately, I myself would lean against auto-numbering in web content, because cutting-and-pasting MathJaX source might break cross references. That, however, is more a matter of opinion than the issue with braces and multiple numbers.) $\endgroup$ – Andrew D. Hwang Aug 13 '17 at 1:47
2
$\begingroup$

In LaTeX (as opposed to MathJax, which is what is used here) there are control sequences that will cause these to be generated by the software. That way if you have $50$ of them and you want to insert another after the $20\text{th}$ one, you don't have to manually re-number the ones that come after that. But sometimes you have to run LaTeX twice on the same file to get this result. That's because the first time it runs, it stores information in an auxiliary file and then uses that the second time it runs.

$\endgroup$
  • $\begingroup$ I think TeXworks gives one the option to delete auxiliary files. I think also one can do that through the operating system without causing any problems for TeXworks. Of course that doesn't help Mr. Lucky here. $\endgroup$ – Mr. Brooks Aug 8 '17 at 22:33
  • $\begingroup$ @Mr.Brooks : The relevance of your comment escapes me. What would be done differently if an auxiliary file were deleted, in a way that is relevant to what we're talking about here? $\endgroup$ – Michael Hardy Aug 8 '17 at 23:23
  • $\begingroup$ It's relevant only because you mentioned LaTeX "as opposed to MathJax," Mr. Hardy. Otherwise I wouldn't even have thought about auxiliary files at all. $\endgroup$ – Mr. Brooks Aug 10 '17 at 21:48
  • $\begingroup$ @Mr.Brooks : Your comments relevance still escapes me. Is deleting the auxiliary file something that you would do for some purpose? What would that be? $\endgroup$ – Michael Hardy Aug 10 '17 at 23:38
  • $\begingroup$ After getting an error, if I fix the error in the source file but don't delete the aux files compilation might still fail. I thought I mentioned I brought this up only because you mentioned LaTeX. $\endgroup$ – Mr. Brooks Aug 14 '17 at 21:24
  • $\begingroup$ You did say that you brought up deletion of aux files only because I mentioned MathJax. But only in your most recent comment did you mention some reason for deleting the aux file. $\endgroup$ – Michael Hardy Aug 15 '17 at 3:52
  • $\begingroup$ Alright, I'm sorry for dragging us down this pointless and tiresome tangent. $\endgroup$ – Mr. Brooks Aug 15 '17 at 22:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .