I have a long LaTeX document and I am trying to comment out lines of text using \begin{comment} text \end{comment} and while compiling the document I have the interpreter giving out:

<recently read> \@savsf 
l.429 \end{comment}
? q

Prompting me to put some input, I know only press q. Now when I add new matching comment environments, the text does not get commented out but remains there.

Is it possible that I have unpaired tags, or that there are interleaved environments conflicting? And how can I find the problem and untangle it?

(UPDATE: the text I try to comment out had inside it commented sections. When these sections are removed by cutting them out the comment environment works. Using the package verbatim)

  • You can use backticks ` to mark your inline code as I did in my edit. A little known markup is enclosing keyboard strokes with <kbd> and </kbd>.
    – doncherry
    May 17, 2011 at 21:30
  • 1
    I don't have much advice except some quick googling suggests this error comes up when you are in vertical mode in the wrong place (e.g. the \end{comment}). But this is a case where trying to construct a minimal example may actually lead you directly to the problem, since the problem is almost certainly something mismatched. (i.e. first construct a copy of the file with only that comment block and see if the error persists. Then start commenting out parts of that using %. etc.)
    – kgr
    May 17, 2011 at 22:38

1 Answer 1


It's not clear which package you are using, nor the exact format of your code, but the comment package documentation says this:

The opening and closing commands should appear on a line of their own.

So your example should work if you code it like this:


I believe this is because the package actually scans the input file looking for \end{comment} in column 1...

  • 1
    indeed it does (look in column 1); we would really need the original code to provide coherent advice. note that \begin/\end{comment} won't work from within another command, either. May 18, 2011 at 22:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .