4

In a particular document, align labels are only recognised as being the first character of the specified label, with the remainder being printed as text.

Here is a MWE:

\documentclass{article}
\usepackage{amsmath} % provides the align environment
\usepackage{autonum} % Only number referenced equations
\usepackage[backend=biber,url=false,doi=false,style=authoryear]{biblatex}
\usepackage{booktabs} % nicer tables, provides toprule midrule etc
\usepackage[noabbrev]{cleveref} % provides the cref command
\usepackage{dcolumn} % for stargazer R tables
\usepackage{graphicx} % for pdf images
\usepackage[utf8]{inputenc} % Allow non-ascii characters in .bib file
\usepackage[autolanguage]{numprint} % For rounding numbers in tabulars. Provides num command
\usepackage{rotating} % provides sideways table environment
\usepackage[group-separator={,},
    group-minimum-digits = 4]  % default is 5
    {siunitx} % Adds the S column type. Provides num command
\usepackage{subfig} % For side-by-side tables

\begin{document}

%--------------------------------------------------------------
\section{Introduction}
%--------------------------------------------------------------
Here's an equation:

\begin{align}\label{eqn:first}
    f^{(1)}_{ij} = \frac{f^{(0)}_{ij} O_i}{\sum\limits_k f_{ik}}
\end{align}

In \cref{eqn:first} lots of stuff happens. Here's another:
\begin{align}\label{eqn:second}
    f^{(2)}_{ij}
    = \frac{f^{(1)}_{ij} D_j}{\sum\limits_k f^{(1)}_{kj}}
    = \frac{O_i D_j}{\sum\limits_k O_k}
\end{align}

\end{document}

Which results in: Align label misinterpreted

The label is being read as being the character e only, as shown by this excerpt from the .aux file:

\newlabel{e}{{1}{1}}
\newlabel{e@cref}{{[equation][1][]1}{1}}

It must have something to do with the preamble (which is why I've included it in the MWE) but what?

  • @ChristianHupfer that doesn't seem to be the problem. Moving the label to after the equation doesn't change anything. – LondonRob Jun 11 '15 at 14:30
  • @ChristianHupfer and having cleveref loaded last makes no difference either. – LondonRob Jun 11 '15 at 14:31
  • 4
    It is package autonum that kicks the label in the butt. – Johannes_B Jun 11 '15 at 14:32
  • A small side note: I don't think that it's a good idea to only number equations which are referenced. Perhaps another one citing your document would rather refer to another equation which is numbered then. This could be confusing – user31729 Jun 11 '15 at 14:42
  • @ChristianHupfer It's odd, but some journals have this as a submission requirement. – LondonRob Jun 11 '15 at 14:55
2

Apparently autonum must be included even after cleveref and in my impression, the document must be compiled thrice to get all the references working.

The manual clearly says

enter image description here

\documentclass{article}
\usepackage{amsmath} % provides the align environment
%
\usepackage[backend=biber,url=false,doi=false,style=authoryear]{biblatex}
\usepackage{booktabs} % nicer tables, provides toprule midrule etc
\usepackage{dcolumn} % for stargazer R tables
\usepackage{graphicx} % for pdf images
\usepackage[utf8]{inputenc} % Allow non-ascii characters in .bib file
\usepackage[autolanguage]{numprint} % For rounding numbers in tabulars. Provides num command
\usepackage{rotating} % provides sideways table environment
\usepackage[group-separator={,},
    group-minimum-digits = 4]  % default is 5
    {siunitx} % Adds the S column type. Provides num command
\usepackage{subfig} % For side-by-side tables

\usepackage[noabbrev]{cleveref} % provides the cref command
\usepackage{autonum} % Only number referenced equations
\begin{document}

%--------------------------------------------------------------
\section{Introduction}
%--------------------------------------------------------------
Here's an equation:

\begin{align}  
    f^{(1)}_{ij} &= \frac{f^{(0)}_{ij} O_i}{\sum\limits_k f_{ik}} \label{eqn:first}
\end{align}

In \cref{eqn:first} lots of stuff happens. Here's another:
\begin{align}
    f^{(2)}_{ij}
    &= \frac{f^{(1)}_{ij} D_j}{\sum\limits_k f^{(1)}_{kj}} \label{eqn:second} \\
    &= \frac{O_i D_j}{\sum\limits_k O_k}
\end{align}

\end{document}

enter image description here

  • This works, and can be summarised as: load autonum after cleveref (as the post now states. Thanks @ChristianHupfer) – LondonRob Jun 11 '15 at 14:32
  • @LondonRob: As I have written at the top of the post ;-) – user31729 Jun 11 '15 at 14:33

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.