LaTeX multiline comments

I often have a need to create LaTeX comments that span multiple lines. 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, once 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 LaTex 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.

Comments

Permalink

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

Permalink

Thanks a ton for the help :-)

Permalink

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

Permalink

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