Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

When I use \schemeref and \schemerefsub, instead of 1 and 2a 2b I get 1 and 1a 1b. So my subnumbering doesn't seem to follow my regular numbering, but when I refer to the compounds I get 1 and then, instead of 1a, 1b, 2 and 3. How can I get my subnumbering to follow my regular numbering and how to refer correctly to subnumbers?

\documentclass[11pt, a4paper]{article}                  

\usepackage{bpchem}
\usepackage[crop={off},runs={2}]{auto-pst-pdf} % Use EPS graphics with pdfLaTeX
\usepackage[tracking=bpchem]{chemstyle}

\usepackage{amstext} \usepackage{caption} \usepackage{kvoptions} \usepackage{psfrag}
\usepackage{varioref} \usepackage{floatrow} 

\begin{document}
%\immediate
%\write18{dir > listing}
%\IfFileExists{listing}{\message{\string\write18 ENABLED}}


\begin{figure}[h]
\schemeref[TM]{mainA}
\includegraphics[scale=0.8]{epsfigx}
\end{figure}

\begin{figure}[h]
 \schemeref[TMP]{mainB}
 \includegraphics[scale=0.8]{epsfigxx}
 \end{figure}

\begin{figure}[h]
\schemerefsub[TMP1]{mainB}{a}
\schemerefsub[TMP2]{mainB}{b}
\schemerefsub[TMP3]{mainC}{aa}      
\includegraphics[scale=0.8]{epsfigy}
\end{figure}

\compound{mainA}
\compound{mainB}
\compound{a}
\compound{b}
\compound{aa}

\end{document}
share|improve this question
1  
Your arguments seem to be reversed: I assume that a is the main reference and that et is a sub-reference, in which case you want \schemerefsub{a}{et}. –  Joseph Wright Jan 25 '12 at 22:05
    
Not really. The output I want is the first figure to labelled 1, then I have a figure with three structures and I want to label them 2a, 2b and 3a but instead of that, my numbering starts over with 1a 1b and 2a. And when I refer to \schemerefsub[TMP1]{et}{b} with \compound{b}, instead of 1b i get 3? –  ewoutr Jan 26 '12 at 19:27
    
As I said, you seem to have the arguments backward. It's \schemeref{<main>}{<sub>}, so for example if \schemeref{b}{et} gives '1b', then \schemeref{b} will give '1'. –  Joseph Wright Jan 26 '12 at 21:44
    
Thank you for your reply, but I've editted my script above to make my question more clearly: so the output I wish to achieve is the figures to be numbered 1, 2, 2a 2b and 3a but instead I get 1 2 1a 1b and 2a. And when I try to refer to for example 1a in the text i never get the subnumber? –  ewoutr Jan 27 '12 at 19:04

1 Answer 1

up vote 2 down vote accepted

You are mixing two methods of numbering. You tell chemstyle to use bpchem but in the document you're using \compound which is the chemcompounds command. You should use the bpchem commands \CNlabel{<cpd>}, \CNref{<cpd>},\CNlabelsub{<cpd>}{<sub>} and \CNrefsub{<cpd>}{<sub>}.

Using these command the right way should clear most of the wrong numbers!

However, I also found a wrong numbering using this code: With version 2.0l of the chemstyle package (2012-01-28) this works as expected:

\documentclass{article}
\usepackage[runs=2]{auto-pst-pdf}
\usepackage{bpchem}
\usepackage[tracking=bpchem]{chemstyle}

\begin{document}
Compound 1a: \CNlabelsub{cpdA}{one}
Compound 2: \CNlabel{cpdB}

\begin{scheme}[h]
 \schemerefsub[TMP1]{cpdA}{one} % gives 1a
 \schemeref[TMP2]{cpdB}         % gives 2
 \includegraphics{scheme-tmp}
\end{scheme}

\end{document}

Version <2.0l needed

\makeatletter
\let\cst@ref@label\CNlabel
\makeatother 

added to the preamble to fix wrong numbering.

An alternative would be to switch to the chemnum package for the numbering and use the commands \cmpd or \cmpdref, resp.

\documentclass{article}
\usepackage[runs=2]{auto-pst-pdf}
\usepackage{chemnum,chemstyle}
\cmpdsetup{sub-input-sep=!}
\begin{document}
Compound 1a: \cmpd{cpdA!one}
Compound 2: \cmpd{cpdB}

\begin{scheme}[h]
 \cmpdref{cpdA!one} % gives 1a
 \cmpdref{cpdB}     % gives 2
 \includegraphics{scheme-tmp}
\end{scheme}

\end{document}
share|improve this answer
    
Indeed that fixes everything. Thanks a lot! –  ewoutr Jan 28 '12 at 19:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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