# chemnum - expand the replaced label by a few characters

I would like to label a compound like this, in my chemdraw file:

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}


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:

\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}

• Thank you. This is looking good. 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 Aug 8, 2020 at 14:19