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 know how to use \renewenvironment to redefine an environment, but instead of changing formatting, I'd like to have any use of the environment generate an error (log and abort). Is there a way to do this?

share|improve this question
\renewenvironment{tabular}{\ABORT}{}, assuming of course that the environment `` is already defined (hence the renew, otherwise use new), and the macro \ABORT does not exit or aborts as you desire. – Peter Grill Mar 16 '12 at 22:12
up vote 8 down vote accepted
  {\GenericError{}{Mortal environment found}
  {I'm very unhappy, exiting}
  {What you did is highly disapproved}\endgroup\csname @@end\endcsname}

share|improve this answer

This is as simple as possible:

\def\yourenv{\GenericError{}{This is my error}{}{}}
share|improve this answer
This does not really define the environment (since you did not define \endyourenv, btu does generate an error as desired. – Peter Grill Mar 16 '12 at 22:15
the question is about re-defining, so \endyourenv should have been already defined before you do this modification. – yo' Mar 16 '12 at 22:16
Duh!!! Good point. I don't have even a good excuse like too much wine!! – Peter Grill Mar 16 '12 at 23:21

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.