8

This example doesn't work with the latest version of cleveref.

The line Refer to \crefrange{eqa}{eqc}. gives the output:

Refer to ?? 1–3.

It used to work before.

Can anyone explain how to fix it?

\documentclass{article}

\usepackage{amsmath,cleveref}

\begin{document}

\begin{subequations}
\label{eqa}
\begin{align}
a &= b\\
c &= d
\end{align}
\end{subequations}

\begin{subequations}
\label{eqba}
\begin{align}
e &= f\\
g &= h
\end{align}
\end{subequations}

\begin{equation}
\label{eqc}
i = j
\end{equation}

Refer to \crefrange{eqa}{eqc}.

\end{document}
7
  • I get it right. Did you compile at least twice? – user11232 Jan 15 '14 at 1:58
  • Yes I ran it twice but keep getting the LaTeX Warning: References eqa' and eqc' in reference range on page 1 have different types subequation' and equation' on input line 28. – user41974 Jan 15 '14 at 2:11
  • Some thing else is going on. With your code above I get Refer to eqs. (1) to (3). – user11232 Jan 15 '14 at 2:12
  • Im running Miktex 2.9. What are you running? – user41974 Jan 15 '14 at 2:16
  • 2
    I can confirm the bad behavior; in version 0.19 a modification to the management of subequations has been done, which apparently broke the functionality. – egreg Jan 15 '14 at 7:44
4

(Answer based on this post and @egreg's comment that the subequations environment management has changed.)

You can force the top-level label of the subequations environment to be treated as an equations-environment label through an optional argument to \label:

\begin{subequations}
\label[equation]{eqlabel}
[...]
\end{subequations}

Your MWE would look like this (extra sub-equation labels added to show this does not affect the top-level label behaviour):

\documentclass{article}

\usepackage{amsmath,cleveref}

\begin{document}

\begin{subequations}
\label[equation]{eqa}
\begin{align}
\label{subeqa1}
a &= b \\
\label{subeqa2}
c &= d
\end{align}
\end{subequations}

\begin{subequations}
\label[equation]{eqb}
\begin{align}
\label{subeqb1}
e &= f \\
\label{subeqb2}
g &= h
\end{align}
\end{subequations}

\begin{equation}
\label{eqc}
i = j
\end{equation}

Refer to \crefrange{eqa}{eqc}.

\end{document}

EDIT: The downside

It appears that labels declared as \label[equation]{...} are overlooked by RefTeX. This makes it a little less convenient to add references to top-level labels of a set of sub-equations if one is used to using RefTeX. I imagine there should be a simple way to fix this, but I do not know how.

1

I faced the same problem with version 0.19 of cleveref (see the above comment by egreg). I fixed this behaviour by

\crefalias{subequation}{equation}

in the preamble.

(Please drop a comment if this fix is somehow dirty or should be avoided)

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.