Debian Codegraph @

texmf-dist/tex/latex/latex-lab/latex-lab-testphase-bib.sty

raw
1 %%
2 %% This is file `latex-lab-testphase-bib.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% latex-lab-bib.dtx (with options: `package')
8 %%
9 %% This is a generated file.
10 %%
11 %% Copyright 2021-2025 LaTeX Project
12 %%
13 %% This file was generated from file(s) of the `LaTeX-lab Bundle'.
14 %% ------------------------------------------------------------------------------------
15 %%
16 %% It may be distributed and/or modified under the
17 %% conditions of the LaTeX Project Public License, either version 1.3c
18 %% of this license or (at your option) any later version.
19 %% The latest version of this license is in
20 %% http://www.latex-project.org/lppl.txt
21 %% and version 1.3c or later is part of all distributions of LaTeX
22 %% version 2008 or later.
23 %%
24 %% This file may only be distributed together with a copy of the LaTeX
25 %% `LaTeX-lab Bundle'. You may however distribute the `LaTeX-lab Bundle'
26 %% without such generated files.
27 %%
28 %% The newest sources can be found below
29 %%
30 %% https://github.com/latex3/latex2e/required/latex-lab
31 %%
32 %% where one can also log issues in case there are any.
33 %%
34 %%
35 %% File: latex-lab-bib.dtx (C) Copyright 2023 LaTeX Project
36 \def\ltlabbibdate{2025-05-09}
37 \def\ltlabbibversion{0.81c}
38 \ProvidesExplPackage {latex-lab-testphase-bib} {\ltlabbibdate} {\ltlabbibversion}
39 {Code related to the tagging of bibliography and cite command}
40 \RequirePackage{latex-lab-testphase-block}
41 \def\hyper@nopatch@bib{}
42
43 \providecommand*\@extra@binfo{}%
44 \providecommand\@extra@b@citeb{}
45 \tl_new:N\l__tag_bib_citekey_tl
46 \AddToHookWithArguments{cmd/@lbibitem/before}
47 {
48 \tl_set:Nn\l__tag_bib_citekey_tl{#2}
49 }
50 \AddToHookWithArguments{cmd/@lbibitem/before}[latex-lab-testphase-bib/target]
51 {
52 \AddToHookNext{para/begin}
53 {
54 \makebox[0pt][r]{\MakeLinkTarget*{cite.#2\@extra@b@citeb}\hspace{\leftmargin}}
55 }
56 }
57 \let\@kernel@copy@lbibitem\@lbibitem
58 \AddToHookWithArguments{cmd/@bibitem/before}
59 {
60 \tl_set:Nn\l__tag_bib_citekey_tl{#1}
61 }
62 \AddToHookWithArguments{cmd/@bibitem/before}[latex-lab-testphase-bib/target]
63 {
64 \AddToHookNext{para/begin}
65 {
66 \makebox[0pt][r]{\MakeLinkTarget*{cite.#1\@extra@b@citeb}\hspace{\leftmargin}}
67 }
68 }
69 \let\@kernel@copy@bibitem\@bibitem
70 \AddToHook{env/thebibliography/begin}
71 {
72 \cs_set:Npn \__block_list_item_begin:
73 {
74 \tag_struct_begin:n
75 {
76 tag=\LItag,
77 label= cite.\l__tag_bib_citekey_tl\@extra@b@citeb
78 }
79 }
80 }
81 \NewMirroredHookPairWithArguments{bibcite/before}{bibcite/after}{2}
82 \def\bibcite#1#2{%
83 \@newl@bel{b}{#1\@extra@binfo}{%
84 \UseHookWithArguments{bibcite/before}{2}{#1}{#2}
85 #2
86 \UseHookWithArguments{bibcite/after}{2}{#1}{#2}
87 }%
88 }%
89 \let\@kernel@copy@bibcite\bibcite
90 \AddToHookWithArguments{bibcite/before}
91 {
92 \tag_mc_end_push:
93 \exp_args:Ne\tagstructbegin{tag=Reference,ref=cite.#1\@extra@b@citeb}
94 \tagmcbegin{}
95 }
96 \AddToHookWithArguments{bibcite/after}[tag]
97 {
98 \tag_mc_end:
99 \tagstructend
100 \tag_mc_begin_pop:n{}
101 }
102 \AddToHook{package/hyperref/after}
103 {
104 \AddToHookWithArguments{bibcite/before}
105 {
106 \hyper@linkstart{cite}{cite.#1\@extra@b@citeb}
107 }
108 \AddToHookWithArguments{bibcite/after}{\hyper@linkend}
109 }
110 \newcommand\hyper@natlinkstart[1]{}
111 \newcommand\hyper@natlinkend{}
112 \AddToHook{package/natbib/after}
113 {
114 \RemoveFromHook{cmd/@bibitem/before} [latex-lab-testphase-bib/target]
115 \RemoveFromHook{cmd/@lbibitem/before}[latex-lab-testphase-bib/target]
116 }
117 \AddToHookWithArguments{cmd/hyper@natlinkstart/before}
118 {
119 \leavevmode
120 \tag_mc_end_push:
121 \exp_args:Ne\tag_struct_begin:n{tag=Reference,ref=cite.#1\@extra@b@citeb}
122 \tag_mc_begin:n{}
123 }
124 \AddToHook{cmd/hyper@natlinkend/after}
125 {
126 \tag_mc_end:
127 \tag_struct_end:
128 \tag_mc_begin_pop:n{}
129 }
130
131 \AddToHook{package/hyperref/after}
132 {
133 \renewcommand\hyper@natlinkstart[1]{}
134 \renewcommand\hyper@natlinkend{}
135 \AddToHookWithArguments{cmd/hyper@natlinkstart/before}
136 {
137 \Hy@backout{#1}%
138 \hyper@linkstart{cite}{cite.#1}%
139 \def\hyper@nat@current{#1}
140 }
141 \AddToHook{cmd/hyper@natlinkend/after}
142 {
143 \hyper@linkend
144 }
145 }
146
147 \AddToHook{cmd/blx@bibinit/after}
148 {
149 \cs_set:Npn \__block_list_item_begin:
150 {
151 \xifinlist{\the\c@refsection @\abx@field@entrykey}{\blx@anchors}
152 {
153 \tag_struct_begin:n
154 {
155 tag=\LItag,
156 }
157 }
158 {
159 \tag_struct_begin:n
160 {
161 tag=\LItag,
162 label= cite.\the\c@refsection @\abx@field@entrykey
163 }
164 }
165 }
166 }
167 \AddToHook{package/biblatex/after}
168 {
169 \appto\blx@mknohyperref
170 {
171 \let\blx@anchors\@empty
172 \protected\def\blx@anchor{%
173 \xifinlist{\the\c@refsection @\abx@field@entrykey}{\blx@anchors}
174 {}
175 {\listxadd\blx@anchors{\the\c@refsection @\abx@field@entrykey}}}%
176 }
177 }
178 \endinput
179 %%
180 %% End of file `latex-lab-testphase-bib.sty'.