# Hide all images, listings and equations?

is there any way to hide all images, equations and all listings (embedded by using lstlisting package) manually by setting a certain command in the preamble? It would just be interesting to see how many pages of real 'text' the document contains actually. Thanks!

Edit: I tried using Stefans suggestion:

\renewenvironment{lstlisting}{\begin{comment}}{\end{comment}}
\renewenvironment{figure}{\begin{comment}}{\end{comment}}
\renewenvironment{equation}{\begin{comment}}{\end{comment}}


whereas I have the verbatim-package in the preamble. I'm getting the same error message as if when using Martins suggestion:

File ended while scanning use of \next for a command line \include{main/02}


When not using the commenting-stuff, there's no error while compiling the document :(

Edit2: I found out that Martins solution works but not for equations which I insert via:



and than:

\beq
blaaa...
\eeq


Which way to take therefor?

-
Placing the comment environment into another environment doesn't work, like for any verbatim environment, because \begin{comment} then can't find it's \end{comment}. My small example works, but I can't say what's goes wrong with your file. You don't have an environment split over two input files, or something similar? –  Martin Scharrer Jun 28 '11 at 20:24

You can use the comment package to turn an environment, even an existing one, into a comment environment. It skips the content verbatim so it can also be used for lstlistings, etc. However, it seems the \end{<env>} (actually the internal \end<env>) is still executed, so you need to blank that too. For macros you need to define dummy replacements with the same set of arguments.

\documentclass{article}

\usepackage{comment}

\excludecomment{figure}
\let\endfigure\relax
\excludecomment{equation}
\let\endequation\relax
\excludecomment{lstlisting}
\let\endlstlisting\relax

% Also possible:
%\renewcommand{\includegraphics}[2][]{}
%\renewcommand{\lstinputlisting}[2][]{}

% For your funny equation marks use: (you then actually don't need to redefine equation itself)
\let\beq\iffalse
\let\eeq\fi
% or
% \def\beq#1\eeq{}

\begin{document}

Normal text

\begin{figure}
(A figure)
\caption{A figure indeed}
\end{figure}

$$1+1=2$$

\beq$$1+1=2$$\eeq

\end{document}

-
I edited my answer above Martin :) –  tim Jun 28 '11 at 20:25
@Marc: The \beq and \eeq macros also hide the equation end-macro. See my updated answer. –  Martin Scharrer Jun 28 '11 at 20:29
Thanks, it's working :) –  tim Jun 29 '11 at 10:17

You could redefine all those environments and commands to do nothing, using \renewenvironment. Of course this can be summarized in one macro.

-
How can I redefine the figure command to do nothing? Martin's answer doesn't work for me. –  LordStryker Mar 25 at 20:53