Unhelpful, misleading errors in amsmath environments

Simple answer: no. The align environment works very differently from equation: all of the material has to be read before any typesetting. (In that sense, it's similar to the beamer class frame environment, which people also ask similar questions about.) The material to be aligned has to be read before it is typeset to allow measurement, so it's not an option to simply 'drop' this.


The undefined command is, in both cases, the the last token on the line after the error message, which is the documented behaviour here.

Thus the issue is not with TeX or the amsmath package but with the parsing of the log file by Kile which appears to be in error given your description. Perhaps you should raise a bug report with the editor.

Note that the line number has to be that of \end{align} rather than the line that contains the undefined command as the latter is not available. You see the same behaviour if you go

  \def\mycommand{..... \foo .....}

There is no error at that point but if \mycommand is used then you will get an undefined command \foo error message, showing the line number where \mycommand was used not where \foo is used in its definition.