[latex3-commits] [latex3/latex2e] lab-review-02: add firstaid for cleveref (bd190371)
github at latex-project.org
github at latex-project.org
Tue Jul 18 20:33:48 CEST 2023
Repository : https://github.com/latex3/latex2e
On branch : lab-review-02
Link : https://github.com/latex3/latex2e/commit/bd1903711709dde77c1c85f84b1d477713d69ff5
>---------------------------------------------------------------
commit bd1903711709dde77c1c85f84b1d477713d69ff5
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Tue Jul 18 20:33:48 2023 +0200
add firstaid for cleveref
>---------------------------------------------------------------
bd1903711709dde77c1c85f84b1d477713d69ff5
required/latex-lab/latex-lab-firstaid.dtx | 25 ++-
.../latex-lab/testfiles-firstaid/test-cleveref.lvt | 17 ++
.../latex-lab/testfiles-firstaid/test-cleveref.tlg | 197 +++++++++++++++++++++
3 files changed, 238 insertions(+), 1 deletion(-)
diff --git a/required/latex-lab/latex-lab-firstaid.dtx b/required/latex-lab/latex-lab-firstaid.dtx
index 8f474e6b..41e9dd03 100644
--- a/required/latex-lab/latex-lab-firstaid.dtx
+++ b/required/latex-lab/latex-lab-firstaid.dtx
@@ -132,7 +132,30 @@
\endgroup}
}
% \end{macrocode}
-
+% \subsection{cleveref}
+% The cleveref package redefines \cs{@makefntext} and this means that the patches in
+% the new footnote code fails. We use a hook instead
+% \begin{macrocode}
+\AddToHook{package/cleveref/after}
+ {
+ \let\@makefntext\cref at old@makefntext
+ \AddToHook{cmd/@makefntext/before}{%
+ \cref at constructprefix{footnote}{\cref at result}%
+ \protected at edef\cref at currentlabel{%
+ [footnote][\arabic{footnote}][\cref at result]%
+ \p at footnote\@thefnmark}}
+% \end{macrocode}
+% The second problem is that it redefines \cs{refstepcounter} to use an argument.
+% In itself this isn't a problem but as the new definition doesn't grab the arguments
+% directly it fails over the generic hook inserted at the end of the definition
+% \begin{macrocode}
+ \RenewDocumentCommand\refstepcounter{om}{%
+ \IfNoValueTF{#1}%
+ {\refstepcounter at noarg{#2}}%
+ {\refstepcounter at optarg[#1]{#2}}%
+ }%
+ }
+% \end{macrocode}
% \begin{macrocode}
%</package>
% \end{macrocode}
diff --git a/required/latex-lab/testfiles-firstaid/test-cleveref.lvt b/required/latex-lab/testfiles-firstaid/test-cleveref.lvt
new file mode 100644
index 00000000..1a387f8f
--- /dev/null
+++ b/required/latex-lab/testfiles-firstaid/test-cleveref.lvt
@@ -0,0 +1,17 @@
+\DocumentMetadata{
+ testphase={phase-III,firstaid}
+}
+\input{regression-test}
+\documentclass[a4paper,10pt]{article}
+
+\usepackage{hyperref}
+\usepackage{cleveref}
+
+\begin{document}
+\START\showoutput
+I am referencing to \cref{target}
+
+\section{First section}
+\label{target}
+
+\end{document}
\ No newline at end of file
diff --git a/required/latex-lab/testfiles-firstaid/test-cleveref.tlg b/required/latex-lab/testfiles-firstaid/test-cleveref.tlg
new file mode 100644
index 00000000..fc5388ff
--- /dev/null
+++ b/required/latex-lab/testfiles-firstaid/test-cleveref.tlg
@@ -0,0 +1,197 @@
+This is a generated file for the l3build validation system.
+Don't change this file in any respect.
+Completed box being shipped out [1]
+\vbox(682.0+0.0)x398.0
+.\hbox(0.0+0.0)x0.0
+.\hbox(0.0+0.0)x0.0
+..\kern -72.26999
+..\vbox(0.0+0.0)x0.0, glue set 72.26999fil
+...\kern -72.26999
+...\hbox(0.0+0.0)x0.0
+....\glue 0.0 plus 1.0fil minus 1.0fil
+...\glue 0.0 plus 1.0fil minus 1.0fil
+.\vbox(0.0+0.0)x0.0, glue set - 15.99626fil
+..\kern 0.0
+..\kern 17.0
+..\kern -1.00374
+..\hbox(0.0+0.0)x0.0, glue set - 51.99626fil
+...\kern 0.0
+...\kern 53.0
+...\kern -1.00374
+...\pdfdest name{page.1} xyz
+...\pdfdest struct21 name{page.1} xyz
+...\penalty 10000
+...\glue 0.0 plus 1.0fil minus 1.0fil
+..\glue 0.0 plus 1.0fil minus 1.0fil
+.\glue(\lineskip) 0.0
+.\vbox(682.0+0.0)x398.0
+..\glue 17.0
+..\vbox(665.0+0.0)x345.0, shifted 53.0
+...\vbox(12.0+0.0)x345.0, glue set 12.0fil
+....\glue 0.0 plus 1.0fil
+....\pdfrunninglinkoff
+....\pdfliteral page{/Artifact BMC}
+....\marks4{b-,6,-1,}
+....\marks4{b+,6,-1,}
+....\hbox(0.0+0.0)x345.0
+.....\hbox(0.0+0.0)x345.0
+....\pdfliteral page{EMC}
+....\marks4{e-,6,7,}
+....\marks4{e+,6,7,}
+....\pdfrunninglinkon
+...\glue 25.0
+...\glue(\lineskip) 0.0
+...\vbox(598.0+0.0)x345.0, glue set 544.96964fil
+....\hbox(0.0+0.0)x0.0
+....\pdfinterwordspaceon
+....\write-{}
+....\pdfdest name{Doc-Start} xyz
+....\pdfdest struct10 name{Doc-Start} xyz
+....\glue(\topskip) 3.05556
+....\hbox(6.94444+1.94444)x345.0, glue set 204.8887fil
+.....\write1{\newlabeldata{mcid-1}{{tagabspage}{\__ref_attribute_tagabspage: }{tagmcabs}{1}{tagmcid}{0}}}
+.....\pdfliteral page{/text /l3pdf1 BDC}
+.....\write1{\newlabeldata{l3pdf1}{{abspage}{\__ref_attribute_abspage: }}}
+.....\hbox(0.0+0.0)x15.0
+.....\OT1/cmr/m/n/10 I
+.....\glue 3.33333 plus 1.66498 minus 1.11221
+.....\OT1/cmr/m/n/10 a
+.....\OT1/cmr/m/n/10 m
+.....\glue 3.33333 plus 1.66666 minus 1.11111
+.....\OT1/cmr/m/n/10 r
+.....\OT1/cmr/m/n/10 e
+.....\OT1/cmr/m/n/10 f
+.....\OT1/cmr/m/n/10 e
+.....\OT1/cmr/m/n/10 r
+.....\OT1/cmr/m/n/10 e
+.....\OT1/cmr/m/n/10 n
+.....\OT1/cmr/m/n/10 c
+.....\OT1/cmr/m/n/10 i
+.....\OT1/cmr/m/n/10 n
+.....\OT1/cmr/m/n/10 g
+.....\glue 3.33333 plus 1.66666 minus 1.11111
+.....\OT1/cmr/m/n/10 t
+.....\OT1/cmr/m/n/10 o
+.....\glue 3.33333 plus 1.66666 minus 1.11111
+.....\OT1/cmr/m/n/10 s
+.....\OT1/cmr/m/n/10 e
+.....\OT1/cmr/m/n/10 c
+.....\OT1/cmr/m/n/10 t
+.....\OT1/cmr/m/n/10 i
+.....\OT1/cmr/m/n/10 o
+.....\OT1/cmr/m/n/10 n
+.....\penalty 10000
+.....\glue 3.33333 plus 1.66666 minus 1.11111
+.....\pdfliteral page{EMC}
+.....\write1{\newlabeldata{mcid-2}{{tagabspage}{\__ref_attribute_tagabspage: }{tagmcabs}{2}{tagmcid}{1}}}
+.....\pdfliteral page{/Link /l3pdf2 BDC}
+.....\write1{\newlabeldata{l3pdf2}{{abspage}{\__ref_attribute_abspage: }}}
+.....\pdfstartlink(*+*)x* attr{/Contents (ref) /Border [0 0 1] /H /I /C [0.701176 0.4 0.414118] /StructParent 1 } action goto name{section.1}
+.....\OT1/cmr/m/n/10 1
+.....\pdfendlink
+.....\write1{\newlabeldata{__tag_objr_page_1}{{tagabspage}{\__ref_attribute_tagabspage: }}}
+.....\pdfliteral page{EMC}
+.....\write1{\newlabeldata{mcid-3}{{tagabspage}{\__ref_attribute_tagabspage: }{tagmcabs}{3}{tagmcid}{2}}}
+.....\pdfliteral page{/text /l3pdf3 BDC}
+.....\write1{\newlabeldata{l3pdf3}{{abspage}{\__ref_attribute_abspage: }}}
+.....\pdfliteral page{EMC}
+.....\penalty 10000
+.....\glue(\parfillskip) 0.0 plus 1.0fil
+.....\glue(\rightskip) 0.0
+....\marks4{b-,1,5,text,,,}
+....\marks4{b+,1,5,text,,,}
+....\marks4{e-,1,5,}
+....\marks4{e+,1,5,}
+....\marks4{b-,2,6,Link,,,}
+....\marks4{b+,2,6,Link,,,}
+....\marks4{e-,2,6,}
+....\marks4{e+,2,6,}
+....\marks4{b-,3,5,text,,,}
+....\marks4{b+,3,5,text,,,}
+....\marks4{e-,3,5,}
+....\marks4{e+,3,5,}
+....\penalty -300
+....\glue 15.0694 plus 4.30554 minus 0.86108
+....\glue(\parskip) 0.0 plus 1.0
+....\glue(\parskip) 0.0
+....\glue(\baselineskip) 6.05557
+....\hbox(9.99998+0.0)x345.0, glue set 232.42844fil
+.....\write1{\newlabeldata{mcid-4}{{tagabspage}{\__ref_attribute_tagabspage: }{tagmcabs}{4}{tagmcid}{3}}}
+.....\pdfliteral page{/Lbl /l3pdf4 BDC}
+.....\write1{\newlabeldata{l3pdf4}{{abspage}{\__ref_attribute_abspage: }}}
+.....\hbox(9.27998+0.0)x24.29997
+......\glue 0.0
+......\hbox(0.0+0.0)x0.0
+.......\kern 0.0
+.......\penalty 10000
+.......\hbox(0.0+0.0)x0.0
+........\hbox(0.0+0.0)x0.0, shifted -18.0
+.........\pdfdest name{section.1} xyz
+.........\pdfdest struct23 name{section.1} xyz
+.........\penalty 10000
+.......\glue 0.0 plus 1.0fil minus 1.0fil
+......\OT1/cmr/bx/n/14.4 1
+......\glue 16.19998
+.....\pdfliteral page{EMC}
+.....\write1{\newlabeldata{mcid-5}{{tagabspage}{\__ref_attribute_tagabspage: }{tagmcabs}{5}{tagmcid}{4}}}
+.....\pdfliteral page{/section /l3pdf5 BDC}
+.....\write1{\newlabeldata{l3pdf5}{{abspage}{\__ref_attribute_abspage: }}}
+.....\OT1/cmr/bx/n/14.4 F
+.....\OT1/cmr/bx/n/14.4 i
+.....\OT1/cmr/bx/n/14.4 r
+.....\OT1/cmr/bx/n/14.4 s
+.....\OT1/cmr/bx/n/14.4 t
+.....\glue 5.4 plus 2.7 minus 1.79999
+.....\OT1/cmr/bx/n/14.4 s
+.....\OT1/cmr/bx/n/14.4 e
+.....\OT1/cmr/bx/n/14.4 c
+.....\OT1/cmr/bx/n/14.4 t
+.....\OT1/cmr/bx/n/14.4 i
+.....\OT1/cmr/bx/n/14.4 o
+.....\OT1/cmr/bx/n/14.4 n
+.....\pdfliteral page{EMC}
+.....\penalty 10000
+.....\glue(\parfillskip) 0.0 plus 1.0fil
+.....\glue(\rightskip) 0.0
+....\marks4{b-,4,9,Lbl,,,}
+....\marks4{b+,4,9,Lbl,,,}
+....\marks4{e-,4,9,}
+....\marks4{e+,4,9,}
+....\marks4{b-,5,8,section,,,}
+....\marks4{b+,5,8,section,,,}
+....\marks4{e-,5,8,}
+....\marks4{e+,5,8,}
+....\write1{\@writefile{toc}{\protect \contentsline {section}{\protect \numberline {1}First section}{\thepage }{section.1}\protected at file@percent }}
+....\penalty 10000
+....\glue 9.90276 plus 0.86108
+....\write1{\newlabel{target}{{1}{\thepage }{First section}{section.1}{}}}
+....\penalty 10000
+....\penalty 10000
+....\write1{\newlabel{target at cref}{{[section][1][]1}{[1][1][]\thepage }}}
+....\penalty 10000
+....\penalty 10000
+....\glue 0.0 plus 1.0fil
+....\kern 0.0
+....\hbox(0.0+0.0)x0.0
+....\glue 0.0
+....\glue 0.0 plus 0.0001fil
+...\pdfrunninglinkoff
+...\pdfliteral page{/Artifact BMC}
+...\marks4{b-,7,-1,}
+...\marks4{b+,7,-1,}
+...\glue(\baselineskip) 23.55556
+...\hbox(6.44444+0.0)x345.0
+....\hbox(6.44444+0.0)x345.0, glue set 170.0fil
+.....\glue 0.0 plus 1.0fil
+.....\OT1/cmr/m/n/10 1
+.....\glue 0.0 plus 1.0fil
+...\pdfliteral page{EMC}
+...\marks4{e-,7,7,}
+...\marks4{e+,7,7,}
+...\pdfrunninglinkon
+.\kern 0.0
+.\kern 0.0
+.\kern -682.0
+.\hbox(0.0+0.0)x0.0
+.\kern 682.0
+(test-cleveref.aux)
More information about the latex3-commits
mailing list.