# chemnum: compounds numbers don't replace TMP at the right position in .eps file (chemdraw)

I'm really new to LaTeX, and even newer to this website, so forgive me in advance for all the mistakes I may have made.

Here's my problem: I'm trying to replace the temporary labels (TMP1,...) in an .eps file (made with chemdraw), in a modus operandi chapter for my master thesis, and it doesn't work the way it should. The TMP labels indeed disappear, but the 1,2 and 3 expected to replace them appear on the left of the figure, not at all where they should be. Moreover, there's also a message saying "frag replacements", appearing on the graph in the dvi file. When I try to export it as pdf, it doesn't even change the labels and I get stuck with TMP1,2,3.

Here is the code:

\documentclass[a4paper,12pt,notitlepage]{book}

%Packages

\usepackage[utf8]{inputenc}
\usepackage[francais]{babel}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{epstopdf}
%chemistry packages
\usepackage{chemstyle}
\usepackage{chemscheme}
\usepackage{chemschemex}
\usepackage{chemnum}

\usepackage{titling}
\usepackage{titlesec}    %to correct spacing of chapters
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titlespacing*{\chapter}{0pt}{-50pt}{20pt}
\titleformat{\chapter}[hang]
{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter:}{1em}{}

%Titre
\title{Partie expérimentale}
\author{Me}

\begin{document}

\chapter{Partie Expérimentale}
\section{Synthèse du thiéno[3,2-b]thiophène-2,5-diylbis((3-bromothiophèn-2-yl)méthanol)}

\begin{scheme}[ht]

\cmpd*{a}
\cmpd*{b}
\cmpd*{c}

\replacecmpd[TMP1]{a}
\replacecmpd[TMP2]{b}
\replacecmpd[TMP3]{c}
\includegraphics[scale=0.7]{Schema_Synthese_3.eps}

\caption{Schéma réactionnel 1}

\end{scheme}

\end{document}

And it gives the following result :

Could you help me ?

EDIT: here is the .eps file

• Welcome to TeX - LaTeX! Can you provide a link to the .eps file? – Andrew Swann Feb 13 '17 at 12:56
• Done. I don't know if it is the right way ? – Allan Feb 13 '17 at 13:13
• The replacement is not done by chemnum but by psfrag (this is mentioned in the manual!) – clemens Feb 13 '17 at 13:45
• @clemens Indeed, but the manual says very little about the actual compilation process needed. – Andrew Swann Feb 13 '17 at 14:55
• @AndrewSwann true but IMHO that should be covered in psfrag's manual and not in chemnum's. Besides: this has been covered on TeX.sx about a million times (at least that's what it feels like) :) – clemens Feb 13 '17 at 15:51

The results you are seeing come from not compiling the document file correctly. The following workflow will provide a pdf file with the labels replaced

latex file
dvips file -o
pstopdf file.ps

The output is then in file.pdf. Alternatively you can remove the epstopdf package and load the auto-pst-pdf package, with

\usepackage{auto-pst-pdf}

in your preamble, and then compile simply with

pdflatex -shell-escape file

\documentclass[a4paper,12pt,notitlepage]{book}

%Packages

\usepackage[utf8]{inputenc}
\usepackage[francais]{babel}
\usepackage[T1]{fontenc}
\usepackage{graphicx,auto-pst-pdf}
%\usepackage{epstopdf}
%chemistry packages
\usepackage{chemstyle}
\usepackage{chemscheme}
\usepackage{chemschemex}
\usepackage{chemnum}

\usepackage{titling}
\usepackage{titlesec}    %to correct spacing of chapters
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titlespacing*{\chapter}{0pt}{-50pt}{20pt}
\titleformat{\chapter}[hang]
{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter:}{1em}{}

%Titre
\title{Partie expérimentale}
\author{Me}

\begin{document}

\chapter{Partie Expérimentale}
\section{Synthèse du thiéno[3,2-b]thiophène-2,5-diylbis((3-bromothiophèn-2-yl)méthanol)}

\cmpd*{a}
\cmpd*{b}
\cmpd*{c}

\begin{scheme}[ht]
\replacecmpd[TMP1]{a}
\replacecmpd[TMP2]{b}
\replacecmpd[TMP3]{c}
\includegraphics[scale=0.7]{Schema_Synthese_3.eps}

\caption{Schéma réactionnel 1}

\end{scheme}

\end{document}
• Thank you. I was forced to answer below because it was too big for just this comment section, as other problems arose. – Allan Feb 16 '17 at 14:43