latex3 / latex2e

The LaTeX2e kernel
https://www.latex-project.org/
LaTeX Project Public License v1.3c
1.82k stars 251 forks source link

Firstaid for cleveref: not necessarily fully expandable \thepage and a proper German abbreviation for section #1382

Closed AlMa1r closed 2 weeks ago

AlMa1r commented 2 weeks ago

The package cleveref is unfortunately dead since 2018, and the author has not been responsive so far. Therefore, I've been maintaining my own fixes to cleveref. Let me kindly share them and ask you to incorporate them into firstaid. Two problems are addressed: nondefault or formatted page numbers (cf. https://tex.stackexchange.com/questions/613934/strange-incompatibility-between-several-packages-options#comment1533879_613934 and https://tex.stackexchange.com/questions/619875/greekbabel-cleveref-roman-pagenumbering-label#comment1548033_619885) and abbreviating the German name for section, namely, “Abschnitt”, and its plural into “Abschn.” whenever short forms are requested (the long forms are kept as they were, so the user can still choose them if he/she wishes to).

In the following, I provide two diffs: a comparison of my version with the stable version of cleveref and a comparison of my version with the latest version of cleveref (both the stable cleveref and the latest cleveref are quite old). My cleveref.sty version is called my_improved_cleveref.sty below for clarity.

Comparison to the version on CTAN:

$ diff my_improved_cleveref.sty /usr/share/texlive/texmf-dist/tex/latex/cleveref/cleveref.sty
12d11
< %% Improved/hacked by ................, 2024.
15,16c14,15
< \def\packagedate{2021/11/02}
< \def\packageversion{0.21.5.2}
---
> \def\packagedate{2018/03/27}
> \def\packageversion{0.21.4}
76c75
<     \protected@edef\@tempb{\thepage}%
---
>     \edef\@tempb{\thepage}%
88c87
<     \protected@edef\@tempb{\thepage}%
---
>     \edef\@tempb{\thepage}%
4123,4128c4122
< %    \crefname@preamble{section}{Abschnitt}{Abschnitte}%
<     \if@cref@abbrev%
<       \crefname@preamble{section}{Abschn.}{Abschn.}%
<     \else%
<       \crefname@preamble{section}{Abschnitt}{Abschnitte}%
<     \fi%
---
>     \crefname@preamble{section}{Abschnitt}{Abschnitte}%
4205,4222c4199,4201
< %  \crefname{section}{Abschnitt}{Abschnitte}%
<   \if@cref@abbrev%
<     \crefname{section}{Abschn.}{Abschn.}%
<   \else%
<     \crefname{section}{Abschnitt}{Abschnitte}%
<   \fi%
< % \crefname{subsection}{Abschnitt}{Abschnitte}%
<   \if@cref@abbrev%
<     \crefname{subsection}{Abschn.}{Abschn.}%
<   \else%
<     \crefname{subsection}{Abschnitt}{Abschnitte}%
<   \fi%
< %  \crefname{subsubsection}{Abschnitt}{Abschnitte}%
<   \if@cref@abbrev%
<     \crefname{subsubsection}{Abschn.}{Abschn.}%
<   \else%
<     \crefname{subsubsection}{Abschnitt}{Abschnitte}%
<   \fi%
---
>   \crefname{section}{Abschnitt}{Abschnitte}%
>   \crefname{subsection}{Abschnitt}{Abschnitte}%
>   \crefname{subsubsection}{Abschnitt}{Abschnitte}%
4307,4324c4286,4288
< %  \crefname{section}{Abschnitt}{Abschnitte}%
<   \if@cref@abbrev%
<     \crefname{section}{Abschn.}{Abschn.}%
<   \else%
<     \crefname{section}{Abschnitt}{Abschnitte}%
<   \fi%
< %  \crefname{subsection}{Abschnitt}{Abschnitte}%
<   \if@cref@abbrev%
<     \crefname{subsection}{Abschn.}{Abschn.}%
<   \else%
<     \crefname{subsection}{Abschnitt}{Abschnitte}%
<   \fi%
< %  \crefname{subsubsection}{Abschnitt}{Abschnitte}%
<   \if@cref@abbrev%
<     \crefname{subsubsection}{Abschn.}{Abschn.}%
<   \else%
<     \crefname{subsubsection}{Abschnitt}{Abschnitte}%
<   \fi%
---
>   \crefname{section}{Abschnitt}{Abschnitte}%
>   \crefname{subsection}{Abschnitt}{Abschnitte}%
>   \crefname{subsubsection}{Abschnitt}{Abschnitte}%
8076d8039
<   \@crefcopyformats{subsubappendix}{subsubsubappendix}%

Comparison to the author's latest version available from his home page:

$ diff my_improved_cleveref.sty cleveref_0.21.5/cleveref.sty 
12d11
< %% Improved/hacked by ................, 2024.
15,16c14,15
< \def\packagedate{2021/11/02}
< \def\packageversion{0.21.5.2}
---
> \def\packagedate{2018/10/18}
> \def\packageversion{0.21.5}
76c75
<     \protected@edef\@tempb{\thepage}%
---
>     \edef\@tempb{\thepage}%
88c87
<     \protected@edef\@tempb{\thepage}%
---
>     \edef\@tempb{\thepage}%
4123,4128c4122
< %    \crefname@preamble{section}{Abschnitt}{Abschnitte}%
<     \if@cref@abbrev%
<       \crefname@preamble{section}{Abschn.}{Abschn.}%
<     \else%
<       \crefname@preamble{section}{Abschnitt}{Abschnitte}%
<     \fi%
---
>     \crefname@preamble{section}{Abschnitt}{Abschnitte}%
4205,4222c4199,4201
< %  \crefname{section}{Abschnitt}{Abschnitte}%
<   \if@cref@abbrev%
<     \crefname{section}{Abschn.}{Abschn.}%
<   \else%
<     \crefname{section}{Abschnitt}{Abschnitte}%
<   \fi%
< % \crefname{subsection}{Abschnitt}{Abschnitte}%
<   \if@cref@abbrev%
<     \crefname{subsection}{Abschn.}{Abschn.}%
<   \else%
<     \crefname{subsection}{Abschnitt}{Abschnitte}%
<   \fi%
< %  \crefname{subsubsection}{Abschnitt}{Abschnitte}%
<   \if@cref@abbrev%
<     \crefname{subsubsection}{Abschn.}{Abschn.}%
<   \else%
<     \crefname{subsubsection}{Abschnitt}{Abschnitte}%
<   \fi%
---
>   \crefname{section}{Abschnitt}{Abschnitte}%
>   \crefname{subsection}{Abschnitt}{Abschnitte}%
>   \crefname{subsubsection}{Abschnitt}{Abschnitte}%
4307,4324c4286,4288
< %  \crefname{section}{Abschnitt}{Abschnitte}%
<   \if@cref@abbrev%
<     \crefname{section}{Abschn.}{Abschn.}%
<   \else%
<     \crefname{section}{Abschnitt}{Abschnitte}%
<   \fi%
< %  \crefname{subsection}{Abschnitt}{Abschnitte}%
<   \if@cref@abbrev%
<     \crefname{subsection}{Abschn.}{Abschn.}%
<   \else%
<     \crefname{subsection}{Abschnitt}{Abschnitte}%
<   \fi%
< %  \crefname{subsubsection}{Abschnitt}{Abschnitte}%
<   \if@cref@abbrev%
<     \crefname{subsubsection}{Abschn.}{Abschn.}%
<   \else%
<     \crefname{subsubsection}{Abschnitt}{Abschnitte}%
<   \fi%
---
>   \crefname{section}{Abschnitt}{Abschnitte}%
>   \crefname{subsection}{Abschnitt}{Abschnitte}%
>   \crefname{subsubsection}{Abschnitt}{Abschnitte}%

Of course, feel free to remove the superfluous comments.

davidcarlisle commented 2 weeks ago

@AlMa1r Sorry, we can not accept this update.

firstaid is intended as a mechanism for short term fixes when packages are affected by changes in the format, until the package can be updated to match.

We can not handle long term package maintenance of third party packages via this mechanism, which is what a PR such as this would imply.

Specifically ,on cleveref, the package author does occasionally respond to issues raised. I would encourage you to try to make contact and see if he would allow you to update the package at ctan which would be a preferable outcome.

Failing that, the package is under LPPL so you are always free to provide a new package that effectively replaces/updates the existing code.

AlMa1r commented 2 weeks ago

does occasionally respond to issues raised

To you, perhaps. Not to me in the recent years. And the outcome is the same: no upgrade :-(.

Practically, if I continue doing what I did (maintaining my version), the fixes from firstaid are not applied (as I increased the version number, and rightfully so).

It's not a good state, and I'm already more than out of time, so preparing a new, full CTAN package is out of option …

mrpiggi commented 2 weeks ago

To you, perhaps. Not to me in the recent years. And the outcome is the same: no upgrade :-(.

Maybe you can reach out to CTAN as they sometimes do know another channel to contact authors of packages.

AlMa1r commented 2 weeks ago

To you, perhaps. Not to me in the recent years. And the outcome is the same: no upgrade :-(.

Maybe you can reach out to CTAN as they sometimes do know another channel to contact authors of packages.

The author talked to me many years ago, just not in the recent years … So I got tired new contact attempts and won't have the time for yet another try, sorry :-(.