Using the gathered environment causes my ide (TexStudio) to report an error

Error: Undefined control sequence. \begin{gathered}

even though I'm using the package mathtools (I also tried it with amsmath). Also the PDF comes out exactly as desired. But my ide keeps moving the view to the location of the error which is rather annoying.

A minimal example is



The error disappears if I replace mathtools with amsmath. But there are commands in mathtools that I need. And adding amsmath doesn't work. Also mathtools is supposed to load amsmath transitively.

The log file reports

! Undefined control sequence.
\\MT_gathered_env ...vir }}\fi \alignedspace@left 
                                                  \if #1t\vtop \else \if #1b...
l.6 \begin{gathered}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

At some point you have updated mathtools without updating amsmath. So a full fix would be to update amsmath using your miktex or texlive package manager however


will give the old behaviour.

You have not shown it but your log file would have had a warning from LaTeX that your amsmath was too old as mathtools specifies a requirement


and your amsmath must be older than 2016 or it would define this command.

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.