LaTeX multiline comments

I often have a need to create LaTeX comments that span multiple lines. Of course you can create single line comments in LaTeX using the percent character like this:

% this is a comment

But I want to be able to create LaTeX comments that go on for multiple lines. Fortunately, if you know that you're supposed to include the verbatim package, this is pretty easy.

LaTeX multiline comments example

The first step is to include the verbatim package, like this:

\usepackage{verbatim} 

Do that in the LaTeX document preamble. Then when you want to create a multiline comment, just do this:

\begin{comment}
This is my comment.
Note that it can span multiple lines.
This is very useful.
\end{comment}

That's all you need to do. Feel free to sprinkle your LaTeX documents with all the multiline comments you need now.

Thank you for the time saver

Thank you for the time saver and also because the page is listed on the first page of google search.

Helpful

Thanks a ton for the help :-)

Thanks for this short and

Thanks for this short and useful help!

Thanks! I'd expected

Thanks!
I'd expected something with the "%" sign, like %% or sth in the C-way, but it used to be the LaTeX-way :)

Thanks!

Exactly what I was looking for, thanks! Now if only there were a way to highlight it in the editor as a comment...

Post new comment

The content of this field is kept private and will not be shown publicly.