11

I have a thesis to submit tomorrow as .pdf. The University requires written permission from the copyright holder for every figure taken from book/journal--a thing I don't have, and I didn't know was required until today.

The images in question are .pdf, .png and .jpg, typeset with pdflatex.

Is there some kind of environment I can wrap around the \includegraphics{} that will produce a replacement of the exact same size?

Checking width and height for each and every graph (sometimes I use the [resolution=300] statement) would take quite a while.

lockstep
  • 250,273
  • 7
    [draft] option should do that. – David Carlisle Oct 15 '12 at 11:12
  • Not the best approach but maybe a quick fix: Use TikZ to draw a grey box over the images. TikZ can automatically use the same size as the figures as shown here: http://tex.stackexchange.com/questions/9559/drawing-on-an-image-with-tikz. Alternatively David's suggestion which will only show the filename. – Alexander Oct 15 '12 at 11:12
  • 3
    I don't understand how that will solve your problem. The thesis will be fine without the pictures? Cannot you just redraw them by yourself and cite the source (you don't reuse them so you don't need the permission)? And if you cannot do this, think it's much better to remove them completely than to replace them with empty squares. – yo' Oct 15 '12 at 11:27
  • 4
    I second David; \usepackage[draft]{graphicx} will do; for the pictures you want to include anyway, just add the option draft=false to \includegraphics: \includegraphics[draft=false,...]{file} – egreg Oct 15 '12 at 12:00
  • @tohecz: That's a thing I didn't want to do. Page-breaks and page numbers would change in the whole document if deleting figures completely. So if I told somebody "I wrote this and that on page X", there would be some ambiguity. And I might get permission for some of the figures later on... – user334287 Oct 16 '12 at 10:08
  • Well, that is the problem of using "on page X" instead of "in Section/Remark/Theorem Y", but do what you consider the best! – yo' Oct 16 '12 at 10:59

2 Answers2

16

The draft option to graphicx will do what you want. It will make an empty box of the exact size that would be occupied by the picture, since the dimensions are still computed from the picture after applying all the options:

\usepackage[draft]{graphicx}

If you want to include a particular picture, use the draft=false option:

\includegraphics[draft=false,<other options>]{filename}

The draft option will print the file name inside the box; if you want something else, the following patch, to be added to your preamble after loading graphicx, will do:

\usepackage{etoolbox}
\makeatletter
\patchcmd{\Gin@setfile}{\ttfamily\expandafter\strip@prefix\meaning\@tempa}{\@missingcopyright}{}{}

\def\@missingcopyright{%
  \tiny
  \begin{tabular}{@{}l@{}}
    Figure omitted due to\\
    missing permission\\
    % comment the following line if you don't want to show the file name
    \ttfamily\expandafter\strip@prefix\meaning\@tempa 
  \end{tabular}}
\makeatother

I've added a possible definition of \@missingcopyright which should explain why the picture is missing; if you don't want the file name, just remove the line starting with \ttfamily. If you want no message at all, just remove \@missingcopyright from the \patchcmd line (and the definition of \@missingcopyright).

David Carlisle
  • 757,742
egreg
  • 1,121,712
  • Beautiful solution! Saving me hours of time. Just had some trouble to get [draft]-option activated. Was conflicting with \usepackage{rotating}, so I made a modified document class (containing \usepackage[draft]{rotating} instead of \usepackage{rotating}) and using this to switch the inclusion of figures on/off. – user334287 Oct 15 '12 at 17:53
  • 1
    You can simply add \PassOptionsToPackage{draft}{graphicx} before the \documentclass line. – egreg Oct 15 '12 at 17:56
1

You can use the package draftfigure to get the same result and modify the display of the figure in various ways.

\documentclass{scrartcl}
\usepackage{graphicx}
\usepackage[
  allfiguresdraft,
  content = {Figure  omitted  due  to missing copyright},
]{draftfigure}

\begin{document}
\includegraphics[width=250pt]{example-image-a}

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

\includegraphics[width=250pt]{example-image-c}
\end{document}
lukascbossert
  • 3,015
  • 1
  • 16
  • 37