3

I have a latex file that exhibits a cleveref/thmtools bug. In short: I have

\cref{problem:5,problem:4,problem:2}

in the file, and I expected to have, in the output

problems 2.1, 2.2, and 1.3.  

Instead, I get

problems  2.1 to 1.3

In other words, cleveref thinks the list of references is an uninterrupted range.

Is there a fix to this or at least a workaround? I'm using some features of thmtools, so I can't have amsthm alone.

A few remarks:

  1. if I comment out the \usepackage{thmtools} line, then I get an acceptable output

    problems 1.3, 2.1, and 2.2

so it's the interplay between thmtools and cleveref that messes things up.

  1. Using the declaretheorem commands don't make a difference.
  2. I have a diff of the aux files: one with thmtools loaded, and the other without thmtools.
  3. I am running pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2014)
  4. The sample file I am giving is pretty much minimal: it's important for the bug that the numbering of the problem and defn environments are by section, and that the two environments share a counter.
2

A simple workaround consists of writing the cross-referencing instruction as

\cref{problem:5,problem:4,,problem:2}

Note the double comma between problem:4 and problem:2. This will give you

Hint: just use problems 2.1, 2.2 and 1.3.

Addendum: If you want a comma in the output after "2.2" and before "and", you'll also need to provide the instruction

\newcommand{\creflastconjunction}{, and~}

(The default setting is not to insert the comma.)

  • 1
    Thank you for the quick answer. I now see that if I use the nosort option to cleveref, I then get the exact output I needed (my post was a bit misleading about this). Indeed, the reason why I wrote \label{problem:5,problem:4,problem:2} was that I wanted the output to be "problems 2.2, 2.1 and 1.3." I wonder why cleveref doesn't work this way by default? – Máté Wierdl Oct 20 '14 at 14:38

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.