2

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.

  • It looks like this question might have been asked before, with no success: https://tex.stackexchange.com/q/496998/242024 – Filip Sufitchi May 13 '21 at 01:52
  • I reported that bug last year but got no answer. – Ulrike Fischer May 13 '21 at 07:06
  • @UlrikeFischer Did you receive any answer since you commented? I am also meeting this issue (better described, as far as it appears to me, at https://tex.stackexchange.com/q/496998/105447). I'll probably write him too since it is pretty bad (no compilation warning, no log info, just square wrong output...). – gusbrs Jul 01 '21 at 19:33
  • @gusbrs no, I didn't year anything. – Ulrike Fischer Jul 01 '21 at 20:36
  • @UlrikeFischer Thanks for answering. I have written to Toby too, at least he is thus able to assess affected users. Let's hope he eventually gets to it, since this really lets the package in a tight spot... If the thing is two years old (as the other question shows), having to control for this kind of silent failure makes me weary in using it at all. – gusbrs Jul 01 '21 at 20:49
  • @UlrikeFischer I've been digging 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
  • @gusbrs I'm not much using cleveref. I would suggest that you ask a question showing the bug and your fix and ask if it looks right. – Ulrike Fischer Jul 02 '21 at 15:16
  • @UlrikeFischer Ok, thanks! I'll do it soon. – gusbrs Jul 02 '21 at 15:23
  • @UlrikeFischer Done! At https://tex.stackexchange.com/q/603514/105447 . – gusbrs Jul 02 '21 at 17:02

0 Answers0