TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:


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:


Which way to take therefor?

share|improve this question
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
up vote 6 down vote accepted

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.




% Also possible:

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


Normal text

    (A figure)
    \caption{A figure indeed}



share|improve this answer
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.

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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.