[PATCH -perfbook 2/8] Apply hotfix for cleveref against recent LaTeX2e

Akira Yokosawa <[email protected]> Wed, 6 May 2026 20:40:12 +0900
Newsgroups org.kernel.vger.perfbook
Message-ID <[email protected]>
It turned out that cleveref has been suffering from (yet another)
compatibility issue against LaTeX2e since <2024-11-01> release.

As can be seen in the closing paragraph of Section 1.1 in CI-built
PDFs at:

     https://gitlab.com/linux-kernel/perfbook/-/artifacts

, chapters in Appendix are printed as "Section C" and "Section E",
rather than "Appendix C" and "Appendix E".

Apply a hotfix based on a suggestion from Ulrike Fischer [1].

Link: https://github.com/latex3/latex2e/issues/2049#issuecomment-4302720865 [1]
Signed-off-by: Akira Yokosawa <[email protected]>
---
 fixcleveref.ltx | 12 ++++++++++++
 perfbook-lt.tex |  2 ++
 2 files changed, 14 insertions(+)
 create mode 100644 fixcleveref.ltx

diff --git a/fixcleveref.ltx b/fixcleveref.ltx
new file mode 100644
index 00000000..76a2b591
--- /dev/null
+++ b/fixcleveref.ltx
@@ -0,0 +1,12 @@
+\makeatletter%
+ \providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion}%
+\makeatother
+\IfFormatAtLeastTF{2024-11-01}{%
+  \AddToHook{cmd/appendix/before}{%
+    \crefalias{chapter}{appendix}%
+    \crefalias{section}{appendix}%
+    \crefalias{subsection}{appendix}%
+    \crefalias{subsubsection}{appendix}%
+    \crefalias{subsubsubsection}{appendix}%
+  }%
+}{}
diff --git a/perfbook-lt.tex b/perfbook-lt.tex
index 5509d455..4eec9b67 100644
--- a/perfbook-lt.tex
+++ b/perfbook-lt.tex
@@ -594,6 +594,8 @@
   \input{fixfvextra.ltx}
 }{}
 
+\input{fixcleveref.ltx}
+
 \begin{document}
 
 %%HTMLSKIP
-- 
2.43.0