Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I use \notag or \nonumber in align environment but there seems no any difference when display. What is the difference between these two commands?

share|improve this question

1 Answer 1

up vote 19 down vote accepted

Both are commands to switch off equation numbering. \nonumber is a kernel command, defined as:

\def\nonumber{\global\@eqnswfalse}

so you can use \nonumber without loading additional packages. \notag is defined in the amsmath package as \nonumber:

\newcommand{\notag}{\nonumber}

and then amsmath redefines \nonumber in the following way:

\renewcommand{\nonumber}{%
  \if@eqnsw
    \ifx\incr@eqnum\@empty \addtocounter{equation}\m@ne \fi
  \fi
  \let\print@eqnum\@empty \let\incr@eqnum\@empty
  \global\@eqnswfalse
}

which is a more safe version to use with amsmath. The definition of \notag will make \notag expand to the definition of \nonumber at the place of appearance, which is after \nonumber has been redefined. Hence (of course, when amsmath is used) the effect of both is the same.

Thanks to egreg and tohecz for their corrections.

share|improve this answer
3  
This is incorrect: \notag is just the same as amsmath's \nonumber, it is not the kernel \nonumber (notice that \notag expands \nonumber, which uses the current meaning, which is the new one). –  egreg Mar 22 '12 at 13:01
    
@egreg: perhaps I am reading an old online version of amsmath.sty? Or am I misreading it? Let me check. –  Gonzalo Medina Mar 22 '12 at 13:04
    
No, the version is correct. It doesn't matter whether \newcommand{\notag}{\nonumber} comes before or after the redefinition of \nonumber. When TeX finds \notag it replaces it with \nonumber and then expands this one to its current replacement text (which will be the new one). –  egreg Mar 22 '12 at 13:06
    
@GonzaloMedina \newcommand{\notag}{\nonumber} will make \notag expand to the definition of \nonumber at the place of appearance, which is after \nonumber has been re-defined. Hence the effect of both is the same, exactly as @egreg points out. –  tohecz Mar 22 '12 at 13:06
    
@egreg and tohecz: Ah, now I see; of course. I'll edit my answer. –  Gonzalo Medina Mar 22 '12 at 13:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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