% Comment.tex % Macro to allow block comments in TeX % % Usage: Text between \begincomment and \endcomment is ignored; i.e. % % text % \begincomment % this text is ignored % \endcomment % more text % % Notes: Do NOT nest. % The \endcomment MUST appear at the end of a line. % TeX processes each line of ignored text, so the macro % is not particularly fast. Use sparingly. The main use % is to cause TeX to pass over small blocks of text. % % J.C. Alexander, May, 1986 % \edef\Saveatcatcode{\the\catcode`\@} \catcode`\@=11 \def\newcodes@{\edef\S@veslashcatcode{\the\catcode`\\} \edef\S@velbraccatcode{\the\catcode`\{} \edef\S@verbraccatcode{\the\catcode`\}} \edef\S@venumsgcatcode{\the\catcode`\#} \edef\S@veperctcatcode{\the\catcode`\%} \catcode`\\=12 \catcode`\{=12 \catcode`\}=12 \catcode`\#=12 \catcode`\%=12\relax} \def\oldcodes@{\catcode`\\=\S@veslashcatcode \catcode`\{=\S@velbraccatcode \catcode`\}=\S@verbraccatcode \catcode`\#=\S@venumsgcatcode \catcode`\%=\S@veperctcatcode \relax} \def\begincomment{\newcodes@\endlinechar=10 \comment@} {\lccode`\!=`\\ \lowercase{\gdef\comment@#1^^J{\comment@@#1!endcomment\comment@@@}% \gdef\comment@@#1!endcomment{\futurelet\next\comment@@@}% \gdef\comment@@@#1\comment@@@{\ifx\next\comment@@@\let \next=\comment@\else\def\next{\oldcodes@\endlinechar=`\^^M\relax}% \fi\next}}} \catcode`\@=\Saveatcatcode