# Chemstyle: TMP labels not replaced

I am trying to use the chemstyle package but am failing to replace the TMP labels with the automatic label numbers. I could go back to manually editing each eps file and inserting it as figures, but in the long run a working chemstyle could save me a lot of time.

I keep reading similar questions online, but so far none of the solutions seem to work for me. I am placing a mwe below. I did insert my entire preamble to make sure there is no problem of incompatibility that I am unaware off. I am quite new to LaTeX so any help would be highly appreciated

Code

\documentclass[11 pt]{book}

\usepackage[british]{babel}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage[hypcap]{caption}
\usepackage{subcaption}
\usepackage{amsmath}
\usepackage{amstext} %required for chemstyle
\usepackage{siunitx} %required for chemstyle
\usepackage{psfrag} %required for chemstyle
\usepackage{kvoptions} %required for chemstyle
\usepackage{varioref} %required for chemstyle
\usepackage{xspace} %required for chemstyle
\usepackage{bpchem} %required for chemstyle
\usepackage[tracking=bpchem]{chemstyle}

\begin{document}

\begin{scheme}[ht]
\schemeref[TMP1]{Bla}
\schemeref[TMP2]{Blabla}
\schemeref[TMP3]{Blablabla}
\schemeref[TMP4]{Blablablabla}
\includegraphics{scheme1.eps}
\caption{test}
\end{scheme}

\end{document}

• I am not familiar with the chem style package but I see that you load lot of package in your source which does not make it minimal. One thing you should try is remove (comment out) the non relevant package in order to evidence the origin of your problem (conflict of package, error of syntax or anything else). – DRi Aug 26 '16 at 16:03
• I am aware of that but when I just load the packages needed for chemstyle the problem persists. So I would assume the issue is in my Eps file (exported from chemdraw) or in one of the other packages. If I remove {epstopdf} no image is generated at all, while in case epstopdf is loaded the labels are not replaced. As soon as I am close to my laptop I will try again by removing the unrelated packages – GGraulus Aug 27 '16 at 17:44
• I have minimalised the code above. when running the code. epstopdf generates a pdf file of the eps file to be enclosed, but it is not incorporated in the document, nor are the TMP labels changed to numbers – GGraulus Aug 29 '16 at 6:56
• Do you run the file with shell-escape enabled? If no then try that. If no: do the EPS files contain the TMP markers as text? You can check that by opening the EPS files with a text editor. – clemens Aug 29 '16 at 11:23
• Shell escape is enabled, the TMP labels are present when opening the file via WordPad. – GGraulus Aug 29 '16 at 11:28

I'm having the same set of issues. Went back to the most basic configuration you can use to get a scheme with numbering:

% Minimal working environment for using chemstylepackage.
\documentclass[12pt]{report}
\usepackage[runs=2]{auto-pst-pdf}   % Use EPS graphics with pdfLaTeX
\usepackage{chemstyle}              % Of course!

\begin{document}

\begin{figure}[p]
\includegraphics{scheme-two.eps}
\caption{A scheme with temporary compound numbers.}
\end{figure}
\begin{figure}[p]
\schemeref{IMesHCl}
\schemeref{IMes}
\includegraphics{scheme-two.eps}
\caption{A scheme with automated compound numbers.}
\end{figure}
\clearpage

\end{document}


Then started adding in packages on by one to see when it broke. From what Ive found, chemstyle is not compatible with biblatex and also seems to break when I reset the default font using \renewcommand{\rmdefault}{ptm}.

Edit: Note that I tried using epstopdf and pstool instead of auto-pst-pdf and only auto-pst-pdf has been successful for me.

• Thanks for joining the discussion. Do you imply I will have to chose between citations or schemes? I'm using the {natbib} and {chapterbib} packages for my reference, but even without loading those the problem persists in my case. Also when I switch to [runs=2]{auto-pst-pdf}, none of my eps-files are included in the document, while they are in fact generated. – GGraulus Aug 30 '16 at 6:47
• I didn't mean to imply anything of the sort, just wanted to share my experience in hopes that it would help you. The best thing I could come up with was testing packages individual to determine what was conflicting. – John Doe Aug 31 '16 at 14:27
• I should add that I've resorted to a work around. If you copy lines 284-309 from chemscheme.sty into a new .sty file and add \usepackage{psfrag} that is sufficient for the scheme renumbering to work. I created my own Scheme environment using the newfloat package ctan.org/pkg/newfloat?lang=en – John Doe Aug 31 '16 at 14:38

The Short Solution: http://www.jon.hk/2010/03/writing-chemistry-with-latex-33/

Don't use epstopdf, use auto-pst-pdf, set up its dependencies, and you will be right as rain.

The longer version:

I am still learning how to use LaTeX, have encountered the same issue, and have found a workaround, so this information may be helpful. My understanding of your problem thus far is that;

1. As a chemist, you need to render chemical structures and automatically label them with numbers for organisational purposes.
2. In order to do so, you have started exporting ChemDraw files with structures labelled with TMP1 underneath them, which are converted to the vector graphic in .eps format
3. In order to insert these .eps files with structures labelled as TMP1 into your document, you are using the "epstopdf" package. You are then using the "chemscheme" component of the "chemstyle" package so as to be able to replace the "TMP" labels with automatically generated structure numbers
4. The "epstopdf" package is correctly locating your structures folder, and by calling the .eps file using chemscheme, it is inserted into your document as a float
5. The "chemscheme" package, however, is not working correctly with "epstopdf" to replace the "TMP1" label underneath your structure with an automatically generated number

In my experience, I have found that chemscheme and epstopdf are incompatible, and this is the cause of your problem. Whilst I strongly recommend "chemscheme" to float your .eps structures, you will need to use a different package to convert your .eps structures into a pdf format that is compatible with "chemscheme", such that they can be correctly relabelled with an automatically generated number by "chemscheme"

One such package that has worked for me, albeit with a much longer compilation time, is the "auto-pst-pdf" package. A full working guide that assisted me in overcoming this exact issue can be found here:

http://www.jon.hk/2010/03/writing-chemistry-with-latex-33/

This method instead uses a package called "auto-pst-pdf" which is capable of reading your .eps files, converting them to a .pdf format, and having them interact in a way that "chemscheme" is able to write over the TMP label to give it an automatic structure number. It should be used instead of epstopdf. Your challenges likely remain in setting up this package and its dependencies.

Feel free to send me a message or comment and I will be happy to answer any questions about my TeXmaker configuration and other packages used.