# Can I redefine \begin so that it does not complain about undefined environment

I'd like to be able to do the following kind of thing:

\documentclass{standalone}
\begin{document}
Foo
\begin{MyUndefinedEnv}
Bar
\end{MyUndefinedEnv}
\end{document}


without LaTeX complaining about undefined environment. Is it possible without breaking existing environments?

-
Of course, I can patch the definition of \begin to remove the \@latex@error (p.204 of source2e.pdf). As a \csname is invoked it should not be a problem if the control sequence is not defined. But I'd like to hear it is safe from gurus :). –  cjorssen Jan 10 '13 at 22:53
Why do you want to use undefined environments? Just curious... –  marczellm Jan 10 '13 at 22:56
@marczellm Coding environments is a lot more fun than writing a whole lecture about the phase plane. So every time I need a new environment, I spend time coding it rather than doing the right thing :). –  cjorssen Jan 10 '13 at 22:59
@cjorssen: Hmmm, I think you are missing the whole point of procrastinating.. :-) –  Peter Grill Jan 10 '13 at 23:02

Yes, you can:

\documentclass{article}

\makeatletter
\let\xbegin\begin % store original \begin
\let\xifundefined\@ifundefined % store original \@ifundefined
\def\begin{%
% "inactivate" \@ifundefined, but only once, hence reverting
% it to original definition immediately
\def\@ifundefined##1##2##3{\global\let\@ifundefined\xifundefined##3}%
\xbegin}
\makeatother

\begin{document}

\begin{ttgg}
Hello!
\end{ttgg}

\begin{center}
Hello!
\end{center}

\end{document}

-
Interesting, thanks. –  cjorssen Jan 10 '13 at 23:09