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 am trying to make a draft by forcing LaTeX to ignore all images. How do I tell LaTeX to suppress all the image filenames (in the \includegraphics command) and just insert an empty box? The problem with the [draft] options is that it still requires me to have all images in the folder where I have my .tex files.

share|improve this question
1  
I took the liberty to change 'figure' to 'image' to avoid confusion with the figure environment. You apparently want only suppress the \includegraphics. –  Martin Scharrer Jun 29 '11 at 17:47
add comment

migrated from stackoverflow.com Jun 29 '11 at 17:40

This question came from our site for professional and enthusiast programmers.

2 Answers

The quickest way I can think of is to simply redefine the command:

\renewcommand{\includegraphics}[2][]{\fbox{}}

will get you an empty box;

\renewcommand{\includegraphics}[2][]{\fbox{#2}}

will get you a box with the intended filename inside it. If you need, say, a specific size box, you can mess around with similar boxmaking commands in place of \fbox until you have it doing what you need. But the important thing is: anytime you want a command to do something different than what it does, \renewcommand! :)

share|improve this answer
add comment
\usepackage[demo]{graphicx}

will give a black box for all images. All absolute width/height settings are recognized.

share|improve this answer
8  
If graphicx is loaded by another package or document class (e.g. beamer) then you can add \PassOptionsToPackage{demo}{graphicx} before \documentclass to get around the option class error. –  Seamus Jun 30 '11 at 11:25
add comment

Your Answer

 
discard

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