2

I wanted to use the alphabetic counter just for a scheme in my thesis. I get a double letter counter.

\documentclass[12 pt,a4 paper,oneside,openright,titlepage]{book}

\usepackage{chemnum}
\usepackage{upgreek}
\usepackage{chemmacros} 
\chemsetup{modules={spectroscopy,scheme,units}}

\begin{document}
\begin{scheme}[H]
    \centering
    \replacecmpd[TMP1, counter-format=alph]{general-thiazol}
    \replacecmpd[TMP2, counter-format=alph]{general-thiocarb}
    \replacecmpd[TMP3, counter-format=alph]{general-brom}
    \replacecmpd[TMP4, counter-format=alph]{general-ketone1}
    \includegraphics[scale=0.8]{ChemDraw/eps/Retrosintesi-tiazoli}
    \caption{Proposed retrosynthetic approach for the synthesis of thiazoles derivatives.}
    \label{retrosintesi tiazoli}
\end{scheme}
\end{document}

That's what I get: enter image description here

Is there a way to have a single letter counter (just a, b, c, etc)?

1

With the MWE you provided, the issue you describe is not reproducible. (I have added the float as well as the auto-pst-pdf package and used a .eps file that only contains the four TMP tags.) Instead I get the following output where the compounds are numbered using a single letter and starting from a.

enter image description here

\documentclass[12 pt,a4 paper,oneside,openright,titlepage]{book}

\usepackage{float}
\usepackage{chemnum}
\usepackage{upgreek}
\usepackage{chemmacros} 
\chemsetup{modules={spectroscopy,scheme,units}}
\usepackage{auto-pst-pdf}
\begin{document}

\begin{scheme}[H]
    \centering
    \replacecmpd[TMP1, counter-format=alph]{general-thiazol}
    \replacecmpd[TMP2, counter-format=alph]{general-thiocarb}
    \replacecmpd[TMP3, counter-format=alph]{general-brom}
    \replacecmpd[TMP4, counter-format=alph]{general-ketone1}
    \includegraphics[scale=0.8]{scheme-example}
    \caption{Proposed retrosynthetic approach for the synthesis of thiazoles derivatives.}
    \label{retrosintesi tiazoli}
\end{scheme}

\end{document}

If one adds one (or more) \cmpd commands in the text before (and also after) the scheme we can see what most likely has caused your compounds to be numbered using two letters. Instead of the expected numbering scheme 1, 2, 3, a, b, c, d, 4 we get 1, 2, 3, d, e, f, g, 8. As you can see, the counter-format=alph option does only change the appearance of the counter while it does not affect (reset) its value.

enter image description here

\documentclass[12 pt,a4 paper,oneside,openright,titlepage]{book}

\usepackage{float}
\usepackage{chemnum}
\usepackage{upgreek}
\usepackage{chemmacros} 
\chemsetup{modules={spectroscopy,scheme,units}}
\usepackage{auto-pst-pdf}
\begin{document}

\cmpd{test}
\cmpd{test2}
\cmpd{test3}


\begin{scheme}[H]
    \centering
    \replacecmpd[TMP1, counter-format=alph]{general-thiazol}
    \replacecmpd[TMP2, counter-format=alph]{general-thiocarb}
    \replacecmpd[TMP3, counter-format=alph]{general-brom}
    \replacecmpd[TMP4, counter-format=alph]{general-ketone1}
    \includegraphics[scale=0.8]{scheme-example}
    \caption{Proposed retrosynthetic approach for the synthesis of thiazoles derivatives.}
    \label{retrosintesi tiazoli}
\end{scheme}

\cmpd{test4}
\end{document}

To overcome this, we can store the current value of the counter, locally reset it to zero, change the appearance and later change back to the previously stored counter as demonstrated in the following MWE which results in the desired numbering scheme:

enter image description here

\documentclass[12 pt,a4 paper,oneside,openright,titlepage]{book}

\usepackage{float}
\usepackage{chemnum}
\usepackage{upgreek}
\usepackage{chemmacros} 
\chemsetup{modules={spectroscopy,scheme,units}}
\usepackage{auto-pst-pdf}
\begin{document}

\cmpd{test}
\cmpd{test2}
\cmpd{test3}


\begin{scheme}[H]
 \newcounter{compoundnumber}                   % <-------------
 \setcounter{compoundnumber}{\value{cmpdmain}} % <-------------
 \setchemnum{counter-format=alph}              % <-------------
 \setcounter{cmpdmain}{0}
    \centering
    \replacecmpd{general-thiazol}
    \replacecmpd{general-thiocarb}
    \replacecmpd{general-brom}
    \replacecmpd{general-ketone1}
    \includegraphics[scale=0.8]{scheme-example}
    \caption{Proposed retrosynthetic approach for the synthesis of thiazoles derivatives.}
    \label{retrosintesi tiazoli}
  \setcounter{cmpdmain}{\value{compoundnumber}}% <-------------
\end{scheme}

\cmpd{test4}
\end{document}

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.