6

When running pdflatex -no-shell-escape on a file that includes an eps file, the automatic conversion to pdf will not be executed and the images not included.

I am surprised that in this case:

  • there is no info/warning/error message in the log file
  • return value of the pdflatex run is 0
  • no way to detect failure but checking the pdf files

Is this on purpose, are there ways to detect this kind of situations?

7
  • Please post your MWE Commented Apr 8, 2024 at 6:04
  • The issue appears to be that graphics.sty unconditionally defines \Gread@eps and pdftex.def never defines \Ginclude@eps, so the test at graphics.sty:276-282 will always enable draft mode and produce no error. And pdftex.def unconditionally defines \Gin@[email protected], so the test at graphics.sty:244-251 doesn't produce an error. And with shell escape disabled, pdftex.def:673-696 never loads epstopdf-base.sty (which is what would actually convert the EPS file). So it looks like a bug to me? Commented Apr 8, 2024 at 6:06
  • Something like \ifnum\pdfshellescape=0 \expandafter\let\csname Gread@eps\endcsname\undefined \fi should "fix" the problem, but this seems like a bug that should be fixed in graphics/x to me. Commented Apr 8, 2024 at 6:14
  • 1
    @MaxChernoff we'll have a look... you can't undefine Gread@eps (probably) as that's used for reading .bb files as well, also if the -converted-to file is already there from a previous run it should all work without shell escape. Commented Apr 8, 2024 at 7:36
  • Please see github.com/latex3/graphics-def/pull/new/no-shell-escape and associated PR Commented Apr 13, 2024 at 22:26

1 Answer 1

5

pdftex.def and luatex.def have been updated at CTAN and so will get updates in texlive/miktex shortly.

Please see https://github.com/latex3/graphics-def/issues/38 and associated PR

I actually set things up slightly differently to the suggestion below. The files now always include epstopdf-base even with --no-shell-escape . This give better compatibility with the default processing, and does have the required properties of giving an error if no conversion is possible and including a pre-converted pdf if it exists (eg if the document has previously been run with the default restricted shell escape).


Original Answer

I think the logic in pdftex.def can be improved adding something like the block here

\documentclass{article} \usepackage{graphicx} \makeatletter \ifnum\pdfshellescape=0 \expanded{\def\noexpand\Gin@epstopdf@aux#1.\detokenize{eps}}.#2\relax{#1-eps-converted-to.pdf} \def\Ginclude@eps#1{% \expanded{\edef\noexpand\Gin@tempa{\noexpand\noexpand\noexpand\Gin@epstopdf@aux#1.\detokenize{eps}\relax}}% \edef\Gin@tempa{\Gin@tempa}% \IfFileExists{\Gin@tempa}% {\Ginclude@pdf{\Gin@tempa}}% {\PackageError{Graphics} {No PDF version of #1 available}% {Shell escape conversion has been disabled}}% } \fi \makeatother \begin{document} \includegraphics{ex1.eps} \includegraphics{ex2.eps} \end{document} 

This means that if (from a previous run or made externally) ex1-eps-converted-to.pdf exists, it gets used, if it does not you get

! Package Graphics Error: No PDF version of ex2.eps available. See the Graphics package documentation for explanation. Type H <return> for immediate help. ... l.24 \includegraphics{ex2.eps} ? h Shell escape conversion has been disabled ? 
9
  • and an equivalent thing in luatex.def Commented Apr 8, 2024 at 8:28
  • Nice answer. How to additionally give a \PackageInfo (or warning) telling that a pre-conveted and perhaps non up-to-date pdf file has been used ? Commented Apr 8, 2024 at 9:01
  • we could add a warning in the true case, also it's not quite right as the image doesn't always get included, will fix later but note that in the default case also it should probably check the converted one is newer than the eps which you can do without shell escape Commented Apr 8, 2024 at 9:07
  • Thanks @DavidCarlisle , but that doesn't work in an automatic system that needs to detect errors of conversion here at arXiv. Do you have any plans to fix this in the main latex package? Or should we patch our version of LaTeX with something like the above? Commented Apr 8, 2024 at 15:32
  • @norbert no sorry it doesn't work but I can't fix during the day, it's putting the error in the right place but in the non error case it's doing something wrong, I'll get a fix in to git this week it should be in the next main latex June release (I'll ping you) Commented Apr 8, 2024 at 16:08

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.