2

I tried to replace the temporary labels TMP1, TMP2 and TMP3 in an .eps file made with ChemDraw v18 on Mac OSX Mojave using the chemnum package, so to get an automatic numbering of the compounds, but this did not work for me.

I tried different fonts for the label in the .eps file, or other options for auto-pst-pdf with no result.

The problem originally occurred on TexLive 2014 for Mac remains with Mac OSX 10.14 and TexLive 2019, compilation with pdflatex -synctex=1 -interaction=nonstopmode --shell-escape %.tex(I use TexStudio).

For the following MWE with the following eps file.

\documentclass[a4paper,12pt]{article}
\usepackage{graphicx}
\usepackage[crop=off,runs=2]{auto-pst-pdf}
\usepackage{chemnum}
\usepackage{chemstyle}

\begin{document}

\begin{scheme}
    \replacecmpd[tag=TMP1]{cmpd:nucleophile1}
    \replacecmpd[tag=TMP2]{cmpd:nucleophile2}
    \replacecmpd[tag=TMP3]{cmpd:nucleophile3}
    \includegraphics[scale=0.8]{test_cmpd_numbering.eps}
    \caption[test]{A test to make the numbering work}
\end{scheme}

\end{document}

The picture is inserted properly and the file test_cmpd_numbering-pics.pdf generated (that's a progress from previously), but the TMP1, TMP2 etc. labels are not replaced. Here is the log file. It has got the error 'non-PDF special ignored!' which is often related to PdfLaTex difficulties on MacOSX.

Does anyone know why this code could make problems on Mac?

  • Your example works for me if I comment out \usepackage{epstopdf} (with the package it doesn't work) and compile with pdflatex (shell-escape enabled). The only tag that isn't replaced is in then TMP1 in THF, -30\260 but this can't work: psfrag needs “a single word, composed of unaccented letters and numbers”. (then TMP1 in THF, -30\260 is not a single word) – cgnieder Oct 07 '14 at 22:41
  • If I comment out \usepackage{epstopdf}, the aziridineopening-converted-to.pdf file is not created, hence an empty white space is included instead of the picture. Curiously I get no warning or error message. I tested in a terminal if epstopdf works for himself - it seems fine and if I start it manually in the terminal, the ...-converted-to.pdf file is created correctly. – Simon N. Oct 08 '14 at 11:12
  • @SimonN. But auto-pst-pdf should also create a ...-pics.pdf. (provided you're compiling with shell-escape enabled) – cgnieder Oct 09 '14 at 07:01
  • If I comment out \usepackage{eps-to-pdf} from the top MWE and compile with --shell-escape, the ...-pics.pdf file is created, but it has no content. If I open this ...-pics.pdf-file with a visualization program such as Preview or AdobeReader, I see only a small white quadrangle. And the aziridineopening-converted-to.pdf file is not created. Here the log file – Simon N. Oct 09 '14 at 10:03
  • The error message for the previous comment is: Error: /undefined in obj Operand stack: 2 0 Execution stack: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push *(...)* -- Current allocation mode is local Last OS error: Invalid argument Current file position is 132440 GPL Ghostscript 9.10: Unrecoverable error, exit code 1 – Simon N. Oct 09 '14 at 10:05
  • If I look at the .log-file, I can see line 956-957: Preview: Fontsize 12pt Preview: PDFoutput 1. Could it be that somehow, the Mac Preview-Programm, which is often used to convert .eps to .pdf, interferes with the process? Or am I totally misleaded? – Simon N. Oct 09 '14 at 10:29
  • @clemens with the new install of the 2019 TexLive for Mac distribution the ...-pics.pdf is generated properly. However the TMP1 etc labels are not replaced. Should they already be included in the ...-pics.pdf file? I have edited the question with a new MWE with the correct files. – Simon N. Aug 28 '19 at 16:01

2 Answers2

1

Turns out there were 2 problems associated with this.

  1. The PATH in TexStudio needed to be changed. This is a similar issue as .eps files and pdflatex and reconfiguring texstudio as described here solved it, here is a picture to clarify: TexStudio change PATH

  2. ChemDraw 18 on Mac does not generate the .eps file properly, ie defining the text correctly. This issue is known and explained in more detail in Chemdraw 16 for Mac OSX not working with psfrag and label replacing/autonumbering My solution was to generate the .eps file on a Windows computer running ChemDraw 16...

The combination of both solved the problem for the above MWE. I have edited the above question to reflect more the nature of the problem.

1

The Problem is (independently of the Chemdraw Version: I used v16.0.0 and v22.0.0) because Chemdraw on MacOS has a bug when creating an .eps File so the string doesn't appear on a text Editor (a.k.a.: Ghostscript). The solution I found was:

  1. Save the cropped File as a PDF (uncheck the Box: 'Break into pages'[v.22.0.0]. I didn't Found that Option on v.16.0 ).
  2. Then convert the File.pdf to File.eps with a converter.
  3. (optional) Open the .eps File with a text Editor and you will find the Script with the temporary marker (example.: TMP1).

I use personally Texmaker as a compiler so if you go to preferences, under the section 'Commands' paste this: pdflatex -synctex=1 -interaction=nonstopmode --shell-escape %.tex

Also compile the File with: PDF Latex to View PDF and then compile it again with Quick Build to View PDF .

Here is my LaTeX code:

\documentclass[11pt]{scrartcl}

\usepackage[T1]{fontenc} \usepackage{epstopdf} \usepackage[scaled=0.92]{helvet} \renewcommand\familydefault{\sfdefault} \usepackage{titleps} \usepackage{graphicx,auto-pst-pdf} \renewcommand*\sectionformat{\thesection\autodot\hspace{1cm}} \usepackage{amsmath} \usepackage[ngerman]{babel} \usepackage[a4paper,total={7in,10in}]{geometry} \usepackage{siunitx} \usepackage{hyphenat} \usepackage{amssymb} \usepackage{physics} \usepackage{braket} \usepackage{graphicx}

\usepackage[hidelinks]{hyperref} \usepackage{tcolorbox} \usepackage{titleps} \usepackage{multicol} \usepackage{multirow} \usepackage{ghsystem} \usepackage{pifont} \usepackage{tabularx} \usepackage{array}

\usepackage{chemstyle} \usepackage{chemscheme} \usepackage{chemschemex} \usepackage{chemnum}

\setcounter{secnumdepth}{4} \setcounter{tocdepth}{4}

\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}} \newtcolorbox{mybox}[3][] { colframe = #2!50, colback = #2!0, coltitle = #2!20!black,
title = {#3}, #1, }

\newpagestyle{ruled}

{\sethead{}{}{ \sectiontitle}\headrule \setfoot{}{\thepage}{}\footrule} \pagestyle{ruled}

\begin{document} \section{TEST}

\begin{scheme}[H] \replacecmpd{CompoundX} \replacecmpd{CompoundY} \centering \includegraphics[scale=1]{Filename.eps} \caption{Random Stuff you want to write here} \label{Your Label} \end{scheme}

Hier \cmpd{CompoundX} und \cmpd{CompundY}. \end{document}

Additional Info: I use macOS Catalina v.10.15.7. My texmaker version is: 5.1.3.

JamesT
  • 3,169