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:
- Use Latin Modern – I would prefer not to, as I like Palatino
- Use a Palatino-like font that has a vector form in T1 – however, I don't know of any such font!
- 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.
kpfonts
a shot, it looks similar tomathpazo
but is more recent.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 similarpxfonts
seems like it might do the job, but lacks some of the features (like old style figures) thatkpfonts
andmathpazo
have.cm-super
and runningupdmap
, it now works perfectly for both Computer Modern and Palatino. Thank you so much.