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.

Is there a command that I can use as a placeholder for \includegraphics? I want to use such a placeholder to add the original graphics later.

share|improve this question
    
You may create a dummy.jpg (or dummy.eps) and use this dummy graphic until you have your original one. –  knut Feb 11 '12 at 14:35
5  
See tex.stackexchange.com/a/30624/4427 for having the demo option not printing big blobs. –  egreg Feb 11 '12 at 15:15
    
@egreg: can you post that one as an answer to this one? I may accept that one. –  nimcap Feb 11 '12 at 15:38
add comment

7 Answers 7

I dont't like the demo option of the graphicx package, because one get some ugly black boxes in the document. And if you want to make a test print you waste a lot of ink and maybe your reviser is wondering about. So I created my own demo mode and just include an empty rectangle with the same size of the original picture. If I want to use the original pictures I comment the definition out and all the pictures will be inserted. For this it is necessary to use the picins package.

enter image description here

\documentclass{book}
\usepackage{picins}
\usepackage{graphicx}

\makeatletter
\def\Ginclude@graphics#1{%
    \parpic(\Gin@@ewidth,\Gin@@eheight)[d]{#1}\picskip{0}}%
\makeatother

\begin{document}
\begin{figure}
\centering
  \includegraphics[width=8cm,height=5cm]{myPictureName.png}%
  \caption{My Picture}
\end{figure}
\end{document}
share|improve this answer
1  
Where did you get picins? It doesn't seem to be a standard package. –  qubyte Feb 11 '12 at 14:20
4  
@MarkS.Everitt Used to be standard but was removed from TL, I think, for license reasons. –  Joseph Wright Feb 11 '12 at 14:24
2  
At ctan.org/pkg/picins you can see that picins is standard in MiKTeX (I use MiKTeX) but not in TeXLive. You should install it manually. –  Holle Feb 11 '12 at 14:25
1  
@Holle: Good to know. Could you put the link into the answer though? I think it's a good thing to have there for completeness. –  qubyte Feb 11 '12 at 14:50
1  
@Yiannis Please keep in mind that this approach was intended by the fact that there were no pictures to insert and that we don't want to use the demo mode of the graphicx package. So you don't know the size of the pictures. If you already have the pictures and you don't want to show them in the document you should use the draft option of you documentclass. –  Holle Feb 11 '12 at 18:12
show 2 more comments

Either load the graphicx package with the demo option or replace \includegraphics by, say, \rule{2cm}{2cm}.

share|improve this answer
8  
IIRC, \includegraphics[demo,width=<..>,height=<..>]{dummy} should work as well, i.e. demo used locally. –  Martin Scharrer Feb 11 '12 at 13:39
8  
@Martin: I get ! Package keyval Error: demo undefined. –  math Nov 5 '12 at 14:18
add comment

You can do without additional packages: just load graphicx with the demo option and do as explained in this answer; I repeat the code for completeness:

\usepackage[demo]{graphicx}

\makeatletter
  \AtBeginDocument{%
    \def\Ginclude@graphics#1{%
      \begingroup\fboxsep=-\fboxrule
      \fbox{\rule{\@ifundefined{Gin@@ewidth}{150pt}{\Gin@@ewidth}}{0pt}%
        \rule{0pt}{\@ifundefined{Gin@@eheight}{100pt}{\Gin@@eheight}}}\endgroup}}
\makeatother

Just remove the demo option and comment the additional code when you want to include the real graphic files.

This will produce framed rectangles with the specified width and height, but using a predefined dimension when width= and height= are not specified in the options to \includegraphics.

Another strategy is to load graphicx with the draft option, that will read the graphic files for getting their dimensions and print a framed rectangle with the file name in their place

\usepackage[draft]{graphicx}

As always, beware of file names with spaces: enclosing the name between double quotes should avoid problems.

share|improve this answer
add comment

todonotes provides the \missingfigure command, precisely designed for this case

\documentclass{article}
\usepackage{todonotes}

\begin{document}

\missingfigure[figwidth=6cm]{Testing a long text string}

\end{document}

Result of the above code

share|improve this answer
add comment
up vote 10 down vote accepted

If you need individual figures to be omitted rather than all of them, you first copy a dummy figure (called foo here) to your figures path, then use as:

\includegraphics[draft]{foo}

It will display something like:

enter image description here

It will also save ink, and you can use \includegraphics syntax as it is, you just need to replace foo and remove draft from command.

share|improve this answer
1  
I am not sure if the bounding-box computations are reliable. I had some problems with the replacement of default sized boxes for the draft mode graphics. By the way, for every picture you can also use \usepackage[draft]{graphicx}. Turkce gormek ayrica sasirtici :) –  percusse Feb 13 '12 at 13:56
    
@percusse: actually, although I almost never use default sizes, I omitted width, height arguments in my example. selamlar efendim :) –  nimcap Feb 13 '12 at 19:28
add comment

Inspired by Holle's answer (avoid a big black toner hungry box), here is one with pgf. The pgf package has a draft option. With it:

\documentclass{article}
\usepackage[draft]{pgf}

\begin{document}

\begin{figure}[ht]
\centering
\begin{pgfpicture}
    \pgftext{\pgfimage[width=5cm,height=4cm]{scratch.png}}
\end{pgfpicture}
\end{figure}

\end{document}

where scratch.png is your image. With draft as an option to the pgf package this simply looks like a box with the file name:

enter image description here

Without the draft option, the image is placed as expected.

share|improve this answer
    
Doesn't this just draws a box of X by Y? One would ideally need to be able to measure the actual image and print the box to the resulting dimension (i.e, if only width or height is specified, keepaspectratio etc). –  Yiannis Lazarides Feb 11 '12 at 16:28
    
I agree. It defaults to a 1cm by 1cm box. Perhaps it can be improved, but it's already a peripheral answer. –  qubyte Feb 11 '12 at 16:37
add comment

If you want to "hide" the entire picture, but reserve the space, you could use the following lines:

\usepackage{xcolor,graphicx}
...
\color{white}
\includegraphics[draft , ...]{picture}
\color{black}
share|improve this answer
    
Welcome to TeX.sx! A tip: If you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it) or type Ctrl+K. –  henrique May 9 '12 at 15:38
add comment

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.