#StackBounty: #cleveref Incorrect cpageref result with multiple (3+) references that span a page range

Bounty: 50

I have noticed that using cpageref for more than 2 references fails when the references span more than one page.

Instead of getting the page range, the references that define the page range are printed instead. Instead of page numbers, the reference labels are printed.

This is for version 0.21.4 and the pre-release 0.21.5.

The error is not present when using cref.


Has anyone come across this error before?

I have tried looking into the code, but it is beyond me!

Does anyone else have a fix?


Example:

documentclass[12pt,a4paper]{article}

usepackage{cleveref}

begin{document}

% Figures on the same page
begin{figure}
        caption{Caption Fig. 1}label{fig:fig1}
end{figure}

begin{figure}
    caption{Caption Fig. 2}label{fig:fig2}
end{figure}

begin{figure}
    caption{Caption Fig. 3}label{fig:fig3}
end{figure}

clearpage

% Figure on a different page
begin{figure}
    caption{Caption Fig. 4}label{fig:fig4}
end{figure}

clearpage


section{cref}
% -- These options work as expected --------------------------------------------
noindent F1: cref{fig:fig1} \ 
F2: cref{fig:fig2} \
F3: cref{fig:fig3} \
F4: cref{fig:fig4} \

noindent F1,F2: cref{fig:fig1,fig:fig2} \
F1,F3: cref{fig:fig1,fig:fig3} \
F1,F4: cref{fig:fig1,fig:fig4} \

noindent F1,F2,F3: cref{fig:fig1,fig:fig2,fig:fig3} \
F1,F2,F4: cref{fig:fig1,fig:fig2,fig:fig4} \
F1,F2,F3,F4: cref{fig:fig1,fig:fig2,fig:fig3,fig:fig4} \

section{cpageref}
% -- These options work as expected --------------------------------------------
noindent F1: cpageref{fig:fig1} \ 
F2: cpageref{fig:fig2} \
F3: cpageref{fig:fig3} \
F4: cpageref{fig:fig4} \

noindent F1,F2: cpageref{fig:fig1,fig:fig2} \
F1,F3: cpageref{fig:fig1,fig:fig3} \
F1,F4: cpageref{fig:fig1,fig:fig4} \
noindent F1,F2,F3: cpageref{fig:fig1,fig:fig2,fig:fig3} \

% -- These options do not work as expected -------------------------------------
noindent {Large ERROR:}\
% Output -- F1,F2,F4: fig:fig1fig:fig4
F1,F2,F4: cpageref{fig:fig1,fig:fig2,fig:fig4} \ 
% Output -- F1,F2,F3,F4: fig:fig1fig:fig4
F1,F2,F3,F4: cpageref{fig:fig1,fig:fig2,fig:fig3,fig:fig4} \

end{document}


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.