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

cleveref needs another firstaid to work with LaTeX 2024-11-01 plus hyperref #1524

Closed
muzimuzhi opened this issue Nov 1, 2024 · 3 comments
Closed

Comments

@muzimuzhi
Copy link
Contributor

muzimuzhi commented Nov 1, 2024

Brief outline of the bug

Loading hyperref and cleveref in LaTeX 2024-11-01, the use of \refstepcounter{<counter>} won't update \cref@currentlabel thus a corresponding \cref{<counter>} will typeset "??".

This may be related to the changes in hyperref: when used with LaTeX 2024-11-01, it doesn't redefine \refstepcounter anymore.

Found when running l3build check --dev from ctex directory, https://github.com/CTeX-org/ctex-kit repository.

Minimal example showing the bug

% needs latex(-dev) 2024-11-01
% \RequirePackage{latexbug}       % <--should be always the first line (see CONTRIBUTING)!
\documentclass{article}
\usepackage{hyperref}
\usepackage{cleveref}

\begin{document}
\section{title}\label{key}

\makeatletter
\show\cref@currentlabel % still empty
\makeatother

\cref{key} % typesets "??"

\end{document}

In .aux

% with hyperref, bad
\newlabel{key}{{1}{1}{title}{section.1}{}}
\newlabel{key@cref}{{}{[1][1][]1}{}{}{}}

% without hyperref, good
\newlabel{key}{{1}{1}{}{section.1}{}}
\newlabel{key@cref}{{[section][1][]1}{[1][1][]1}{}{}{}}

Log file (required) and possibly PDF file

cleveref-refstepcounter.log

@u-fischer
Copy link
Member

u-fischer commented Nov 1, 2024

It works ok for me. You must ensure that the format has been built with the newest firstaid version. You can check that by looking into the hook label:

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

\begin{document}
\ShowHook{label}
\section{title}\label{key}

\cref{key} % typesets "??"

\end{document}

it should show the cleveref hook:

-> The hook 'label' (1 argument):
> Code chunks:
>     nameref -> \def \label@name {#1}\label@hook 
>     firstaid/cleveref -> \ifx \@currentcounter \@empty \else \firstaid@cref@updatelabeldata {\@currentcounter } \fi 
> Document-level (top-level) code (executed last):
>     ---
> Extra code for next invocation:
>     ---
> Rules:
>     ---
> Execution order:
>     nameref, firstaid/cleveref.
<recently read> }

@muzimuzhi
Copy link
Contributor Author

It works ok for me.

You're right. The problem disappears if I use the format built from this repo, on tag release-2024-11-01. Perhaps some changes taken place between the last pre-release and the stable release of 2024-11-01 help.

I'll close this issue once double checked using LaTeX 2024-11-01 updated from tlmgr.

@muzimuzhi
Copy link
Contributor Author

Perhaps some changes taken place between the last pre-release and the stable release of 2024-11-01 help.

It's 3d8c185 (firstaid for gh1393 and tagging-project733 (#1494), 2024-10-21).

I'll close this issue once double checked using LaTeX 2024-11-01 updated from tlmgr.

Confirm fixed, thank you again.

@muzimuzhi muzimuzhi closed this as not planned Won't fix, can't repro, duplicate, stale Nov 2, 2024
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