42

I'm working on a research paper with many figures in it. To save paper, I would like to exclude the figures when I print drafts of the paper. Is there an easy way to do this (via command-line option, graphicx option, or something else)?

1

3 Answers 3

40

I would simply use the endfloat package, which places all floats (figures and tables) at the very end of the document. Then you can print only the leading pages with the text using the page range selection of your PDF viewer.

Alternatively, you can make LaTeX ignore all figure environments using the comment package:

\usepackage{comment}
\excludecomment{figure}
\let\endfigure\relax

See How to exclude text portions by simply setting a variable or option? for more details. A drawback here is that the label references won't work properly.

2
  • 6
    This gave me an issue Extra }, or forgotten \endgroup which can be fixed by adding an extra line: \let\endfigure\relax as stated here: tex.stackexchange.com/questions/29060/…
    – Gabriel
    Commented Aug 19, 2014 at 15:30
  • 1
    Even though it's mentioned explicitly in the user guide of the comment package, it's worth repeating here: the \excludecomment{figure} method requires all \end{figure} directives to be on lines by themselves; nothing before \end{figure} on those lines, and nothing after \end{figure} either.
    – Mico
    Commented Jun 22, 2018 at 11:49
28

Just add the draft option when you load your document class, e.g.:

\documentclass[draft]{article}

You can also add the option to the graphicx package:

\usepackage[draft]{graphicx}

If you want to save space, you can do as follows:

\renewcommand{\includegraphics}{\relax}

Or if you want to use the ifdraft package, you can do thus:

\documentclass[draft]{article}
\usepackage{ifdraft}
\ifdraft{\renewcommand{\includegraphics}{\relax}}{\relax}
2
  • 1
    This option makes graphicx not include the images but prints frames with the same size so it doesn’t save space/paper but ink …
    – Tobi
    Commented Apr 5, 2012 at 18:21
  • 8
    Note that your redefinition let things like [scale=1]{file} stay in the text. Better use \renewcommand{\includegraphics}[2][]{} to gobble the arguments. The \relax is not necessary in this case, I guess.
    – Tobi
    Commented Apr 5, 2012 at 18:27
18

While the draft option replaces all graphics by frames with the same size, you may like to redefine \includegraphics so that it prints only the file name in an \fbox to save space/paper:

\documentclass{article}

\usepackage[demo]{graphicx}
\usepackage{lipsum}

\renewcommand{\includegraphics}[2][]{%
    \fbox{#2}% print file name in a small box
}

\begin{document}
\lipsum[1]
\begin{figure}
    \includegraphics[width=2cm,height=3cm]{imagefile}
    \caption{Caption text}
\end{figure}
\lipsum[2]
\end{document}

Notes

  • To suppress the file name box, too, replace the redefinition with \renewcommand{\includegraphics}[2][]{}.

  • The option demo lets graphicx print black boxes instead of searching the file to include it. It has nothing to do with your question but is useful for the demonstration ;-)

  • The package lipsum provides blind text and doesn’t belong to the solution.

2
  • Cool solution. But if you redefine \includegraphics you don't need to the demo option, I think.
    – NVaughan
    Commented Apr 5, 2012 at 18:29
  • @NicolasVaughan: Sure but if one comments out the redefinition to see the difference it’s useful :-)
    – Tobi
    Commented Apr 5, 2012 at 18:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .