# include PDF, PNG/JPEG images with DVI-PS-PDF chain (needed for \chemnum package) (Texstudio)

I am writing a chemical report in TexStudio and include several different image formats, mainly EPS, created with ChemDraw. The drawings are included with the graphicx package and \includegraphics. As I need to numerate all my chemical compounds, I use the chemnum package with the \cmpd command in the running text and the \replacecmpd command to replace temporary markers in the EPS. Therefore I need the DVI-PS-PDF-chain as Build&View compiler.

In addition I need to include some pictures as PNG/JPEG from my experimental setup. Unfortunately these seem to not be compatible with the DVI-PS-PDF-chain. I cannot convert them to .eps as the vector graphic format does not work for high resolution pictures.

From my searchings, the inclusion of PNG/JPEG pictures in combination with the chemnum package seems to be a known and not solvable problem.

That's why I tried converting the pictures to PDF before including, but this does not work either. Following error message is displayed:

File ../Abbildungen/NaColumn_closeup' not found. ...extwidth]{../Abbildungen/NaColumn_closeup}


Right now I can either enumerate all my drawings with the DVI-PS-PDF-chain or include all pictures using the default compiling settings but then I have do it without the automatic numbering and enumerate all compounds in the reaction drawings manually (which is super tedious for ~50 compounds).

I have tried to find a solution for this for several weeks now, but could not find a way to successfully compile my report including the pictures and the automatic numbering at the same time.

Is there any approach to fix this issue?

Sample code:

\documentclass[12pt,a4paper,bibliography=totocnumbered]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[onehalfspacing]{setspace}
\usepackage[onehalfspacing]{setspace}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{array}
\usepackage{tabularx}
\usepackage{graphicx}
\usepackage{subfigure}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{pifont}
\usepackage{chemnum}
\usepackage[version=4]{mhchem}
\usepackage{chemstyle}
\usepackage{chemformula}
\usepackage{csquotes}

\begin{document}

molecule \cmpd{benzene}

\begin{figure}[!htb]

\centering
\replacecmpd{benzene}
\includegraphics[scale=1]{test_molecule}
\caption{molecule \cmpd{benzene}.}
\end{figure}

\begin{figure}[!htb]

\centering
\includegraphics[width=0.8\textwidth]{test_molecule2}
\caption{molecule \cmpd{phenol}.}

\end{figure}

\end{document}

• (1) Welcome to the site, (2) you are much much more likely to get help if you provide code that others can test on their systems. As for sample images that others also have access to you can choose on of the files listed here ctan.org/tex-archive/macros/latex/contrib/mwe – daleif Feb 12 at 10:13
• You can try using the auto-pst-pdf or pstool packages which allow EPS inclusion and text replacement using pdflatex (and pdflatex also supports .png of course), or xelatex without extra packages, that works for most PSTricks-like packages as well. The --shell-escape flag is generally needed because there is a lot of automatic conversion and processing being done in the background when using such solutions. – Marijn Feb 12 at 10:43
• I tried all of these options, unfortunately none of them really work. With pstool` the numbering does not work and with the others my files are not found again. – Carla Feb 12 at 12:14