# (Formerly: Auto-pst-pdf, LuaLaTeX, and chemnum broken in TexLive 2016)

I was testing some chemnum stuff now that I've updated to TexLive (TL) 2016. And Im getting and error where the auto-pst-pdf output PDF <basename>-pics.pdf is produced, but the main output, <basename>.pdf is not.

I'm compiling the example from here: Unable to change font using LuaLaTeX with usage of chemnum package (using a plain figure instead of a wrapfigure). It compiles fine with no errors under TL 2015, but the error occus when as soon as you use TL 2016.

The only error message I get in the log file is:

warning  (pdf backend): no pages of output.


I've called the shellesc package, to deal with the LuaTeX 0.90 \write18 issues (see TeX Live 2016: minted doesn't work with LuaLaTeX (bug fixed in June 2016)), but that still doesn't seem to fix it.

### MWE

\RequirePackage{shellesc}
\documentclass[12pt]{report}
\usepackage[a4paper,width=150mm,top=25mm,bottom=25mm]{geometry}
\usepackage{fancyhdr}
\usepackage{achemso}
\usepackage{chemnum}
\usepackage{ifluatex}
\ifluatex
\usepackage{fontspec}
\newfontface\chemnumface[Scale=MatchUppercase]{Tex Gyre Heros}
\setchemnum{format=\chemnumface}
\else
\usepackage{psfrag}
\fi
\usepackage[crop=off]{auto-pst-pdf}
\usepackage{graphicx}

\begin{document}

\begin{figure}
\centering
\replacecmpd{benzene} % replaces TMP1
\includegraphics{benzene.eps}
\end{figure}

Add any text here and use \refcmpd{benzene} to refer to the
compound. This way if you add a new figure in front of this one the
numbering will automatically be changed. Here is another compound
\cmpd{xx.one}

\end{document}

• What about using \RequirePackage{luatex85,shellesc}? (BTW: this problem is unrelated to chemnum…) Jun 21 '16 at 8:16
• I don't have your picture but with the one from the chemnum documentation and the package luatex85 it works (pst-pdf contains \@ifundefined{pdfoutput}) Jun 21 '16 at 8:45
• I was/am having the same issue - first it was pdftex.def making problems when using auto-pst-pdf, after updating it was not only pdftex.def but also luatex.def giving errors whenever using graphicx. After another update auto-pst-pdf used with graphicx does not insert eps figures (but rather some boxes, as if the file was not found), and in use together with psfrag (or chemnum relying on it) I get a "Undefined control sequence. \includegraphics[scale=.8]{RktsGl.eps}" I was about to prepare bug-reports to package-maintainers. BTW: Tried with pdfLaTeX and LuaLaTeX Jun 22 '16 at 12:05

## TL;DR, It's broken...

It's Chemdraw's method of dealing with fonts when exporting an EPS. There aren't any problems with the listed packages.

ChemDraw version 16 for Mac OSX doesn't save EPS graphics that can be used with psfrag, chemscheme, chemnum's interface with psfrag/pstools, or any other postscript text replacing package. This due to the way ChemDraw EPS export is currently handling fonts. Contact customer support and request to downgrade to the previous version (15) if you need this feature!

For the specific question above, the inability for it to do the label replacement meant that the final PDF was not produced.

## The rest

The issue I'm having here is the same as was asked here. The fault is not with any of the packages listed above, but with ChemDraw version 16.x.x. for Mac OSX (at 2017-09-14).

Version 16 of ChemDraw appears to load and save a subset of the font you use in your EPS. And then, it renumbers or re-assigns the character tables. I'm not 100% sure what to call it. As a result, the strings in the postscript code do not match those rendered in the image.

As an example in one of my EPS's ‘TMP3’ as seen in the image is !"#$ in the postscript code after ChemDraw does it's renumbering thing .(you can see this garbled string by opening up the EPS in a any text editor.) This is where ChemDraw is borking the whole text/label replacement system. psfrag looks for the string (TMP<number>) (or another user defined string enclose in parentheses), to replace it with the desired text when the EPS image is included in the document. If you replace the reordered/scrambled code ((!"#$) in my example above) in the postscript code inside the EPS with the expected string, (TMP<number>), psfrag will work and will replace the text in the EPS image in your compiled document. However, the standalone EPS image will not display the text anymore when it is rendered, as with the remapping that has occurred the characters T, M, P, and \ don't map to anything.

The latest working version I've been able to test is ChemDraw v 15.1.0.144 for Mac OSX. Interestingly, the latest version (16) for windows doesn't have this issue. This appears to be localized to Mac users of Chemdraw version 16.

As pointed out in the comments to the lined answer above this has been posted on teh Perkin Elmer support forum, Though no answer has yet to be received. I'm currently in communication with their support team and I'll post back here when (and if ) I get a response or solution form their support team.

In the mean time, for those who need a solution, If you institution has a site license then you are entitled to the two previous major versions of ChemDraw, you just have to contact customer support to get the required download link, serial number and registration code.

• ChemDraw 17 for Mac has been released. The issue with font renumbering has not been fixed, and so text substituttion is still broken as of version 17.0. Some unrelated EPS issues (not respecting line weights in diagrams upon export as EPS) have been fixed. Sep 21 '17 at 2:34