# “ File ended while scanning use of \next…” causes by the use of a multilines newcommand

Error while using the new command \reponse created in the preambule.

What is wrong with the definition of the newcommand ? It must be linked with comment package ...

Example that works seems the same : How to use \begin & \end in a new command

Thanks for help.

Error : File ended while scanning use of \next \end{answer} while using the commande \reponse

\documentclass{article}
\usepackage{comment}
\newcommand{\reponse}[1]{%

\begin{document}
% i would like to write :
\reponse{ok}
\reponse{ok}
% ...
%...

\end{document}

• You can't use “comment environments” as arguments to commands, just like you can't with verbatim: a comment environment is treated the same. – egreg Jan 24 '17 at 13:19

Like @egreg said, you can not use comment environment as arguments. The difficulty comes from a special condition given in the package documentation: The opening and closing commands should appear on a line of their own. No starting spaces, nothing after it.

But here is what I can suggest (The trick comes from section 2 Usage of the comment documentation):

\documentclass[english]{article}
\usepackage{comment}
\usepackage{babel}
\makeatletter
\newcommand{\reponse}[1]{\@bsphack\@esphack}
\makeatother

\begin{document}
% i would like to write :
\reponse{ok}
\reponse{ok}
% ...
