I would like to replace some figures in a document with a black frame of the same size as the figure, such as that which you get when using \includegraphics in draft mode. However, this places the name of the figure file inside the framed box. Is there a way to replace this text with centered text stating
Figure removed due to copyright restrictions?


A suggestion can be the combination of collectbox, adjustbox and tikz.

I tried to avoid TikZ but I wasn't able to create the red rectangle with adjustbox.

The code provides two things:

  1. A switch do print the image or the copyright information. You can choose by \copyrightimagefalse or \copyrightimagetrue.
  2. Instead of using includegraphics you must use \copyrightimage to work with the previous switch.

The Code

\usepackage{mwe}% or load ’graphicx’ and ’blindtext’ manually
  \tikz[outer sep=0pt]\node[fill=red!20,minimum height=\totalheight,minimum width=\width]{%
       \smash{\parbox{\width}{\centering\large\bfseries Figure removed due to copyright restrictions}}

\caption{set \texttt{\string\copyrightimagefalse}}

\caption{set \texttt{\string\copyrightimagetrue}}
| improve this answer | |
  • Thanks for your suggestion. However, I cannot seem to get this code working, even if I simply copy-and-paste it and change only the image file. pdfLatex keeps on complaining that \copyrightimage is an undefined control sequence: Undefined control sequence. \\copyrightimage ...ENT \fi }{\adjincludegraphics [#1]{#2}} l.24 \copyrightimage[width=0.48\linewidth]{dice} ? Could you please confirm if the code works as is? Thanks again... – Miguel May 20 '12 at 17:11
  • @Miguel: Please make an update of your TeX distribution. – Marco Daniel May 20 '12 at 17:17
  • Thanks - the code now runs! But the box is too wide and shifted to the right (lies outside of the text margins when the image has width = \textwidth). Compare: \begin{figure}[!ht] \centering \includegraphics[draft, width=\textwidth]{some-image} \end{figure} \blindtext versus \begin{figure}[!ht] \centering\copyrightimagetrue \copyrightimage[width=\textwidth]{some-image} \end{figure} \blindtext – Miguel May 21 '12 at 7:13
  • @miguel I will test it later and change the example. – Marco Daniel May 21 '12 at 9:48
  • @Miguel: You use \includegraphics instead of \copyrightimage. As I wrote I defined a new command instead of redefining includegraphics – Marco Daniel May 21 '12 at 18:32

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.