Question: I wish to typeset a document and only include occurrences of one specific environment for the output. 

One thing I tried was using the `comment` package and putting `\begin{comment}`just after `\begin{document}` and `\end{comment}` just before `\end{document}`. Then I redefined the environment I wanted to include to begin with `\end{comment}` and end with `\begin{comment}`. This way only this environment should be uncommented. It compiled fine but gave no page as output. 

Another option might be to use the `tagging` package, but as far as I understand this lets you exclude certain parts. I want to do the opposite, only include certain parts.

EDIT: The background is that I am working on a thesis in linguistics with a large number glossed and numbered examples (sentences with detailed morpheme-by-morpheme translations). There are around hundred of them in total spread around the text and they are all in an `example` environment from the `covington` package. I want to generate a document containing only the examples to proofread them extra carefully and to check them against the recordings they are transcribed from.

Answer: 
You can use `xcomment` package. Put the environment to be typeset inside the argument of `\xcomment` macro like:

```
\xcomment{enumerate}   %% only enumerate environment is typeset

```

Code:

```
\documentclass{article}
\usepackage{xcomment}
 \xcomment{enumerate}   %% only enumerate environment is typeset
\begin{document}
  \begin{enumerate}
    \item Enumerate item
  \end{enumerate}
  \begin{itemize}
    \item itemize item
  \end{itemize}
  \begin{figure}
    A figure
  \end{figure}
  \begin{table}
    A table
  \end{table}      
\end{document}

```

![enter image description here](https://i.stack.imgur.com/ee8HU.png)
If your document is not that big, you can selectively de-activate environments using the [`environ` package](http://ctan.org/pkg/environ):

```
\documentclass{article}
\usepackage{environ}

% environ: 2013/04/01 v0.3 and earlier
\makeatletter
\providecommand{\env@itemize@save@env}{}
\providecommand{\env@itemize@process}{}
\providecommand{\env@figure@save@env}{}
\providecommand{\env@figure@process}{}
\providecommand{\env@table@save@env}{}
\providecommand{\env@table@process}{}
\makeatother

\RenewEnviron{itemize}{}% De-activate itemize
\RenewEnviron{figure}[1][]{}% De-activate figure
\RenewEnviron{table}[1][]{}% De-activate table

\begin{document}

\begin{enumerate}
  \item Enumerate item
\end{enumerate}

\begin{itemize}
  \item itemize item
\end{itemize}

\begin{figure}
  A figure
\end{figure}

\begin{table}
  A table
\end{table}

\end{document}

```