8

When using the comment package, one can get a very strange error

Runaway argument?
! File ended while scanning use of \next.

when compiling a file that excludes some comments

\documentclass{scrartcl}
\usepackage{comment}
\excludecomment{enonce}

\begin{document}
 \begin{enonce}
  some text
 \end{enonce}
\end{document}
11

This is clearly stated in the package manual:

The opening and closing commands should appear on a line of their own. No starting spaces, nothing after it.

enter image description here

| improve this answer | |
  • Oh you are right ! I had been searching for ages in this -- but it was late. I will amend the Q/A ; should I remove it entirely ? Maybe it could still be useful to other as a pointer. – ysalmon Oct 13 '17 at 7:13
  • Thank you! I needed this! – TheEconomist May 21 at 6:06
1

The culprit is a peculiarity in comment (August 2016 version) that triggers when an excluded comment has its closing tag with space on the beginning of the line.

The following code compiles correctly

\documentclass{scrartcl}
\usepackage{comment}
\excludecomment{enonce}

\begin{document}
 \begin{enonce}
  some text
\end{enonce}
\end{document}

There is indeed a mention of this in the manual (Section 2 : No starting spaces, nothing after it.).

| improve this answer | |
  • 1
    No bug, but documented feature. – egreg Oct 13 '17 at 7:09
0

One cause of this error that I found was embedding a \begin{comment} and \end{comment} within conditional braces. Once I removed the comment commands, the error disappeared.

| improve this answer | |
  • Well, but how does it solve the issue here? OP wants to use comment, you removed it ... – Mensch Aug 5 '19 at 17:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.