Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
2  
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

1 Answer 1

up vote 3 down vote accepted

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}
share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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