I'm trying to write a document with the achemso
package, but my \ref
are not working right. achemso
links to a package called cleveref
, then renames cleveref
's \cref
into \ref
, so any answers for cleveref
should work here.
Example one:
\documentclass[journal=jacsat,layout=traditional]{achemso}
\usepackage{achemso} %loaded last due to clerverRef
\author{Canageek}
\title{Title}
\email{fake@email.ca}
\affiliation[University]{University, Canada}
\begin{document}
\section{Introduction \label{intro}}
blah blah blah blah
\section{two}
Will this work? See~\ref{intro}.
\end{document}
Produces as it's body text:
Introduction
blah blah blah blah
two
Will this work? See Footnote ∗.
Next example, since there is mention of a error with references in section titles in the cleveref
manual.
\documentclass[journal=jacsat,layout=traditional]{achemso}
\usepackage{achemso} %loaded last due to clerverRef
\author{Canageek}
\title{Title}
\email{fake@email.ca}
\affiliation[University]{University, Canada}
\begin{document}
\section{Introduction}
\label{intro}
blah blah blah blah
\section{two}
Will this work? See~\ref{intro}.
\end{document}
This gives the same output as above.
Oddly enough neither produce anything odd that I can find in the .log
file.
\documentclass[journal=jacsat,layout=traditional,hyperref]{achemso}
\usepackage{hyperref}
\usepackage{achemso} %loaded last due to clerverRef
\author{Canageek}
\title{Title}
\email{fake@email.ca}
\affiliation[University]{University, Canada}
\begin{document}
\section{Introduction}
\label{intro}
blah blah blah blah
\section{two}
Will this work? See~\ref{intro}.
\end{document}
Gives a different output: It replaces the *
with a ??
.
The .log
file for this one also has the message
LaTeX Warning: cref reference format for label type `' undefined on input line
17.
Can anyone tell me what I'm doing wrong? I made sure to update my TeX Live install this morning when I had another problem, so everything should be up to date. Oh, and yes, I've made sure to delete everything but the test.tex
file from the folder between compiles.
Best Answer
If you want to cross-reference the sections, they should have a number associated (to be used in cross-referencing) otherwise, the wrong string will be picked up to produce the cross-reference number (in your case, it will be the one created by
\affiliation
which explains why you were getting "Footnote").achemso
uses section numbers only where the journal uses these in print. You can use the\SectionNumbersOn
command to force section numbering; however, if you use section numbers in a submission to a journal which does not use them, things may go a bit wrong later.Your document could be something like this: