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.

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...

Add new comment

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

Anonymous format

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul type> <ol start type> <li> <pre>
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.