I usually use \[ ... \] to typeset equations in latex and sometimes I come back and realize that I want to have an equation number and label. I have been coming back and editing it to \begin{equation} ... \end{equation} but this is annoying and time consuming. Is there a command to do something like \[ \addeqnumber{} \] which will work the same way as the equation environment? I am aware this probably isn't the best practice, but it would save me some annoyance.



  1+1=2  \addtag


See also: How can I add numbers to specific equations in an eqnarray*?

| improve this answer | |

If you find yourself doing this for all equations I would use search & replace but if you’re reluctant you can do the following:


After that, \[ … \] will behave identical to \begin{equation} … \end{equation}.

You can also wrap this into a macro, and create another one to switch back so that you can switch between the two styles via two macros.

| improve this answer | |
  • This won't handle the numbering appropriately if the amsmath package is loaded. – Gonzalo Medina Apr 1 '11 at 13:52
  • @Gonzalo Hmm, weird. What’s the issue? – Konrad Rudolph Apr 1 '11 at 13:58
  • If you load amsmath and use your suggestion, all the equations written with \[...\] will receive the same numbering: (1). – Gonzalo Medina Apr 1 '11 at 14:06
  • this should use \begin etc., see the last few lines of amsmath.sty – Philipp Apr 1 '11 at 19:25
  • I'm using amsmath and this is working just fine... – Alec Jacobson Dec 2 '19 at 17:02

Not answering your question but maybe solving your problem: mathtools has a mechanism that suppresses equation numbers for unreferenced equations. (So you'd always use equation and friends and only get numbers if you ref the equation.)

| improve this answer | |

As you're aware that this isn't best practice, I don't mind answering! The following seems to work:


Use it as:

x^2 + y^2 = z^2

The start of \equation simply steps the counter, so we do that and don't have to worry about doing anything else at the begining. Then we assign the label (since there's no point in having one command to add the number and then another to assign a label to it). To place the label, we use the \endequation command. As we're doing this inside the mathematics, the assignment \let\]\endequation only holds until the end of the mathematics and so it doesn't affect future mathematics (which is a bit lucky for future mathematics).

| improve this answer | |
  • 1
    This doesn't work if amsmath is loaded. – Gonzalo Medina Apr 1 '11 at 13:18
  • 2
    And there's a typo in the definition of \addlabel: it should be \label{#1}, instead of \label{pythagoras}. – Gonzalo Medina Apr 1 '11 at 13:27
  • @Gonzalo: (amsmath) Probably not, but the question didn't specify a package and was clearly not looking for a "robust" solution so I didn't spend much effort on it. (pythagoras) Whoops! That was my test case. Still, Leo's looks simplest so I'll not bother sorting out the problems with mine! – Andrew Stacey Apr 1 '11 at 17:58

To build on Konrad's answer and make it work with amsmath, I'd use:

| improve this answer | |
  • This is the best answer. No need to type :"\addtag" – axsvl77 May 15 '18 at 7:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.