From Code to Community: Sponsoring The Perl and Raku Conference 2025 Learn more

\documentclass{article}
\usepackage{comment}
\includecomment{Included}
\excludecomment{Excluded}
\specialcomment{BoldSpecial}{[\begingroup\bf}{\endgroup]}
\begin{document}
Before Comment.
\begin{comment}
Inside Comment.
\end{comment}
After Comment.
Before Included.
\begin{Included}
Inside Included.
\end{Included}
After Included.
Before Excluded.
\begin{Excluded}
Inside Excluded.
\end{Excluded}
After Excluded.
Before Included 2.
[before] \begin{Included} [ignored]
Inside Included.
% [not allowed] \end{Included}
\end{Included}
% \end{Included} [not allowed]
After Included.
Before Excluded 2.
[before] \begin{Excluded} [ignored]
Inside Excluded.
% [not allowed]\end{Excluded}
\end{Excluded}
% \end{Excluded} [not allowed]
After Excluded.
\def\fakebegin{[hidden but kept] \begin{Included} [hidden and ignored]}
Before Included 3.
[before] \fakebegin [ignored]
Inside Included.
% [not allowed] \end{Included}
\end{Included}
% \end{Included} [not allowed]
After Included.
Before BoldSpecial.
\begin{BoldSpecial}
Inside BoldSpecial.
\end{BoldSpecial}
After BoldSpecial.
Before Included.
\begin{Included}
\bf Bold Inside Included.
\end{Included}
After Included, but still Bold.
\end{document}
% Following doesn't even work in LaTeX ??
Before Comment
\comment
Inside Comment
\endcomment
After Comment
Before Included
\Included
Inside Included
\endIncluded
After Included
Before Excluded
\Excluded
Inside Excluded
\endExcluded
After Excluded