# Problems when using chemscheme/chemstyle with Palatino and T1 encoding

Automatic generation of compound numbers by chemscheme (part of chemstyle) works:

• In Latin Modern (lmodern) with T1 or OT1 encoding
• In Palatino (mathpazo) with OT1 encoding, but not with T1 encoding - instead, the numbers simply vanish (see example below).

This is presumably down to Palatino's use of bitmap fonts, when switched to T1. I'd like to find a way to carry on using Palatino (or similar), but be able to use the automatic compound numbering features of chemstyle (or rather the underlying chemcompounds)

Fully working version

Taking, as my MWE, a version of the example document from the chemstyle documentation which works as it's supposed to:

\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[runs=2]{auto-pst-pdf}
\usepackage[journal=rsc]{chemstyle}
\usepackage{lmodern}

\begin{document}

\begin{scheme}[ht]
\includegraphics{chemscheme}
\caption{A scheme with temporary compound numbers.}
\end{scheme}

\begin{scheme}[ht]
\schemeref{IMesHCl}
\schemeref{IMes}
\includegraphics{chemscheme}
\caption{A scheme with automated compound numbers.}
\end{scheme}

\end{document}


The above uses the eps file from the chemstyle manual, i.e. chemscheme.eps . As best I can tell, that eps doesn't seem to be available as-is in the chemstyle documentation – rather, there's a chemscheme.cdx (a ChemDrawfile) that (for those with ChemDraw) can be saved as eps. Edit: Alternatively, I've uploaded a copy at http://dur.ac.uk/o.w.j.burnham/stackexchange/chemscheme.eps.

When run, with shell-escape enabled, via

pdflatex.exe -synctex=1 -interaction=nonstopmode --shell-escape %.tex


I get, as expected,

i.e. in the second scheme, the placeholders (TMP1 and TMP2) from the eps have been replaced by automatically-generated numbers.

The error

However, if I disable Latin Modern, i.e. if the document reads

\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[runs=2]{auto-pst-pdf}
\usepackage[journal=rsc]{chemstyle}
%\usepackage{lmodern}    %Latin Modern disabled. Now using Computer Modern.

\begin{document}

\begin{scheme}[ht]
\includegraphics{chemscheme}
\caption{A scheme with temporary compound numbers.}
\end{scheme}

\begin{scheme}[ht]
\schemeref{IMesHCl}
\schemeref{IMes}
\includegraphics{chemscheme}
\caption{A scheme with automated compound numbers.}
\end{scheme}

\end{document}


and, therefore, the document compiles using the default font (Computer Modern), the automated compounds numbers vanish. The problem also occurs if I replace Latin Modern with Palatino, i.e. if I replace lmodern with mathpazo. In either case I get something like this, where the auto-generated numbers are missing:

Happily (?) this can be fixed – using Computer Modern or Palatino – by removing \usepackage[T1]{fontenc}, so as to return to the default (OT1) font-encoding:

So, in summary, as best I can tell, automatic generation of compound numbers works:

• In Latin Modern with T1 or OT1 encoding
• In Computer Modern with OT1 encoding (but not with T1 encoding)
• In Palatino with OT1 encoding (but not with T1 encoding)

As best I understand it, this correlates with Computer Modern and Palatino's use of bitmap fonts when switched to T1 encoding. Intuitively it makes some sense to me that the eps – being a vector format – works with vector fonts but not with bitmaps, and so the use of bitmap fonts here could lead to problems.

Possible solutions that have occurred to me:

1. Use Latin Modern – I would prefer not to, as I like Palatino
2. Use a Palatino-like font that has a vector form in T1 – however, I don't know of any such font!
3. Use Palatino except in the context of compound numbering – however, I don't know how I'd go about doing this

If anyone has any other ideas for possible fixes but without knowing how they would implement them, I'll happily make edits and add any such suggestions to this list, in case someone else can them work out how to implement them.

• Since I don't have chemdraw, I can't test it myself, but maybe give package kpfonts a shot, it looks similar to mathpazo but is more recent. Oct 5, 2017 at 12:08
• @MichaelPalmer Thanks, that looks like it might be a working solution. If it works for me I'll let you know and you should post it as an answer. Additionally, I've edited the post to include a link to the eps file, so that people without ChemDraw can test. Oct 5, 2017 at 12:22
• @MichaelPalmer Looks like kpfonts doesn't work for me, but not for any reasons to do with this particular example -- I just can't get it working with any document . The similar pxfonts seems like it might do the job, but lacks some of the features (like old style figures) that kpfonts and mathpazo have. Oct 5, 2017 at 13:00
• Your example with the eps works fine for me in a current miktex and in a current texlive. Can you show the log-file of the last pdflatex run? Oct 5, 2017 at 14:04
• @UlrikeFischer After installing cm-super and running updmap, it now works perfectly for both Computer Modern and Palatino. Thank you so much. Oct 5, 2017 at 14:55

You have a bitmap (pk-)font in your log (ecrm1000.pk) which is the source of the problem.
Install the cm-super package (large package, can take some time and in miktex you will perhaps have to call updmap after the installation to activate the map-file) and then try again.
Give package kpfonts a shot, it looks similar to mathpazo but is more recent. (Credit to Michael Palmer)