11

How can I enable a single figure when in draft mode?

I am working on a large document (thesis) containing many figures. Some of these figures are large, resulting in long compile times. I can fix this by switching the document to draft mode.

However, when I am adding a figure, and associated discussion, I will generally want to see the figure in full, in place. Also, since I'm adding something new I'll often be re-compiling minor changes to see how it looks.

What I would like to do is to have the document set to draft mode (figures not being loaded) but have the "active" figure displayed until I'm finished with it. I don't know of any way to do this. is it possible?

  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – cfr Dec 21 '14 at 4:32
  • What I usually do is work on the figure in a separate document, using the standalone class, and then include it into the main document using the standalone package. – cfr Dec 21 '14 at 4:33
15

Just set draft=false for the picture you want to be shown anyway:

\documentclass[draft]{article}

\usepackage{graphicx}

\begin{document}

\includegraphics[width=50pt]{example-image-a}

\includegraphics[draft=false,width=50pt]{example-image-b}

\includegraphics[width=50pt]{example-image-c}

\end{document}

enter image description here

| improve this answer | |
  • Excellent!!, very natural. – skpblack Dec 21 '14 at 14:57
7

Create a macro \includegraphicsfinal (say) which will always be set in final mode, regardless of whether your document is set in final or draft mode:

enter image description here

\documentclass[draft]{article}

\usepackage{graphicx}

\makeatletter
\newcommand{\includegraphicsfinal}[2][]{{%
  \Gin@draftfalse% Turn draft mode off
  \includegraphics[#1]{#2}}% Include graphic
\makeatother

\begin{document}

\includegraphics[width=50pt]{example-image-a}

\includegraphicsfinal[width=50pt]{example-image-b}

\includegraphics[width=50pt]{example-image-c}

\end{document}

Note the grouping inside \includegraphicsfinal which provides a localized scope for the change to \ifGin@draft.

| improve this answer | |
0

You can use the package draftfigure to get the same result and modify the display of the switched off figure:

\documentclass{article}

\usepackage{graphicx}
\usepackage[allfiguresdraft]{draftfigure}
\begin{document}
\includegraphics[width=50pt]{example-image-a}

\includegraphics[draft=false,width=50pt]{example-image-b}

\setdf{content={This figure is switched off.}}
\includegraphics[width=50pt]{example-image-c}

\end{document}

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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