[Tex/LaTex] cref multiple labels don’t grab the label type

cleverefcross-referencing

I have a strange situation where cref is working great for single labels, i.e. \cref{eq:some equation} and for the first two multiple references of the form \cref{thm:first theorem,thm:second theorem,thm:amazing third theorem} works perfectly, and then after that multiple references get printed with the right numbers but the no type, e.g. instead of

theorems 3.4 and 3.6

It'll print

?? 3.4?? 3.6

This happens both with same type labels (e.g. all theorems) and mixed type (e.g. one lemma and one theorem). I've crefed each item individually and it picks up the type. I've tried doubling the comma, making sure there is no space, recompiling many many times etc. Nothing fixes this.

MWE:

\documentclass{article}
\usepackage{cleveref}
\newtheorem{claim}{Claim}
\begin{document}

\begin{claim} \label{b}
\end{claim}
\begin{claim} \label{c}
\end{claim}

\cref{b} % claim 1
\cref{c} % claim 2
\cref{b,c} % ?? 1?? 2

\end{document}

Best Answer

The package cleveref predefines some common tags such as

equation, figure, page, table, part, chapter, section, appendix, footnote, theorem, lemma, corollary

and some others, but it can't know in advance all the tags users want to use for their environments. The package will guess the singular form from the counter's name, but it doesn't try to build the plural form. So when the

\cref reference format for label type xyz

warning appears, it's time to help the package and define the tag. So add

\crefname{claim}{claim}{claims}

to your document preamble after the \newtheorem line. There's also \Crefname for defining the capitalized forms, but the package is normally able to guess them from the lowercase forms.

Related Question