I have a big LaTeX file which I would like to compile so that certain environments like figure are not shown. To that end I wanted to make use of the renewenvironment command. But the facilities of this command are rather limited: essentially, one can only replace an environment by something which is logically also an environment. What would suffice for me, hence, is to introduce a 'dummy enviroment' - one which discards the argument. Is there any way to define it?

EDIT: I also need to eliminate the displaymath environment. This might be essential, because the argument of it is not going to be valid text on its own.

2 Answers 2


Try using something like:


For more details read the TeX FAQ on Conditional compilation.

  • +1. Use the comment package, Luke... Commented Sep 12, 2010 at 20:14
  • This seems to answer my question as I posed it, but, unfortunately, I am failing to apply this solution to resolve my original problem. In particular, I need to eliminate all the 'displaymath' environments, but neither '\renewenvironment{displaymath}{\comment\[}{\]\endcomment}' nor '\let\displaymath=\comment \let\enddisplaymath=\endcomment' work indeed. First one fails because \comment starts working right away before being substituted; the second one fails because the content of 'displaymath' is ill-formed unless put into math environment.
    – Sergey
    Commented Sep 12, 2010 at 23:27
  • \usepackage{comment} \renewenvironment{displaymath}{}{} \excludecomment{displaymath} Commented Sep 13, 2010 at 9:17
  • Ulrike, thanks for your very good answer. Hope you don't mind I made some small edits to improve it and make it a great answer. Commented Sep 13, 2010 at 17:27

The draft option with many document classes will leave blank spaces where your pictures should be. Otherwise using the ifdraft package and wrapping your figures in the following might be an option:

\ifdraft{}{FIGURE CODE}

This should cause the figures not to appear if your document class calls the draft option. (Or put something like FIGURE GOES HERE in the first set of curly braces to have that text appear in drafts.

You must log in to answer this question.

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