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 recently switched to demo such that I could compile my .tex file without needing the actual image files. Now, instead of the image there is a black box. Is there anyway to get a black border such that when I am printing copies of this I don't waste precious black ink.

share|improve this question
Your precious black ink, haha –  Daniel Jun 6 '13 at 18:18
@Daniel in these hard financial times, every penny counts –  puk Jun 7 '13 at 21:01

3 Answers 3

up vote 9 down vote accepted

share|improve this answer
I wonder why graphics doesn't do that automatically when the draft option is set. –  Caramdir Oct 5 '11 at 23:01
@Caramdir File a request at www.latex-project.org –  egreg Oct 6 '11 at 7:39

Since the demo option to graphicx makes all \includegraphics commands print a 150pt x 100pt rectangle and there's no way around that easily, you could just redefine the \includegraphics command:

  \setlength{\fboxsep}{-\fboxrule}% Remove frame separator/gap
  \framebox{\rule{0pt}{100pt}\rule{150pt}{0pt}}% Framed box of 150pt x 100pt

Now you can remove the demo option from graphicx and use the document as is with the same \framebox-filled result. Since the command has the same format \includegraphics[..]{...}, no further modifications are needed; all arguments (both optional and mandatory) are discarded.

share|improve this answer

Here is another way (albeit slightly overkill with \tkiz for drawing the box, but you can adapt the other solutions for the box drawing if that is not desired -- I tend to think \tikz first for some reason :-). The only real enhancement here from the other solutions is to use \def\DemoOption{demo} when in demo mode and \def\DemoOption{} when not in demo mode. This could be improved by using a command line option to set \DemoOption.

Since the graphicx pacakge defines \def\Ginclude@graphics when in demo mode, we just need to redfine that after \begin{document}:

\def\DemoOption{demo}% Use this in demo mode
%\def\DemoOption{}% Use this when done want figures included

      \tikz \draw (0,0) rectangle (150pt,100pt);%

share|improve this answer

Your Answer


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.