latex3 / latex3/hyperref

Changed behavior of `cleveref` after `\appendix`

Open
#361 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TeX
Stars
205
Forks
41
PR merge metrics
No merged PRs in 30d

Description

(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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal LaTeX document in the issue and inspect how hyperref and cleveref update \appendix, especially the \H@refstepcounter path and \cref@currentlabel. Compare the output with cleveref alone and with both packages; done means the missing appendix information is restored in the combined case.

Written by the indexing model from the issue text.

Assessment

Tech stack
latex, tex
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.