By Alvin Alexander. Last updated: April 6, 2024
LaTeX comments FAQ: How do I create comments in LaTeX, either single-line comments or multiline comments?
Solution
I often have a need to create LaTeX comments that span multiple lines. Note that 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.