Debian Codegraph @

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

raw
1 %%
2 %% This is file `latex-lab-testphase-tikz.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% latex-lab-tikz.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-tikz.dtx (C) Copyright 2025 LaTeX Project
36 \def\ltlabtikzdate{2025-09-27}
37 \def\ltlabtikzversion{0.80d}
38
39 \ProvidesExplPackage {latex-lab-testphase-tikz} {\ltlabtikzdate} {\ltlabtikzversion}
40 {Code related to the tagging of tikz pictures}
41 \NewTaggingSocket{tikz/picture/init}{1}
42 \NewTaggingSocket{tikz/picture/begin}{0}
43 \NewTaggingSocket{tikz/picture/end}{0}
44 \NewSocket{tagsupport/tikz/picture/text/begin}{0}
45 \NewSocket{tagsupport/tikz/picture/text/end}{0}
46 %%
47 \NewTaggingSocketPlug{tikz/picture/init}{default}
48 {
49 \keys_set_known:nn { tikz / tagging } {#1}
50 }
51 \AssignTaggingSocketPlug{tikz/picture/init}{default}
52 \NewTaggingSocketPlug{tikz/picture/begin}{text}
53 {
54 \ifvmode
55 {
56 \if@inlabel \leavevmode \else \tag_socket_use:n{para/begin}\fi
57 }
58 \fi
59 \tag_mc_end_push:
60 \tagmcbegin{artifact}
61 \def\pgfsys@begin@text
62 {
63 \tag_resume:n{\tikz/picture}
64 \tag_socket_use:n{tikz/picture/text/begin}
65 }
66 \def\pgfsys@end@text
67 {
68 \tag_socket_use:n{tikz/picture/text/end}
69 \tag_suspend:n{\tikzpicture}
70 }
71 }
72 \NewTaggingSocketPlug{tikz/picture/end}{text}
73 {
74 \tagmcend
75 \tag_mc_begin_pop:n{}
76 }
77 \NewTaggingSocketPlug{tikz/picture/begin}{alt}
78 {
79 \ifvmode
80 {
81 \if@inlabel \leavevmode \else \tag_socket_use:n{para/begin}\fi
82 }
83 \fi
84 \tag_mc_end_push:
85 \tag_struct_begin:n
86 {
87 tag=Figure,
88 alt=\l__tikz_tagging_alt_tl
89 }
90 \pgfrememberpicturepositiononpagetrue
91 \tag_mc_begin:n{tag=Figure}
92 }
93
94 \NewTaggingSocketPlug{tikz/picture/end}{alt}
95 {
96 \tag_mc_end:
97 \cs_set:Npn\pgfqpoint##1##2
98 {
99 \tl_set:Ne\l_tmpa_tl
100 {
101 \dim_to_decimal_in_bp:n {##1+ \pgf@picminx}
102 \c_space_tl
103 \dim_to_decimal_in_bp:n {##2+ \pgf@picminy}
104 \c_space_tl
105 \dim_to_decimal_in_bp:n {##1+ \pgf@picmaxx}
106 \c_space_tl
107 \dim_to_decimal_in_bp:n {##2+ \pgf@picmaxx}
108 }
109 }
110 \cs_if_exist:cT { pgf@sys@pdf@mark@pos@pgfid\the\pgf@picture@serial@count }
111 {
112 \use:c { pgf@sys@pdf@mark@pos@pgfid\the\pgf@picture@serial@count }
113 \tag_struct_gput:ene
114 {\tag_get:n{struct_num}}
115 {attribute}
116 {
117 /O /Layout /BBox~
118 [
119 \l_tmpa_tl
120 ]
121 }
122 }
123 \tag_struct_end:
124 \tag_mc_begin_pop:n{}
125 }
126 \NewTaggingSocketPlug{tikz/picture/begin}{actualtext}
127 {
128 \ifvmode
129 {
130 \if@inlabel \leavevmode \else \tag_socket_use:n{para/begin}\fi
131 }
132 \fi
133 \tag_mc_end_push:
134 \tag_struct_begin:n{tag=Span,actualtext=\l__tikz_tagging_actualtext_tl}
135 \tag_mc_begin:n{}
136 }
137
138 \NewTaggingSocketPlug{tikz/picture/end}{actualtext}
139 {
140 \tag_mc_end:
141 \tag_struct_end:
142 \tag_mc_begin_pop:n{}
143 }
144 \NewTaggingSocketPlug{tikz/picture/begin}{artifact}
145 {
146 \ifvmode
147 {
148 \if@inlabel \leavevmode \else \tag_socket_use:n{para/begin}\fi
149 }
150 \fi
151 \tag_mc_end_push:
152 \tag_mc_begin:n{artifact}
153 }
154
155 \NewTaggingSocketPlug{tikz/picture/end}{artifact}
156 {
157 \tag_mc_end:
158 \tag_mc_begin_pop:n{}
159 }
160 \AssignTaggingSocketPlug{tikz/picture/begin}{text}
161 \AssignTaggingSocketPlug{tikz/picture/end}{text}
162 \NewTaggingSocketPlug{tikz/picture/text/begin}{default}
163 {
164 \tag_mc_end:
165 \tag_mc_begin:n{}
166 }
167 \NewTaggingSocketPlug{tikz/picture/text/end}{default}
168 {
169 \tag_mc_end:
170 \tag_mc_begin:n{artifact}
171 }
172 \AssignTaggingSocketPlug{tikz/picture/text/begin}{default}
173 \AssignTaggingSocketPlug{tikz/picture/text/end}{default}
174 \AddToHook{package/tikz/after}
175 {
176 \AddToHookWithArguments{cmd/tikz@picture/before}
177 {
178 \tag_socket_use:nn{tikz/picture/init}{#1}
179 \tag_socket_use:n {tikz/picture/begin}
180 \tag_suspend:n{\tikzpicture}
181 }
182 \AddToHook{cmd/endpgfpicture/after}
183 {
184 \tag_resume:n{\tikzpicture}
185 \tag_socket_use:n{tikz/picture/end}
186 }
187 }
188 \tl_new:N \l__tikz_tagging_alt_tl
189 \tl_set:Nn \l__tikz_tagging_alt_tl {Alternative~text~missing!}
190 \tl_new:N \l__tikz_tagging_actualtext_tl
191
192 \keys_define:nn { tikz / tagging }
193 {
194 alt .code:n =
195 {
196 \tl_set:Ne\l__tikz_tagging_alt_tl {\text_purify:n{#1}}
197 \AssignTaggingSocketPlug{tikz/picture/begin}{alt}
198 \AssignTaggingSocketPlug{tikz/picture/end}{alt}
199 \def\pgfsys@begin@text{}
200 \def\pgfsys@end@text{}
201 },
202 actualtext .code:n =
203 {
204 \tl_set:Ne\l__tikz_tagging_actualtext_tl {\text_purify:n{#1}}
205 \AssignTaggingSocketPlug{tikz/picture/begin}{actualtext}
206 \AssignTaggingSocketPlug{tikz/picture/end}{actualtext}
207 \def\pgfsys@begin@text{}
208 \def\pgfsys@end@text{}
209 },
210 artifact .code:n =
211 {
212 \AssignTaggingSocketPlug{tikz/picture/begin}{artifact}
213 \AssignTaggingSocketPlug{tikz/picture/end}{artifact}
214 \def\pgfsys@begin@text{}
215 \def\pgfsys@end@text{}
216 },
217 tagging-setup .multichoice:,
218 tagging-setup / text .code:n =
219 {
220 \AssignTaggingSocketPlug{tikz/picture/begin}{text}
221 \AssignTaggingSocketPlug{tikz/picture/end}{text}
222 },
223 tagging-setup / unknown .code:n=
224 {
225 \keys_set:nn { tag/graphic }{#1}
226 }
227 }
228 \AddToHook{package/tikz/after}
229 {
230 \tikzset
231 {
232 alt/.code=
233 {
234 \tl_set:Ne\l__tikz_tagging_alt_tl {\text_purify:n{#1}}
235 \AssignTaggingSocketPlug{tikz/picture/begin}{alt}
236 \AssignTaggingSocketPlug{tikz/picture/end}{alt}
237 \def\pgfsys@begin@text{}
238 \def\pgfsys@end@text{}
239 },
240 actualtext/.code=
241 {
242 \tl_set:Ne \l__tikz_tagging_actualtext_tl {\text_purify:n{#1}}
243 \AssignTaggingSocketPlug{tikz/picture/begin}{actualtext}
244 \AssignTaggingSocketPlug{tikz/picture/end}{actualtext}
245 \def\pgfsys@begin@text{}
246 \def\pgfsys@end@text{}
247 },
248 artifact/.code=
249 {
250 \AssignTaggingSocketPlug{tikz/picture/begin}{artifact}
251 \AssignTaggingSocketPlug{tikz/picture/end}{artifact}
252 \def\pgfsys@begin@text{}
253 \def\pgfsys@end@text{}
254 }
255 }
256 \tikzset
257 {
258 tagging-setup/.is~choice,
259 tagging-setup/text/.code =
260 {
261 \AssignTaggingSocketPlug{tikz/picture/begin}{text}
262 \AssignTaggingSocketPlug{tikz/picture/end}{text}
263 },
264 tagging-setup/alt/.code =
265 {
266 \AssignTaggingSocketPlug{tikz/picture/begin}{alt}
267 \AssignTaggingSocketPlug{tikz/picture/end}{alt}
268 \def\pgfsys@begin@text{}
269 \def\pgfsys@end@text{}
270 },
271 tagging-setup/actualtext/.code =
272 {
273 \AssignTaggingSocketPlug{tikz/picture/begin}{actualtext}
274 \AssignTaggingSocketPlug{tikz/picture/end}{actualtext}
275 \def\pgfsys@begin@text{}
276 \def\pgfsys@end@text{}
277 },
278 tagging-setup/artifact/.code =
279 {
280 \AssignTaggingSocketPlug{tikz/picture/begin}{artifact}
281 \AssignTaggingSocketPlug{tikz/picture/end}{artifact}
282 \def\pgfsys@begin@text{}
283 \def\pgfsys@end@text{}
284 },
285 }
286 }
287 \endinput
288 %%
289 %% End of file `latex-lab-testphase-tikz.sty'.