# sublimetext 2, auto-pst-pdf, enable shell escape, chemnum

I'm quite new to Latex (and Sublime Text 2) and currently writing my master thesis with them. I need to draw a lot of molecules and want to number them throughout the whole thesis. No, problem, used package chemnum and it worked (partly).

Problems arise when I used chemdraw and want to replace tags in the eps. file saved with chemdraw. After spending several hours in different forums etc., I have tried plenty of things so far, but it still doenst work. Can anyone please take a look at this and make at least an educated guess where the problem is(?)

What I've tried and it changed:

• using auto-pst-pdf of course, implemented after graphicx (which seems to be crucial)

• analog to that link ( http://wiki.contextgarden.net/write18 ) I enabled write18 and something changed: Whereas before I didnt get a "Name-pics.pdf" I now get that pdf, problems are:

• The file itself doesn't show any sign of a graphic now (not even the empty triangle)
• my log file still doesn't say anywhere (I think it should be in the first few lines) that write18 is enabled
• I tried changing in sublime text 2 the sublime settings. But that is were i get a little confused. Do I have to do this on top of enabling write18 in windows or should it be sufficient to do it in sublime? (non of it worked for me)

Can anybody please post the exact lines I have to copy under "builder-settings" in the file?

• I've also tried "Magic comment" %!TEX option = --shell-escape at the beginning of my file, but that doesn'tseem to change anything

I would be very glad if anyone could help me. Down below all the files and lines you need to test what I produced...

    \documentclass[11pt,pointlessnumbers,headsepline,cleardoubleempty,DIV12,BCOR8mm,a4paper,twoside,tablecaptionabove,openany]{scrbook}
\usepackage[english]{babel}
\usepackage[section]{placeins}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{epsfig}
\usepackage[runs=2,crop=off]{auto-pst-pdf}
\usepackage{psfrag}
%\usepackage[outdir=./]{epstopdf}

\usepackage[version=3]{mhchem}                      % chemische formeln
\usepackage{siunitx}                                % Si-Einheiten
\usepackage{chemfig}
\usepackage{chemnum}

%\usepackage[pagebackref,pdftex]{hyperref}
%\usepackage[pdftex]{hyperref}
%\usepackage[pdftex,plainpages=false]{hyperref}

\begin{document}

testtesttest

\begin{figure}
\begin{center}
\replacecmpd{isoqu}% replaces TMP1
\replacecmpd{reissert_prod}% replaces TMP1
\replacecmpd{hydrogen_prod}% replaces TMP1
\includegraphics[width=0.90\textwidth]{Merck_process_for_test}
\end{center}
\caption{Merck process to PZQ}
\label{merck_process}
\end{figure}

\end{document}

• Running this (a bit more minimized) with pdflatex (TL16 updated earlier today) and shell-escape activated I get ! Undefined control sequence. \pfg@Ginclude@eps – clemens Jun 29 '16 at 10:05

"builder_settings": {

• Well, I figured it out (more or less). I put the "builder_settings": { "options": ["--shell-escape"] } in as suggested ( and tried many times before) and I commented out all packages out which are not necessary for that specific part. Turns out, when I take out \usepackage{chemfig} everything works fine.... Unfortunately, for my work I need that package... Does anybody have a clue why it doesn't work together? (Should I post this as a new question?) – PHI Lipp Jun 30 '16 at 5:15