10

cleveref is one of my favorite packages, and indeed, many of my own packages (cleveref-forward, crefthe, create-theorem) and classes (minimalist, colorist) depend in a fundamental way on cleveref.

However, it was last updated more than 5 years ago, and since then a lot have happened in the world of LaTeX. And I remember having seen patches to cleveref in many different places (but unfortunately I didn't take note on them; one could see some of these by viewing at those questions with tag "cleveref"). As a package maintainer, I am concerned about this situation (when I started to write my first package in 2021, this didn't seem to be quite a problem, but now one has to face the possibility that cleveref may no longer be maintained). For example, just recently I have added to one package a patch given by Ulrike Fischer in this answer.

Is there thus, to your knowledge, a collected list of known issues (and hopefully also recommended solutions) and known improvements to cleveref as for now? And for those newly coming users, is it still okay to use cleveref in their daily documents? And in case not, is there perhaps any alternative choice as for now?

Jinwen
  • 8,518
  • Ulrike Fischer is probably the best placed person to answer this. If I recall correctly, she was able to contact Toby Cubitt in the not too distant past. My direct experience in trying to report a problem and a fix for it (at https://tex.stackexchange.com/q/603514/105447) was "no answer and no fix". I have been keeping tabs on things that show up here on the site, but not for long, so probably incomplete, but I'm not sure how useful it would be in this context. – gusbrs Feb 24 '24 at 20:23
  • @gusbrs Ah, thank you for mentioning this! By the way, are you the developer of zref-clever? This is such a nice work! Sadly I didn't notice it when I wrote create-theorem, otherwise I would probably use zref-clever as its base package from the beginning. – Jinwen Feb 24 '24 at 20:41
  • JInwen, yes I am. Thanks. :-) Do note though, in considering it as an alternative, that zref-clever is an experimental package, in its early days. It should work well, but it may or may not meet your stability requirements. You may find this thread of interest: https://github.com/gusbrs/zref-clever/issues/9 – gusbrs Feb 24 '24 at 20:52
  • @gusbrs Thank you! It seems stable enough so on users' side they don't need to change much, but for me there are a lot of rewrite to do. I would probably begin by building a configuration interface similar to your \zcLanguageSetup and convert my old naming configuration into this form, and then add support to zref-clever. This way, the traditional \cref and the new \zcref can be coexisted, and the users can decide which to use in their documents. (To be frank, trying to make German declensions work with cleveref was a struggle for me and I really don't want that effort to be wasted.) – Jinwen Feb 24 '24 at 21:16
  • Regarding "It seems stable enough so on users' side they don't need to change much", it is not about what "it seems". I consider the package as not settled and warn users prominently about it, the User manual included. If I'm telling you that, you should believe me. ;-) – gusbrs Feb 24 '24 at 21:30
  • 1
    @gusbrs yes good luck with that, compare the note on page one of texdoc afterpage with the number of times users expect that package to do something vaguely useful. – David Carlisle Feb 24 '24 at 22:50
  • @DavidCarlisle Well, I am trying to manage expectations... That's all I can really do. ;-) – gusbrs Feb 24 '24 at 23:11
  • @Jinwen I think this is the comment I recalled: https://chat.stackexchange.com/transcript/message/59509458#59509458 – gusbrs Feb 25 '24 at 10:08
  • 2
    Only the maintainer can give a definite answer about the status and some time frame, so you will have to write him directly. Currently my doubts outweigh hope, but who knows ... – Ulrike Fischer Mar 06 '24 at 14:38
  • 1
    Thanks for putting effort into the topic, +1. – Dr. Manuel Kuehner Mar 07 '24 at 23:22

1 Answers1

3

Below are some known fixes to cleveref. Currently these fixes have been included in the package cleveref-forward, hopefully one day they can make their way into the original package cleveref.

% Fix for cleveref in order to work with long range of pages
% See https://tex.stackexchange.com/a/620066
\providecommand*{\@setcpagerefrange}[3]{%
    \@@setcpagerefrange{#1}{#2}{cref}{#3}}
\providecommand*{\@setCpagerefrange}[3]{%
    \@@setcpagerefrange{#1}{#2}{Cref}{#3}}
\providecommand*{\@setlabelcpagerefrange}[3]{%
    \@@setcpagerefrange{#1}{#2}{labelcref}{#3}}
% Fix for cleveref in order to work with xr-hyper
% See https://tex.stackexchange.com/a/708445
\def\cref@getref#1#2{%
  \expandafter\let\expandafter#2\csname r@#1@cref\endcsname%
  \expandafter\expandafter\expandafter\def%
    \expandafter\expandafter\expandafter#2%
    \expandafter\expandafter\expandafter{%
      \expandafter\@firstoffive#2}}% <-------- five
\def\cpageref@getref#1#2{%
  \expandafter\let\expandafter#2\csname r@#1@cref\endcsname%
  \expandafter\expandafter\expandafter\def%
    \expandafter\expandafter\expandafter#2%
    \expandafter\expandafter\expandafter{%
      \expandafter\@secondoffive#2}}% <----------- five
\AtBeginDocument{%
  \def\label@noarg#1{%
    \cref@old@label{#1}%
    \@bsphack%
    \edef\@tempa{{page}{\the\c@page}}%
    \setcounter{page}{1}%
    \edef\@tempb{\thepage}%
    \expandafter\setcounter\@tempa%
    \cref@constructprefix{page}{\cref@result}%
    \protected@write\@auxout{}%
      {\string\newlabel{#1@cref}{{\cref@currentlabel}%
      {[\@tempb][\arabic{page}][\cref@result]\thepage}{}{}{}}}% <----- five
    \@esphack}%
  \def\label@optarg[#1]#2{%
    \cref@old@label{#2}%
    \@bsphack%
    \edef\@tempa{{page}{\the\c@page}}%
    \setcounter{page}{1}%
    \edef\@tempb{\thepage}%
    \expandafter\setcounter\@tempa%
    \cref@constructprefix{page}{\cref@result}%
    \protected@edef\cref@currentlabel{%
      \expandafter\cref@override@label@type%
        \cref@currentlabel\@nil{#1}}%
    \protected@write\@auxout{}%
      {\string\newlabel{#2@cref}{{\cref@currentlabel}%
      {[\@tempb][\arabic{page}][\cref@result]\thepage}{}{}{}}}% <------- five
    \@esphack}%
}
Jinwen
  • 8,518