# How can I undefine an environment?

How can I undefine an environment?

This is how to undefine a command:

``````\newcommand\foo
\makeatletter
\let\foo\@undefined
\makeatother
``````

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

``````\usepackage{setspace}
\makeatletter
\let\beginspacing\@undefined
\let\endspacing\@undefined
\makeatother
``````
-

The macro `\newenvironment{foo}` defines the two macros

``````\foo
\endfoo
``````

not `\beginfoo`.

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

``````\renewenvironment{spacing}{}{}
``````

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

-