xqms / graphicscache

Caching & DPI control for the LaTeX graphicx package
BSD 3-Clause "New" or "Revised" License
10 stars 5 forks source link

Missing files do not cause a compilation error #4

Closed MatthiasNieuwenhuisen closed 6 years ago

MatthiasNieuwenhuisen commented 6 years ago

If an included graphics file is not present, the compilation does not abort with an error. An empty figure is rendered, cached and included, resulting in a successful compilation of the document. The result depends on whether files are included with or without suffix. With suffix, a box containing the file name is rendered. Without suffix the complete figure environment including caption just disappears.

To make the error even harder to detect, the labels are defined and can be referenced without warning.

\documentclass{article}

\usepackage{graphicx}
\usepackage{graphicscache}

\begin{document}
\begin{figure}
\includegraphics[width=\linewidth]{nonexistent-file.jpg}
\caption{Test caption}
\label{fig1}
\end{figure}

\begin{figure}
\includegraphics[width=\linewidth]{nonexistent-file-without-suffix}
\caption{Test caption for file without suffix}
\label{fig2}
\end{figure}

Figure \ref{fig1} and Figure \ref{fig2}

\end{document}

Resulting PDF

xqms commented 6 years ago

Fixed!