How to Comment Out Lines in LaTeX
The fix
To comment out a line in LaTeX, put a percent sign % at the start — everything after % on that line is ignored. To comment out a whole block, load \usepackage{comment} and wrap the block in \begin{comment} ... \end{comment}.
Example
% This whole line is a comment.
Visible text % trailing comment after code
\usepackage{comment}
% ...
\begin{comment}
These lines are all
ignored by LaTeX.
\end{comment}Frequently asked questions
How do I print a literal percent sign?
Escape it: write \% to show an actual % in the output, since a bare % starts a comment.
Is there a multi-line comment without a package?
You can use \iffalse ... \fi to skip a block, but the comment package (\begin{comment}...\end{comment}) is clearer and handles edge cases better.
Try the fix in LetX
Open the editor, paste your code, and compile in 1–2 seconds to see the error clear — free, in your browser.
Open LetX Free