[Tex/LaTex] How to avoid the “perhaps a missing \item.” message in itemize/enumerate

errorslists

If one has a itemize environment, with no items inside :

\begin{itemize}
\end{itemize}

the compilation will complain "perhaps a missing \item". I would like to modify the environment itemize (or enumerate) such that in case there is no \item, the compilation doest NOT fail, and simply display nothing.

EDIT
I think that by trying to extract a MWE from my actual problem, i missed the point. So, i reformulated the question here.

Best Answer

You can deactivate it as follows, though I'm not really sure why anyone would want to do this!

\documentclass{article}
\makeatletter
\let\@noitemerr\relax
\makeatother
\begin{document}
Some text.
\begin{itemize}
\end{itemize}
More text.
\end{document}

If you need to reactivate it later, you need to save the original definition.

\documentclass{article}
\makeatletter
\let\@oldnoitemerr\@noitemerr %Save the command definition                      
\newcommand\noitemerroroff{\let\@noitemerr\relax}
\newcommand\noitemerroron{\let\@noitemerr\@oldnoitemerr}
\makeatother
\begin{document}
Some text.
\noitemerroroff
\begin{itemize}
\end{itemize}
More text.
%                                                                               
\noitemerroron
\begin{itemize}
\end{itemize}
\end{document}