19

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}
5
  • Well without an MWE, it is hard for us to reproduce your problem. A hint on producing the MWE: Make a copy of your current project. In the copy, start deleting stuff while rechecking that the problem still exists. At some point you cannot remove more. And that will be the MWE. During this process you will often pin down the actual problem your self. So the process is a vital debugging tool.
    – daleif
    Commented Nov 14, 2014 at 11:10
  • @daleif, done..
    – bjorne
    Commented Nov 14, 2014 at 11:16
  • 2
    Add \crefname{claim}{claim}{claims} after the \newtheorem line.
    – egreg
    Commented Nov 14, 2014 at 11:46
  • @egreg, thanks. That fixed it and kind of makes sense (if it knows the label type it should either default to using it and pluralising with an 's', or come up with ?? for single cases, not mix the two). I think you should write that up as an answer.
    – bjorne
    Commented Nov 14, 2014 at 12:35
  • Another easy mistake to make is to put a space there by accident, like \cref{b, c}, this will also stop it from working.
    – Dylan Dijk
    Commented Apr 10 at 15:54

1 Answer 1

19

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.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .