Debian Codegraph @

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

raw
1 %%
2 %% This is file `latex-lab-testphase-marginpar.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% latex-lab-marginpar.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-marginpar.dtx
36 %%
37 \def\ltlabmarginpardate{2025-07-23}
38 \def\ltlabmarginparversion{0.85h}
39
40 \ProvidesExplPackage {latex-lab-testphase-marginpar} {\ltlabmarginpardate} {\ltlabmarginparversion}
41 {Changes related to the tagging of the margin notes}
42 \int_new:N \g__kernel_marginpar_int
43 \cs_new_protected:Npn\__tag_get_marginpar_parent_aux:nn #1 #2
44 {
45 \str_if_eq:eeT{\use_ii:nn #1}{Part}{\seq_put_right:Nn\l__tag_tmpa_seq {#2}}
46 \str_if_eq:eeT{\use_ii:nn #1}{Sect}{\seq_put_right:Nn\l__tag_tmpa_seq {#2}}
47 }
48 \cs_new_protected:Npn \__tag_get_marginpar_parent:N #1
49 {
50 \seq_clear:N\l__tag_tmpa_seq
51 \seq_map_pairwise_function:NNN
52 \g__tag_struct_tag_stack_seq
53 \g__tag_struct_stack_seq
54 \__tag_get_marginpar_parent_aux:nn
55 \seq_put_right:Nn\l__tag_tmpa_seq {2}
56 \seq_get_left:NN \l__tag_tmpa_seq #1
57 }
58 \cs_generate_variant:Nn \tag_struct_begin:n {e}
59 \NewTaggingSocketPlug{marginpar/begin}{default}
60 {
61 \if_mode_horizontal:
62 \tag_mc_end:
63 \__tag_get_marginpar_parent:N \l__tag_tmpa_tl
64 \tag_struct_begin:e{tag=Aside,parent=\l__tag_tmpa_tl}%
65 \else:
66 \tag_struct_begin:n{tag=Aside}%
67 \fi:
68 }
69 \NewTaggingSocketPlug{marginpar/end}{default}
70 {
71 \tag_struct_end:
72 \if_mode_horizontal: \tag_mc_begin:n{} \fi:
73 }
74 \AssignTaggingSocketPlug{marginpar/begin}{default}
75 \AssignTaggingSocketPlug{marginpar/end}{default}
76
77 \long\def \@savemarbox #1#2{%
78 \UseTaggingSocket{marginpar/begin}
79 \global\setbox #1%
80 \color@vbox
81 \vtop{%
82 \hsize\marginparwidth
83 \@parboxrestore
84 \@marginparreset
85 #2\par
86 \@minipagefalse
87 \outer@nobreak
88 }%
89 \color@endbox
90 \UseTaggingSocket{marginpar/end}
91 }
92 \long\def\@ympar#1{%
93 \@savemarbox\@marbox{#1}%
94 \global\setbox\@currbox\copy\@marbox
95 \tag_suspend:n{\@ympar}
96 \@xympar
97 \tag_resume:n{\@ympar}}
98 \long\def\@xmpar[#1]#2{%
99 \int_gincr:N\g__kernel_marginpar_int
100 \property_if_recorded:eTF { tag_marginpar-opt-\int_use:N\g__kernel_marginpar_int }
101 {
102 \@savemarbox\@marbox {#1
103 \property_record:ee
104 { tag_marginpar-opt-\int_use:N\g__kernel_marginpar_int }{page}
105 }%
106 \tag_suspend:n{\@xmpar}
107 \@savemarbox\@currbox{#2}%
108 \tag_resume:n{\@xmpar}
109 }
110 {
111 \@savemarbox\@currbox{#2}%
112 \tag_suspend:n{\@xmpar}
113 \@savemarbox\@marbox{#1
114 \property_record:ee
115 { tag_marginpar-opt-\int_use:N\g__kernel_marginpar_int }{page}}
116 \tag_resume:n{\@xmpar}
117 }
118 \tag_suspend:n{\@xmpar}
119 \@xympar
120 \tag_resume:n{\@xmpar}
121 }
122 \endinput
123 %%
124 %% End of file `latex-lab-testphase-marginpar.sty'.