2

I would like to label a compound like this, in my chemdraw file: enter image description here

Can chemnum replace the TMP in an .eps-file with 1a: M = Ti, n = 2 for example? Here is a similar question, but i would like to expand the replacement by a few characters.

\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\DeclareNewTOC[
type=scheme,
types=schemes,
float,
name=Schema,
listname={Verzeichnis der Schemata}
]{los}
\usepackage[runs=2,crop=off]{auto-pst-pdf}
\usepackage{chemnum}
\setchemnum{format = \bfseries\sffamily}


\begin{document}

\begin{scheme}[htb]
\centering
\replacecmpd{mycompund.a}
\replacecmpd{mycompund.b}
\replacecmpd{mycompund.c}
\includegraphics[width=0.8\textwidth]{xyz}
\caption{My compounds.}
\label{mycompounds}
\end{scheme}
Compound \refcmpd{mycompound.a, mycompound.b, mycompound.c} are my compounds.
\end{document}

1 Answer 1

1

With the help of the \psfrag command from the psfrag package, which in turn is loaded by chemnum you can replace any placeholder text in an .eps file with any other LaTeX command or text:

enter image description here

\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\DeclareNewTOC[
type=scheme,
types=schemes,
float,
name=Schema,
listname={Verzeichnis der Schemata}
]{los}
\usepackage[runs=2,crop=off]{auto-pst-pdf}
\usepackage{chemnum}
\setchemnum{format = \bfseries\sffamily}


\begin{document}
\begin{scheme}[htb]
\centering
\psfrag{TMP1}{\cmpd{mycompound.a}: M = Ti, n = 4}
\psfrag{TMP2}{\cmpd{mycompound.b}: M = Fe, n = 3}
\psfrag{TMP3}{\cmpd{mycompound.c}: M = Sn, n = 4}
\includegraphics{xyz}
\caption{My compounds. The replacement text is left aligned with respect to the placeholder text.}
\label{mycompounds}
\end{scheme}

\begin{scheme}[htb]
\centering
\psfrag{TMP1}[c][l]{\cmpd{mycompound.a}: M = Ti, n = 4}
\psfrag{TMP2}[c][l]{\cmpd{mycompound.b}: M = Fe, n = 3}
\psfrag{TMP3}[c][l]{\cmpd{mycompound.c}: M = Sn, n = 4}
\includegraphics{xyz}
\caption{My compounds. The replacement text is horizontally centered with respect to the placeholder text.}
\label{mycompounds}
\end{scheme}


Compound \cmpd{mycompound.a, mycompound.b, mycompound.c} are my compounds.
\end{document}
2
  • Thank you. This is looking good.
    – Solstafir
    Aug 8, 2020 at 14:18
  • When i combine your example with another scheme, i get wrong numbering in text. I asked a follow up question here
    – Solstafir
    Aug 8, 2020 at 14:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.