I use .eps graphics in my latex documents converted at compile using the epstopdf
package and it works great.
When I build the file, epstopdf
creates the <filename>-eps-converted-to.pdf
file and includes it in the resulting .pdf.
I would now like to now delete the .eps file and just use the converted<filename>-eps-converted-to.pdf
file. This actually works, sort of – epstopdf
doesn't complain (rightly or wrongly), it just returns
Package epstopdf Info: Output file is already uptodate.
and the resulting .pdf contains the image as desired.
However, I get an annoying LaTeX warning
LaTeX Warning: File `test.eps' not found on input line 8.
MWE:
\documentclass{article}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{epsfig}
\begin{document}
\includegraphics{test.eps}
\end{document}
Build this with any .eps file and it builds fine. Now delete or rename the .eps file and it still builds fine, but gives the annoying warning above.
My question: is there any way to just disable the warning for missing .eps files?
The reason for this is that I often auto-generate .eps files outside of the latex source directory and would like to just commit the latex source to git with the converted .pdf files (output locally by using the [outdir=./]
option with epstopdf
) but without the source .eps files – this way I or anyone else can build it stand-alone.
Updated MWE with .eps file outside the source path:
\documentclass{article}
\usepackage{graphicx}
\usepackage[outdir=./]{epstopdf}
\epstopdfsetup{suffix=}
\begin{document}
\includegraphics{../test}
\end{document}
Best Answer
It doesn't seem that there is a way to prevent the warning showing up directly.
One work-around would be to use the
silence
package to filter out the warnings from the output.However,
silence
doesn't detect these warnings as they're generated using(line 166 of
graphics.sty
) andsilence
only picks up warnings generated using\PackageWarning
,\ClassWarning
,\@latex@warning
and\@font@warning
(lines 381-431 in v1.5b ofsilence.sty
).I have contacted the maintainer of
silence
about this but received no response, so the simplest solution is to place the following code in the preamble:This will ignore all
\@warning
s that start withFile
.It is also possible to wrap all
\includegraphics
with\ActivateWarningFilters[latex_file_not_found]
and\DeactivateWarningFilters[latex_file_not_found]
to only apply this to graphics imports (I'm not sure whereFile
warnings would otherwise show up).Alternatively, this can also be automatically included in all
\includegraphics
calls with the following re-definition (credit to David Carlisle and this answer):