% Style qui permet de ne pas écrire des parties du source et de fabriquer des
% environnements qui, selon le contexte, écrivent, ou n'écrivent pas, leur 
% contenu.

\makeatletter
{\gdef\@rcsl$#1: #2 #3 #4 #5${#4 (version #3)}%
  \gdef\@version{%
    \@rcsl$Id: noprint.sty,v 1.1 2004/10/26 11:26:47 deug Exp $}}

% Internal stuff: Portable macros
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{noprint}[\@version]
\typeout{noprint <titou@ufr-info-p6.jussieu.fr> -- \@version}

\newsavebox{\box@no@Print}
\newcount\no@non@Print
\no@non@Print=0

\def\noPrint{%
\begingroup
\ifnum\no@non@Print=\z@ % 
  \global\advance\no@non@Print by 1 \relax%
  \lrbox{\box@no@Print}\minipage{\linewidth}%
\else
  \global\advance\no@non@Print by 1 \relax%
\fi%
}
\def\endnoPrint{%
\global\advance\no@non@Print by -1 \relax%
\ifnum\no@non@Print=\z@ %
\endminipage\endlrbox%
\fi%
\endgroup
}

% Dynamically inhibate an environment.
% You just define the environment you want to hide with the
% \newxcomment macro. See example with htmlonly below. If you want
% to write an hidden environment, just use the predefined dontPrint
% environment.
\def\newxcomment#1{%
  \typeout{Excluding environment #1}%
  \expandafter\def\csname #1\endcsname{\noPrint}%
  \expandafter\def\csname end#1\endcsname{\endnoPrint}%
}
\makeatother

\endinput % end of noprint.sty
