Is there any way to get nestable block comments in LaTeX? I am using the comment
package to get block comments, but nesting one comment inside another with \begin{comment}...\begin{comment}...\end{comment}...\end{comment}
doesn't seem to work. (I get an error "\begin{document} ended by \end{comment}".)
When writing and revising papers, it would be useful to me to be able to comment out arbitrary blocks of text, even if they already have commented-out blocks within them.
I'm aware that there are editor-based solutions. What I'm asking is if there is a way to do this within the source of my LaTeX document.
Best Answer
I suggest a wrapper command, that uses the block which should be commented as an argument and 'drops it into the trash bin'.
\newcommand{\mycomment}[1]{% }%
This works as long as the commented block follows correct
LaTeX
syntax, i.e. no unclosed right}
or something similar, however, in such cases, compilation will fail eventually without the comment anyway.