When using the alignat environment I encounter a strange equation numbering problem. It's rather hard to describe, but here is an MWE. I describe the output below.





1 & = 2 \\ \nonumber
1 & = 2 

This calls equation~\eqref{eqn1}.

2 & = 3 \\ \nonumber
2 & = 3

This calls equation~\eqref{eqn2}.

3 = 4

This calls equation~\eqref{eqn3}.


The output from that correctly numbers the equations. However, the first sentence reads "This calls equation (2)." The second reads "This calls equation (??)." The third correctly reads "This calls equation (3)."

The log notes the following when compiling:

LaTeX Warning: Reference `eqn2' on page 1 undefined on input line 25.

I checked the list of style file versions that are being accessed and they're all from the latest TeX distribution (which I updated a few weeks ago). In other words everything's coming from the main tex distribution tree: /usr/local/texlive/2012/texmf-dist/tex/latex/...

Even so, here's the file list from the log file:

 *File List*
  memoir.cls    2011/03/06 v3.6j configurable book, report, article document cl
   ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
  ifetex.sty    2011/12/15 v1.2 ifetex
 ifxetex.sty    2010/09/12 v0.6 Provides ifxetex conditional
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)
    etex.sty    1998/03/26 v2.0 eTeX basic definition package (PEB)
   mem10.clo    2008/01/30 v0.3 memoir class 10pt size option
mempatch.sty    2009/07/24 v6.0f Patches for memoir class v1.6180339
 amsmath.sty    2000/07/18 v2.13 AMS math features
 amstext.sty    2000/06/29 v2.01
  amsgen.sty    1999/11/30 v2.0
  amsbsy.sty    1999/11/29 v1.2d
  amsopn.sty    1999/12/14 v2.01 operator names

I'm running on Mac OS X 10.6.8 via TexShop. Any assistance would be greatly appreciated. (Note: I do not have the reputation points to create a new tag for alignat but it might be useful to have.)


You have to label the line where there's not \nonumber. As you're doing, you're labeling an equation without any number.

1 & = 2 
  \label{eqn1} \\
1 & = 2

In these environments each line (where \nonumber or \notag is missing) receives a number and can be labeled. I say "line" because in your case you have probably two equations per line (of output); the input is independent of it: the \label command should go before the \\ command.

|improve this answer|||||
  • One might add that not the line of input matters but whether it is before or after \\ one uses \label or \nonumber. – Qrrbrbirlbel Feb 8 '13 at 23:50
  • @Qrrbrbirlbel Right. – egreg Feb 8 '13 at 23:52
  • Hmm. But it would seem I am doing that. Or does the \nonumber need to go before the \\ ? And why would it label the first equation (albeit incorrectly) but not the second? – Ian Durham Feb 9 '13 at 1:00
  • Just answered my own question. Apparently \nonumber needs to go before the \\ . Thanks. – Ian Durham Feb 9 '13 at 1:02

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.