Debian Codegraph @

texmf-dist/tex/generic/tex4ht/cleveref.4ht

raw
1 % cleveref.4ht (2023-05-18-14:15), generated from tex4ht-4ht.tex
2 % Copyright 2018-2023 TeX Users Group
3 %
4 % This work may be distributed and/or modified under the
5 % conditions of the LaTeX Project Public License, either
6 % version 1.3c of this license or (at your option) any
7 % later version. The latest version of this license is in
8 % http://www.latex-project.org/lppl.txt
9 % and version 1.3c or later is part of all distributions
10 % of LaTeX version 2005/12/01 or later.
11 %
12 % This work has the LPPL maintenance status "maintained".
13 %
14 % The Current Maintainer of this work
15 % is the TeX4ht Project <http://tug.org/tex4ht>.
16 %
17 % If you modify this program, changing the
18 % version identification would be appreciated.
19 \immediate\write-1{version 2023-05-18-14:15}
20
21
22
23 % orig:refstepcounter is saved in cleveref-hooks.4ht
24 \let\cref@old@refstepcounter\orig:refstepcounter%
25 \def\refstepcounter{%
26 \@ifnextchar[{\refstepcounter@optarg}{\refstepcounter@noarg}%]
27 }%
28
29 % fix for TeX4ht label mechanism
30 \def\cref:currentlabel#1{\let\cnt:currentlabel\@currentlabel
31 \def\:@currentlabel{\ifx \cnt:currentlabel\@currentlabel
32 \expandafter\the\csname c@#1\endcsname\else \@currentlabel\fi}%
33 %
34 \anc:lbl r{#1}%
35 }
36
37 \def\refstepcounter@noarg#1{%
38 \cref@old@refstepcounter{#1}%
39 \cref@constructprefix{#1}{\cref@result}%
40 \@ifundefined{cref@#1@alias}%
41 {\def\@tempa{#1}}%
42 {\def\@tempa{\csname cref@#1@alias\endcsname}}%
43 \protected@xdef\cref@currentlabel{%
44 [\@tempa][\arabic{#1}][\cref@result]%
45 \csname p@#1\endcsname\csname the#1\endcsname}%
46 \cref:currentlabel{#1}%
47 }%
48 \def\refstepcounter@optarg[#1]#2{%
49 \cref@old@refstepcounter{#2}%
50 \cref@constructprefix{#2}{\cref@result}%
51 \@ifundefined{cref@#1@alias}%
52 {\def\@tempa{#1}}%
53 {\def\@tempa{\csname cref@#1@alias\endcsname}}%
54 \protected@xdef\cref@currentlabel{%
55 [\@tempa][\arabic{#2}][\cref@result]%
56 \csname p@#2\endcsname\csname the#2\endcsname}%
57 \cref:currentlabel{#2}%
58 }%
59
60 \ifdefined\@firstoffive\else%
61 \def\@firstoffive#1#2#3#4#5{#1}%
62 \fi
63 \def\:tempa#1#2{\bgroup%
64 \def\rEfLiNK##1##2{\Link{##1}{}}%
65 \def\XRrEfLiNK[##1]##2##3{\Link[##1]{##2}{}}% handle links from Xr and Xr-hyper
66 \cref@getlabel{#2}{\@templabel}%
67 #1{% add links only around reference numbers, not the previous text, because it can contain punctuation
68 \expandafter\expandafter\expandafter\@firstoffive\csname r@#2\endcsname{}{}{}{}{}%
69 \@templabel\EndLink}{}{}%
70 \egroup%
71 }%
72
73 \HLet\@@@setcref=\:tempa
74
75 \@ifpackageloaded{amsthm}{
76 \let\cref@thmnoarg\@thm%
77 \def\@thm{\@ifnextchar[{\cref@thmoptarg}{\cref@thmnoarg}}%]
78 \def\:tempb[#1]#2#3#4{%
79 % call original amsthm theorem definition, but
80 % disable \:thm in order to prevent infinite loop
81 \let\:thm\:gobble%
82 \cref@thmnoarg{#2}%
83 \o:cref@thmoptarg:[#1]{#2}{#3}{#4}
84 }%
85 \HLet\cref@thmoptarg\:tempb%
86 }{}%
87
88
89 \Hinput{cleveref}
90
91 \endinput
92