# Using achemso package, can't reference equations with \label and \ref

I have a manuscript in preparation with achemso class and package. I have equations in the equation environment, with \label and \ref used to automatically reference them in the text. This was working fine, along with labels in figures, schemes and tables, until yesterday when I updated the achemso, cleveref, hyperref packages. Now the references to figures, schemes and tables still works fine, but when I try to use it with my equations, I get ?? in the text no matter how many times I compile, even if I trash the aux files and start over.

Here is what I think the relevant error message is from the log file/console output:

LaTeX Warning: Reference eq:structprop' on page 1 undefined on input line 38.
[1{/usr/local/texlive/2011/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./minimalexample.aux)
LaTeX Warning: There were undefined references.


and here is a minimal working example:

\documentclass[journal=jacsat,manuscript=article,layout=traditional]{achemso}

\setkeys{acs}{maxauthors=0}

\usepackage[version=3]{mhchem}

\title{title}

\author{some guy}

\email{someguy@someplace.somedomain}

\affiliation{some place}

\begin{document}

\section{Introduction}

some introductory text

$$\label{eq:structprop} \delta_{g\to e^{\prime}}\propto\frac{M_{ge}^{2}M_{ee^{\prime}}^{2}}{(E_{ge}-\hbar\omega)^{2}\Gamma_{ge^{\prime}}}$$

In \ref{eq:structprop}, $M$ represents a blah blah blah.

\end{document}


I hope this is sufficient information to help anyone kind enough to help me. If not I would be glad to add other information that could help. I note that if I just use the book class without achemso, I can get references to numbered equations to work right, this is why I think there is something specific about achemso that results in what I see.

EDIT

I have checked out my problem on both my PC at work and my Mac at home. I get the same problem, even when removing unnecessary line breaks in the equation environment.

I saw Joseph Wright's comment, so I ran \listfiles (results pasted below). I also saw his last comment, so I checked my package versions and those are all the ones that I have.

My hunch is that the issue lies with the new version of cleveref, since I was able to get \ref to work with equations before I updated cleveref, but not after, regardless of which version of achemso I was using. I could of course be wrong on that. I'll be happy to help if I can, but I don't know what else I can do from here. For now I'll try to go back to an earlier version of cleveref, if I can find one; otherwise I may just put equations within a user defined float and see if I can make it work like that.

Thanks to everyone who has responded and helped.

\listfiles result (from PC, using MiKTeX):

 *File List*
achemso.cls    2011/12/30 v3.5k Submission to ACS journals
article.cls    2007/10/19 v1.4h Standard LaTeX document class
size12.clo    2007/10/19 v1.4h Standard LaTeX file (size option)
xkeyval.sty    2008/08/13 v2.6a package option processing (HA)
xkeyval.tex    2008/08/13 v2.6a key=value parser (HA)
mciteplus.sty    2008/09/30 v1.1 enhanced mcite
fontenc.sty
t1enc.def    2005/09/27 v1.99g Standard LaTeX file
geometry.sty    2002/07/08 v3.2 Page Geometry
geometry.cfg
helvet.sty    2005/04/12 PSNFSS-v9.2a (WaS)
caption.sty    2011/11/10 v3.2e Customizing captions (AR)
caption3.sty    2011/11/01 v1.4a caption3 kernel (AR)
courier.sty    2005/04/12 PSNFSS-v9.2a (WaS)
float.sty    2001/11/08 v1.3d Float enhancements (AL)
graphicx.sty    1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty    2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
trig.sty    1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg    2007/01/18 v1.5 graphics configuration of teTeX/TeXLive
pdftex.def    2011/05/27 v0.06d Graphics/color for pdfTeX
infwarerr.sty    2010/04/08 v1.3 Providing info/warning/message (HO)
ltxcmds.sty    2011/04/18 v1.20 LaTeX kernel commands for general use (HO)
mathptmx.sty    2005/04/12 PSNFSS-v9.2a Times w/ Math, improved (SPQR, WaS)
setspace.sty    2011/12/19 v6.7a set line spacing
url.sty    2006/04/12  ver 3.3  Verb mode for urls, etc.
cleveref.sty    2011/12/24{} v0.18.1{} Intelligent cross-referencing
jacsat.cfg    2011/12/30 v3.5k achemso configuration: J. Am. Chem. Soc.
natbib.sty    2010/09/13 8.31b (PWD, AO)
natmove.sty    2010/01/15 v1.1a Automatic citation moving with natbib
mhchem.sty    2011/06/03 v3.11 for typesetting chemical formulae
ifthen.sty    2001/05/26 v1.1c Standard LaTeX ifthen package (DPC)
calc.sty    2007/08/22 v4.3 Infix arithmetic (KKT,FJ)
twoopt.sty    2008/08/11 v1.5 Definitions with two optional arguments (HO)
amsmath.sty    2000/07/18 v2.13 AMS math features
amstext.sty    2000/06/29 v2.01
amsgen.sty    1999/11/30 v2.0
amsbsy.sty    1999/11/29 v1.2d
amsopn.sty    1999/12/14 v2.01 operator names
t1ptm.fd    2001/06/04 font definitions for T1/ptm.
t1phv.fd    2001/06/04 scalable font definitions for T1/phv.
ot1ztmcm.fd    2000/01/03 Fontinst v1.801 font definitions for OT1/ztmcm.
omlztmcm.fd    2000/01/03 Fontinst v1.801 font definitions for OML/ztmcm.
omsztmcm.fd    2000/01/03 Fontinst v1.801 font definitions for OMS/ztmcm.
omxztmcm.fd    2000/01/03 Fontinst v1.801 font definitions for OMX/ztmcm.
ot1ptm.fd    2001/06/04 font definitions for OT1/ptm.


END EDIT

-
This works for me with the example give: could you add \listfiles to your log and include the result here? – Joseph Wright Jan 10 '12 at 16:15
Note, this is a warning rather than an error. – qubyte Jan 10 '12 at 16:19
Thanks all. Won't be able to do \listfiles until I'm back home tonight. Will do it then and post results here. I guess I'll edit the question above. – Nisan Siegel Jan 10 '12 at 17:33
You should obtain error messages with this example due to the fact that the math environment doesn't like blank lines. It works for me without blank lines in the equation environment. – Thorsten Donig Jan 10 '12 at 17:38
Thanks, Thorsten - in my "real" document I have no blank lines in the equations. But I'll run this example both ways and with the suggestion above to see if I can find/fix my problem. – Nisan Siegel Jan 10 '12 at 18:26

The problem comes down to a change in cleveref, which now seems to have a load order requirement with amsmath which was not previously the case. With the minimal example

\documentclass{article}
\usepackage{cleveref}
\usepackage{amsmath}

\begin{document}

$$\label{eq:structprop} a$$

\cref{eq:structprop}

\end{document}


The issue is visible with the current cleveref release, but did not occur previously.

-
I will need to think about a bug fix for this: it's not so easy! – Joseph Wright Jan 11 '12 at 21:39
Thanks, Joseph, nice to see my hunch validated. I did post a workaround in a comment on the original question, that has worked for me so far. As for a real fix, I'm sure you've already thought of this, but can the achemso.cls simply be altered to load amsmath first, or whatever the order needs to be? Anyway, the achemso package has been great to use, and thanks for all your work on it! – Nisan Siegel Jan 11 '12 at 21:47
I have a fix in mind, but need to consult with the ACS about it. I have e-mailed, and will update here again once I have an answer. – Joseph Wright Jan 11 '12 at 21:49

I suggest to use \plainref for a moment. \ref in achemso has been shaped to refer tables and figures.

-
I too am having this problem, and I'm glad it's not just me. Has there been any updates on this? I can confirm that \plainref` works fine for now, which is a relief since I'm working on a lab report. – user11277 Jan 30 '12 at 1:52
@JacobSchaer: Thank you for the confirmation and the question regarding updates - I converted it to a comment as it's not really an answer. – Stefan Kottwitz Jan 30 '12 at 9:19

## protected by Community♦Jan 30 '12 at 9:17

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).