1

I would like to have a new option in the \includegraphicscommand. The idea ist that there is no error when the file does not exist - maybe just a friendly warning.

Ideally, the file extension is not needed (to be flexible in the future) but if it's needed that's also ok (at the moment it's not necessary).

\documentclass[a4paper,11pt]{article}

\usepackage{graphicx}

\begin{document}

\includegraphics[myDoNotComplainIfFileIsMissing]{MyFileThatMayOrMayNotExist.ext}

\end{document}

Possible duplicates

5
  • 1
    You can define a new command \newcommand{\ncigraphics}[1]{\iffileexists{#1}{\includegrapchics{#1}}{}. Unfortunately you have to define the file extension. And you have to add some more magic, to hand over the optional arguments for the includegraphics command. – Jan Jan 29 '17 at 15:33
  • @Jan Thanks for the comment. I just chatted to the developer of the graphics package and he pointed out some duplicate questions. – Dr. Manuel Kuehner Jan 29 '17 at 15:34
  • Can we mark it as duplicate then? – Johannes_B Mar 21 '17 at 11:00
  • @Johannes_B Yes. Do you keep track? :) – Dr. Manuel Kuehner Mar 21 '17 at 11:04
  • 1
    I just looked around. We have a long list of unanswered questions. It needs cleaning every once in a while. – Johannes_B Mar 21 '17 at 11:08

Browse other questions tagged or ask your own question.