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'm writing my paper using texlive2013.As for me,it is rather annoying to swich between writing and plotting figures.So I'd like to create a dummy figure when I was writing to avoid disturbance and add figures back later.I found a nice solution here:

enter image description here

However,not only were the missing figures,other normal figures were replaced as well.Is there a way to get it around?

share|improve this question
3  
Inside your \begin{figure} ... \end{figure} you can put something like \rule{4cm}{8cm}. This could also be 'automated' using conditionals... –  jon May 9 at 4:25
    

1 Answer 1

up vote 8 down vote accepted

A small workaround, but not perfect for sure (depending on the graphics extension, it might fail) -- I use the \IfFileExists in a slightly redefined \includegraphics command. It test for four extensions (all in lower case) (.eps,.pdf, .jpg and .png)

\documentclass{scrbook}

\usepackage{blindtext}
\usepackage{graphicx}
\usepackage{tcolorbox}


\let\StandardIncludeGraphics\includegraphics%
\renewcommand{\includegraphics}[2][]{%
\IfFileExists{#2.eps}{%
  \StandardIncludeGraphics[#1]{#2}%
}{%
 \IfFileExists{#2.pdf}{%
  \StandardIncludeGraphics[#1]{#2}%
  }{ % No, no .pdf, try *.jpg 
   \IfFileExists{#2.jpg}{%
    \StandardIncludeGraphics[#1]{#2}%
    }{
      \IfFileExists{#2.png}{%
      \StandardIncludeGraphics[#1]{#2}%
      }{%
      \begin{tcolorbox}[width=6cm,height=4cm,arc=0mm,auto outer arc]
      \end{tcolorbox}
     }
   }
 }
}% 
%
}% End of command



\begin{document}



\chapter{First one}
\blindtext

\begin{figure}
\begin{center}

\includegraphics[width=10cm,height=8cm]{some_file}
\caption{My demo figure}
\end{center}
\end{figure}
\blindtext[2]


\end{document}

The mentioned file some_file does not exist at all in my paths.

enter image description here

share|improve this answer

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.