TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

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

I want to prevent the content of a custom environment from being shown. I've tried:

  %some stuff happens here

but this doesn't work.

share|improve this question
up vote 8 down vote accepted

Instead of \begin{comment} and \end{comment}, use \comment and \endcomment. The reason for this is that the \comment command proceeds by searching the text for the beginning of \end{<envname>}, where <envname> is the name of the environment it was called from.

This allows you to call comments from your own environments: \comment will see the end of your environment and know that the extent of the commenting has come to an end. With the code you gave, it would be looking for \end{comment}, never find it since it will never expand \end{asdf}, and continue forever.

(Oddly, this means that you must comment within a LaTeX environment: the pair of commands \comment/\endcomment, written directly into your document, will not work, unlike every other environment! But verbatim text, of which commenting is an example, is very odd all around.)

share|improve this answer
This produces an error: ! File ended while scanning use of \next. <inserted text> \par l.50 \end{frame} – Chris Dec 6 '10 at 12:27
Found it: I was using \usepackage{comment} instead of \usepackage{verbatim}. Thanks for your help! – Chris Dec 6 '10 at 12:29

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.