1

I'm trying to make use of the \replacecmpd command of the chemnum package in LaTeX in combination with eps files produced by ChemDraw. While this works great for the automatic numbering of chemicals by numbers, it will not let me choose my own label although the CTAN provides an example of how to do this.

  1. The EPS file shows 2 chemical compounds with "TMP1" and "TMP2" underneath them
  2. I can replace them by "1" and "2" using the standard \replacecmpd{X1} command
  3. What I want though, is for LaTeX to write "Compound 1" instad of "1" both in the figure as well as in the text whenever I refer to that compound by \cmpd{X1}.

I'd greatly appreciate any help, thank you guys! :)

Here's my minimal example:

\documentclass[12pt,a4paper,titlepage,twoside,numbers=noenddot,openright,BCOR12mm]{scrreprt} 
\usepackage[utf8]{inputenc}
\usepackage{pdfpages}
\usepackage{graphicx}
\usepackage[crop=off]{auto-pst-pdf} 
\usepackage{chemnum} 
\usepackage{psfrag}


\setchemnum{init,log=verbose} 
\graphicspath{{../EPS/}{../Compounds/}}

\begin{document}

\begin{center}
\begin{minipage}{\linewidth}
\centering
\replacecmpd[tag=Compound1]{X1}
\replacecmpd[tag=Compound2]{X2}
\includegraphics{Compounds.eps}
\end{minipage}
\end{center}

\end{document}

edit: I also noticed that I cannot reproduce the example provided in the CTAN manual about chemnum. Any ideas why that might be the case?

cgnieder
  • 66,645
  • Do you have an updated TeX distribution? – TeXnician Jul 17 '17 at 16:42
  • I'm using Texmaker 3.5.2 – Tobias Köngeter Jul 17 '17 at 16:56
  • TeX distribution means MikTeX or TeX Live (or MacTeX or similar). That needs to be up-to-date. – TeXnician Jul 17 '17 at 16:58
  • I believe you misunderstood what tag means. That is not what the command writes but what it replaces! – cgnieder Jul 17 '17 at 17:16
  • http://vesta.informatik.rwth-aachen.de/ftp/pub/mirror/ctan/macros/latex/contrib/chemnum/chemnum_en.pdf On page 21 of that manual, the exact same command line is used to name the compounds "blah" and "blub". – Tobias Köngeter Jul 17 '17 at 17:22
  • Servus Clemens, hab gerade erst gesehen, dass du die Antwort geschrieben hast. Vielleicht kann ich es auf Deutsch besser erklären. Und zwar möchte ich, dass LaTeX meine Tags nicht durch Zahlen automatisch durchnummeriert, sondern sie durch Namen ersetzt, die ich bestimmte. Im Prinzip genau so, wie es im Manual auf Seite 21 beschrieben ist. – Tobias Köngeter Jul 17 '17 at 17:25
  • @Tobias I understood you. But you misunderstood the manual! The example decribes how blah can be replaced by the number... I guess you want to use psfrag directly – cgnieder Jul 17 '17 at 17:41
  • Oh, okay :( The way I read the manual was that I could replace TMP1 by some name and at the same time refer to it by its label. That would be really convenient. – Tobias Köngeter Jul 17 '17 at 17:46

1 Answers1

1

If I understood you correctly you simply want something like

\setchemnum{format = compound \bfseries}

Example:

% arara: pdflatex: { shell: on , action: nonstopmode }
\documentclass{article}
\usepackage{graphicx,auto-pst-pdf}
\usepackage{chemnum}
\usepackage{chemmacros}
\chemsetup{
  modules = {scheme}
}
\setchemnum{
  format = compound \bfseries
}

\begin{document}

\cmpd{EtherBr}

\begin{scheme}
  \replacecmpd{Alc}% replaces TMP1
  \replacecmpd{EtherBr}% replaces TMP2
  \includegraphics{scheme-tmp.ps}
\end{scheme}

\end{document}

enter image description here

cgnieder
  • 66,645
  • First of all, thanks for taking the time trying to find a solution to my problem. I'm afraid though that this is not what I had in mind, I should have probably picked a different example. What I had in mind was giving them abreviated names such as (Pt-BOPIDY) for a BODIPY platinum complex. In the meantime I followed your initial advice and used psfrag directly to substitute the TMP1 in my eps files. Might be an interesting thought though for future improvement of chemnum: Being able to give them names and refer to them by a simple label. Anyway, thanks again, have a great day! :) – Tobias Köngeter Jul 19 '17 at 10:17
  • @TobiasKöngeter so you're actually looking for https://tex.stackexchange.com/a/170196/ ? In that case I'll delete my answer we'll close this one as duplicate – cgnieder Jul 19 '17 at 10:26