# Including both PDF and EPS files (chemnum + auto-pst-pdf) [closed]

I'm replacing strings within EPS files using the chemnum package. As I prefer to use pdflatex, auto-pst-pdf should be required as well. So, compiling mwe.tex:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{auto-pst-pdf}
\usepackage{chemnum}
\usepackage{graphicx}

\begin{document}

\begin{figure}
\includegraphics[width=3cm]{example-image-a.eps}
\end{figure}

\nobreakspace

\begin{figure}
\replacecmpd[tag=B]{B}
\includegraphics[width=3cm]{example-image-b.eps}
\end{figure}

\end{document}



with pdflatex --shell-escape mwe.tex on an up-to-date TeX Live 2019 distribution/Windows 10 x64 will give:

However, I prefer to include PDF files wherever possible so that EPS is only used where \replacecmpd is really required. If the first of the two \includegraphics is replaced by its PDF analogue, the input file

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{auto-pst-pdf}
\usepackage{chemnum}
\usepackage{graphicx}

\begin{document}

\begin{figure}
\includegraphics[width=3cm]{example-image-a.pdf}
\end{figure}

\nobreakspace

\begin{figure}
\replacecmpd[tag=B]{B}
\includegraphics[width=3cm]{example-image-b.eps}
\end{figure}

\end{document}


will produce a document where only example-image-a was typeset. The EPS file will not be processed. The log file will show the following suspicious lines:

<c:/texlive/2019/texmf-dist/tex/latex/mwe/example-image-a.pdf>] [2
<c:/texlive/2019/texmf-dist/tex/latex/mwe/example-image-b.eps>]
Error: /undefined in obj
Operand stack:
6   0
Execution stack:
%interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   2022   1   3   %oparray_pop   2021   1   3   %oparray_pop   2009   1   3   %oparray_pop   1865   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--
Dictionary stack:
--dict:736/1123(ro)(G)--   --dict:0/20(G)--   --dict:128/200(L)--   --dict:177/300(L)--   --dict:70/200(L)--
Current allocation mode is local
Current file position is 324785
GPL Ghostscript 9.50: Unrecoverable error, exit code 1
system returned with code 1
PDFCROP 1.38, 2012/11/02 - Copyright (c) 2002-2012 by Heiko Oberdiek.

!!! Warning: Empty Bounding Box is returned by Ghostscript!
!!!   Page 1: 0 0 0 0
!!! Either there is a problem with the page or with Ghostscript.
!!! Recovery is tried by embedding the page in its original size.

==> 1 page written on mwe-pics.pdf'.
"-------------------------------------------------"
"auto-pst-pdf: End auxiliary LaTeX compilation"
"-------------------------------------------------"


I appreciate your ideas regarding this issue.

simpler example:

\documentclass{article}

\usepackage{auto-pst-pdf}

\begin{document}

\begin{figure}
\includegraphics[width=3cm]{example-image-a.pdf}
\end{figure}

\end{document}
`
• I can confirm the PS error, I added a simpler example as chemnum isn't really involved. However if I try that example in texlive 2018 I get a different error (tex not postscript) Nov 14 '19 at 16:23
• github.com/rolfn/pst-pdf/issues/1 Nov 14 '19 at 17:33
• Thanks David! So I will wait for package updates. Nov 14 '19 at 19:05
• I can now confirm that the problem is gone after updating my TeX Live 2019 distribution. Nov 18 '19 at 7:53
• I'm voting to close this question as off-topic because the issue it describes has been fixed in an up to date distribution. Feb 15 '20 at 11:00