I am running into problems using \cpageref in cleveref. It seems like if it tries to "compress" pages as part of a 3+ input \cpageref, something goes horribly wrong and it just prints the labels of the first and last inputs. I'm not sure if I have a gross misunderstanding of how \cpageref is supposed to work, or if there's some kind of bug.
Here's a minimal example of what is going on:
\documentclass[12pt]{letter}
\usepackage{cleveref}
\begin{document}
\textbf{Holy Grail \label{hg-1}} \par
\textbf{Life of Brian \label{lob-1}}\par
\newpage
\textbf{This page only references the Holy Grail \label{hg-2}} \par
\newpage
\textbf{This page again references both the Holy Grail \label{hg-3} and the Life of Brian \label{lob-2}} \par
\newpage
\textbf{References} \par
Monty Python and the Holy Grail \ldots{} \cpageref{hg-1,hg-2,hg-3} \par
The Life of Brian \ldots{} \cpageref{lob-1,lob-2} \par
\end{document}
The expectation: the final page would read:
References
Monty Python and the Holy Grail ... pages 1 to 3
The Life of Brian ... pages 1 and 3
What actually happens:
References
Monty Python and the Holy Grail ... hg-1hg-3
The Life of Brian ... pages 1 and 3
I am fairly certain this is a problem with cleveref's consecutive reference compression, because If I disable it (\usepackage[sort]{cleveref}), I get this instead:
References
Monty Python and the Holy Grail ... pages 1, 2 and 3
The Life of Brian ... pages 1 and 3
Is there a workaround or proper way to get the pages 1 to 3 output? Or is this a limitation or bug in cleveref?
Latex engine: MiKTeX-pdfTeX 4.6 (MiKTeX 21.3 Portable)
cleveref version:
\def\packagedate{2018/03/27}
\def\packageversion{0.21.4}
Update: Checked with the latest "pre-release" version (0.21.5) and the behavior is the same.
Version 0.19.1 from Tony Cubitt's site seems to not have this problem.
cleveref.sty, and I think I found the problem and a possible fix. But I'm not sure of it, since my TeX-fu is not really marvelous. Would you care to discuss it? If so, where through? – gusbrs Jul 02 '21 at 14:44