# comment package - \excludecomment{} gives error

I'm trying to generate a pdf file without the pictures for draft revision, and as seen here and here the \excludecomment{} is not working for me.

Here is my error:

line 31: Extra }, or forgotten \endgroup \end{wrapfigure}
line 31: Undefined control sequence \end{wrapfigure}
line 31: Missing number, treated as zero \end{wrapfigure}
line 31: Illegal unit of measure (pt inserted) \end{wrapfigure}


given by my test code:

\documentclass[letterpaper]{article}
\usepackage[hmargin=2.5cm,vmargin=3.0cm]{geometry}
\linespread{1.3}    % use 1.5 line spacing
\usepackage[pdftex]{graphicx}
\usepackage{wrapfig}    % puts the figure wrapped

\newif\ifshow
%\showtrue
\showfalse

\usepackage{comment}
%\excludecomment{itemize}
\ifshow
\includecomment{wrapfigure}
\else
\excludecomment{wrapfigure}
\fi
\excludecomment{wrapfigure}

\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc tempus convallis euismod. Vestibulum aliquet lacus at diam laoreet a scelerisque purus posuere.

\begin{wrapfigure}{r}{0.5\textwidth}
\begin{center}
\includegraphics[width=0.4\textwidth]{latex.png}
\end{center}
\caption{Caption}
\label{fig:00}
\end{wrapfigure}
\end{document}


Neither using the \removecomment{} or the if sentence works.

-
What about the [draft] option for the graphicx package? –  Corentin Oct 16 '12 at 19:57
..and Welcome to TeX.sx! –  Corentin Oct 16 '12 at 20:00
Thanks man! I've used your approach as is really easy to remove the pictures. –  gbc921 Oct 17 '12 at 2:54

## Package version

\documentclass[letterpaper]{article}
\usepackage[hmargin=2.5cm,vmargin=3.0cm]{geometry}
\linespread{1.3}    % use 1.5 line spacing
\usepackage[pdftex]{graphicx}
\usepackage{lipsum}
\usepackage{wrapfig}    % puts the figure wrapped

\newif\ifshow
%\showtrue
\showfalse

\usepackage{version}
\ifshow
\includeversion{wrapfigure}
\else
\excludeversion{wrapfigure}
\fi

\begin{document}
\lipsum[1]

\begin{wrapfigure}{r}{0.5\textwidth}
\begin{center}
\includegraphics[width=0.4\textwidth]{latex.png}
\end{center}
\caption{Caption}
\label{fig:00}
\end{wrapfigure}
\lipsum[2]
\end{document}


## Package comment

The environment is an outer shell with its contents is set or is not depending on \excludeversion or \includeversion. Also the environment markers have to be on a line of their own. \excludeversion and \includeversion do not work well with existing environments. \endwrapfigure causes the error messages. Thus an additional wrapper environment is needed:

\documentclass[letterpaper]{article}
\usepackage[hmargin=2.5cm,vmargin=3.0cm]{geometry}
\linespread{1.3}    % use 1.5 line spacing
\usepackage[pdftex]{graphicx}
\usepackage{lipsum}
\usepackage{wrapfig}    % puts the figure wrapped

\newif\ifshow
\showtrue
%\showfalse

\usepackage{comment}
\ifshow
\includecomment{wrap}
\else
\excludecomment{wrap}
\fi

\begin{document}
\lipsum[1]

\begin{wrap}
\begin{wrapfigure}{r}{0.5\textwidth}
\begin{center}
\includegraphics[width=0.4\textwidth]{latex.png}
\end{center}
\caption{Caption}
\label{fig:00}
\end{wrapfigure}
\end{wrap}
\lipsum[2]
\end{document}

-
Thanks for the answer! The both method worked perfectly! I will mark as solved, however I will follow the comment from @Coretin and use the [draft] (or [demo]) option from grapicx because is simpler, does the job of removing the picture (or the big size of the PDF) and I do not need to edit the code (at least for the comment package). (I should had searched with other terms on Google before getting lost on comment pkg. :D) –  gbc921 Oct 17 '12 at 2:51