How can I undefine an environment?

This is how to undefine a command:


I need to undefine the spacing environment from the setspace package. This does not seem to work:


2 Answers 2


The macro \newenvironment{foo} defines the two macros


not \beginfoo.

Rather than undefine spacing, you could simply make it a noop:


This is preferable because it will keep track of nested environments.

  • What is an environment needs to be undefined, because it was predefined but conflicts with some package? Is there a better way than going through \makeatletter?
    – Alexey
    Commented Jun 4, 2020 at 14:45
  • @Alexey Where do you get to undefine the environment?
    – egreg
    Commented Jun 4, 2020 at 15:01
  • In my own class i defined an environment, and then i loaded a package that defines an environment with the same name :). I do not want to change my class, usually it is fine.
    – Alexey
    Commented Jun 4, 2020 at 15:03
  • @Alexey It mostly depends on which of the two conflicting definitions you want to keep.
    – egreg
    Commented Jun 4, 2020 at 15:04
  • I wanted to keep the one coming from a package (not mine).
    – Alexey
    Commented Jun 4, 2020 at 21:22

Per this answer, use


to undefine the spacing environment. Note that \@undefined is not a special command, it simply is, itself, undefined.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .