Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed behavior of cleveref after \appendix #361

Open
muzimuzhi opened this issue Nov 8, 2024 · 2 comments
Open

Changed behavior of cleveref after \appendix #361

muzimuzhi opened this issue Nov 8, 2024 · 2 comments

Comments

@muzimuzhi
Copy link
Contributor

(First caught by a test in the ctex bundle, see log of its scheduled job.)

cleveref updates a set of internal commands at \appendix, especially the logic

            \ifx\cref@result\@empty%
              \def\cref@result{2147483647}%
            \else%
              \edef\cref@result{2147483647,\cref@result}%
            \fi%

is added to \H@refstepcounter.

This logic is now missing as \H@refstepcounter is not used in hyperref any more.

\documentclass{article}
\usepackage{hyperref}
\usepackage{cleveref}

\makeatletter
\def\test{\show\cref@currentlabel}
\makeatother

\begin{document}
\section{title}
\test

\appendix
\section{title}
\test
\end{document}

Loading cleveref only:

> \cref@currentlabel=macro:
->[section][1][]1.


> \cref@currentlabel=macro:
->[appendix][1][2147483647]A.

Loading both hyperref and cleveref:

> \cref@currentlabel=macro:
->[section][1][]1.


> \cref@currentlabel=macro:
->[section][1][]A. % <<< changed, "2147483647" is missing
@u-fischer
Copy link
Member

Well the only idea I have to disable the hyperref patches in cleveref by claiming that implicit=false has been used. Could you fire your testsuite on it?

\documentclass{article}
\usepackage{hyperref}
\ExplSyntaxOn
\AddToHook{package/cleveref/before}{\clist_put_right:cn {[email protected]}{implicit=false}}
\ExplSyntaxOff
\usepackage{cleveref}

\makeatletter
\def\test{\show\cref@currentlabel}
\makeatother


\begin{document}
\section{title}
\test

\appendix
\section{title}
\test
\end{document}

@muzimuzhi
Copy link
Contributor Author

\ExplSyntaxOn
\AddToHook{package/cleveref/before}{\clist_put_right:cn {[email protected]}{implicit=false}}
\ExplSyntaxOff

With this trick the ctex testsuite is passed. See muzimuzhi/ctex-kit@fa2feed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants