Take the 2-minute tour ×
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.

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.

share|improve this question
add comment

2 Answers

up vote 8 down vote accepted

Try using something like:

\usepackage{comment}
\renewenvironment{displaymath}{}{}
\excludecomment{displaymath}

For more details read the TeX FAQ on Conditional compilation.

share|improve this answer
    
+1. Use the comment package, Luke... –  Brent.Longborough Sep 12 '10 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 Sep 12 '10 at 23:27
    
\usepackage{comment} \renewenvironment{displaymath}{}{} \excludecomment{displaymath} –  Ulrike Fischer Sep 13 '10 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. –  Juan A. Navarro Sep 13 '10 at 17:27
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

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.