From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/plain/contrib/misc/comment.tex | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 macros/plain/contrib/misc/comment.tex (limited to 'macros/plain/contrib/misc/comment.tex') diff --git a/macros/plain/contrib/misc/comment.tex b/macros/plain/contrib/misc/comment.tex new file mode 100644 index 0000000000..e8606bfad2 --- /dev/null +++ b/macros/plain/contrib/misc/comment.tex @@ -0,0 +1,42 @@ +% 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 -- cgit v1.2.3