summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/l3kernel/l3box.sty
blob: 56016c455660e2ad58243f27b852167dc89b065c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
%%
%% This is file `l3box.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% l3box.dtx  (with options: `package')
%% 
%% EXPERIMENTAL CODE
%% 
%% Do not distribute this file without also distributing the
%% source files specified above.
%% 
%% Do not distribute a modified version of this file.
%% 
%% File: l3box.dtx Copyright (C) 2005-2012 The LaTeX3 Project
%%
%% It may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License (LPPL), either version 1.3c of this
%% license or (at your option) any later version.  The latest version
%% of this license is in the file
%%
%%    http://www.latex-project.org/lppl.txt
%%
%% This file is part of the "l3kernel bundle" (The Work in LPPL)
%% and all files in that bundle must be distributed together.
%%
%% The released version of this bundle is available from CTAN.
%%
%% -----------------------------------------------------------------------
%%
%% The development version of the bundle can be found at
%%
%%    http://www.latex-project.org/svnroot/experimental/trunk/
%%
%% for those people who are interested.
%%
%%%%%%%%%%%
%% NOTE: %%
%%%%%%%%%%%
%%
%%   Snapshots taken from the repository represent work in progress and may
%%   not work or may contain conflicting material!  We therefore ask
%%   people _not_ to put them into distributions, archives, etc. without
%%   prior consultation with the LaTeX3 Project.
%%
%% -----------------------------------------------------------------------
\RequirePackage{l3bootstrap}
\GetIdInfo$Id: l3box.dtx 4347 2012-12-08 09:11:29Z joseph $
  {L3 Experimental boxes}
\ProvidesExplPackage
  {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
\__expl_package_check:
\cs_new_protected:Npn \box_new:N #1
  {
    \__chk_if_free_cs:N #1
    \newbox #1
  }
\cs_generate_variant:Nn \box_new:N { c }
\cs_new_protected:Npn \box_clear:N #1
  { \box_set_eq:NN  #1 \c_empty_box }
\cs_new_protected:Npn \box_gclear:N #1
  { \box_gset_eq:NN #1 \c_empty_box }
\cs_generate_variant:Nn \box_clear:N  { c }
\cs_generate_variant:Nn \box_gclear:N { c }
\cs_new_protected:Npn \box_clear_new:N #1
  { \box_if_exist:NTF #1 { \box_clear:N #1 } { \box_new:N #1 } }
\cs_new_protected:Npn \box_gclear_new:N #1
  { \box_if_exist:NTF #1 { \box_gclear:N #1 } { \box_new:N #1 } }
\cs_generate_variant:Nn \box_clear_new:N  { c }
\cs_generate_variant:Nn \box_gclear_new:N { c }
\cs_new_protected:Npn \box_set_eq:NN #1#2
  { \tex_setbox:D #1 \tex_copy:D #2 }
\cs_new_protected:Npn \box_gset_eq:NN
  { \tex_global:D \box_set_eq:NN }
\cs_generate_variant:Nn \box_set_eq:NN  { c , Nc , cc }
\cs_generate_variant:Nn \box_gset_eq:NN { c , Nc , cc }
\cs_new_protected:Npn \box_set_eq_clear:NN #1#2
  { \tex_setbox:D #1 \tex_box:D #2 }
\cs_new_protected:Npn \box_gset_eq_clear:NN
  { \tex_global:D  \box_set_eq_clear:NN }
\cs_generate_variant:Nn \box_set_eq_clear:NN  { c , Nc , cc }
\cs_generate_variant:Nn \box_gset_eq_clear:NN { c , Nc , cc }
\cs_new_eq:NN \box_if_exist:NTF \cs_if_exist:NTF
\cs_new_eq:NN \box_if_exist:NT  \cs_if_exist:NT
\cs_new_eq:NN \box_if_exist:NF  \cs_if_exist:NF
\cs_new_eq:NN \box_if_exist_p:N \cs_if_exist_p:N
\cs_new_eq:NN \box_if_exist:cTF \cs_if_exist:cTF
\cs_new_eq:NN \box_if_exist:cT  \cs_if_exist:cT
\cs_new_eq:NN \box_if_exist:cF  \cs_if_exist:cF
\cs_new_eq:NN \box_if_exist_p:c \cs_if_exist_p:c
\cs_new_eq:NN \box_ht:N \tex_ht:D
\cs_new_eq:NN \box_dp:N \tex_dp:D
\cs_new_eq:NN \box_wd:N \tex_wd:D
\cs_generate_variant:Nn \box_ht:N { c }
\cs_generate_variant:Nn \box_dp:N { c }
\cs_generate_variant:Nn \box_wd:N { c }
\cs_new_protected:Npn \box_set_dp:Nn #1#2
  { \box_dp:N #1 \__dim_eval:w #2 \__dim_eval_end: }
\cs_new_protected:Npn \box_set_ht:Nn #1#2
  { \box_ht:N #1 \__dim_eval:w #2 \__dim_eval_end: }
\cs_new_protected:Npn \box_set_wd:Nn #1#2
  { \box_wd:N #1 \__dim_eval:w #2 \__dim_eval_end: }
\cs_generate_variant:Nn \box_set_ht:Nn { c }
\cs_generate_variant:Nn \box_set_dp:Nn { c }
\cs_generate_variant:Nn \box_set_wd:Nn { c }
\cs_new_eq:NN \box_use_clear:N \tex_box:D
\cs_new_eq:NN \box_use:N \tex_copy:D
\cs_generate_variant:Nn \box_use_clear:N { c }
\cs_generate_variant:Nn \box_use:N { c }
\cs_new_protected:Npn \box_move_left:nn #1#2
  { \tex_moveleft:D \__dim_eval:w #1 \__dim_eval_end: #2 }
\cs_new_protected:Npn \box_move_right:nn #1#2
  { \tex_moveright:D \__dim_eval:w #1 \__dim_eval_end: #2 }
\cs_new_protected:Npn \box_move_up:nn #1#2
  { \tex_raise:D \__dim_eval:w #1 \__dim_eval_end: #2 }
\cs_new_protected:Npn \box_move_down:nn #1#2
  { \tex_lower:D \__dim_eval:w #1 \__dim_eval_end: #2 }
\cs_new_eq:NN \if_hbox:N      \tex_ifhbox:D
\cs_new_eq:NN \if_vbox:N      \tex_ifvbox:D
\cs_new_eq:NN \if_box_empty:N \tex_ifvoid:D
\prg_new_conditional:Npnn \box_if_horizontal:N #1 { p , T , F , TF }
  { \if_hbox:N #1 \prg_return_true: \else: \prg_return_false: \fi: }
\prg_new_conditional:Npnn \box_if_vertical:N #1 { p , T , F , TF }
  { \if_vbox:N #1 \prg_return_true: \else: \prg_return_false: \fi: }
\cs_generate_variant:Nn \box_if_horizontal_p:N { c }
\cs_generate_variant:Nn \box_if_horizontal:NT  { c }
\cs_generate_variant:Nn \box_if_horizontal:NF  { c }
\cs_generate_variant:Nn \box_if_horizontal:NTF { c }
\cs_generate_variant:Nn \box_if_vertical_p:N { c }
\cs_generate_variant:Nn \box_if_vertical:NT  { c }
\cs_generate_variant:Nn \box_if_vertical:NF  { c }
\cs_generate_variant:Nn \box_if_vertical:NTF { c }
\prg_new_conditional:Npnn \box_if_empty:N #1 { p , T , F , TF }
  { \if_box_empty:N #1 \prg_return_true: \else: \prg_return_false: \fi: }
\cs_generate_variant:Nn \box_if_empty_p:N { c }
\cs_generate_variant:Nn \box_if_empty:NT  { c }
\cs_generate_variant:Nn \box_if_empty:NF  { c }
\cs_generate_variant:Nn \box_if_empty:NTF { c }
\cs_new_protected:Npn \box_set_to_last:N #1
  { \tex_setbox:D #1 \tex_lastbox:D }
\cs_new_protected:Npn \box_gset_to_last:N
  { \tex_global:D \box_set_to_last:N }
\cs_generate_variant:Nn \box_set_to_last:N  { c }
\cs_generate_variant:Nn \box_gset_to_last:N { c }
\box_new:N \c_empty_box
\box_new:N \l_tmpa_box
\box_new:N \l_tmpb_box
\box_new:N \g_tmpa_box
\box_new:N \g_tmpb_box
\cs_new_protected:Npn \box_show:N #1
  { \box_show:Nnn #1 \c_max_int \c_max_int }
\cs_generate_variant:Nn \box_show:N { c }
\cs_new_protected_nopar:Npn \box_show:Nnn
  { \__box_show:NNnn \c_one }
\cs_generate_variant:Nn \box_show:Nnn { c }
\cs_new_protected:Npn \box_log:N #1
  { \box_log:Nnn #1 \c_max_int \c_max_int }
\cs_generate_variant:Nn \box_log:N { c }
\cs_new_protected:Npn \box_log:Nnn #1#2#3
  {
    \use:x
      {
        \etex_interactionmode:D \c_zero
        \__box_show:NNnn \c_zero \exp_not:N #1
          { \int_eval:n {#2} } { \int_eval:n {#3} }
        \etex_interactionmode:D
            = \tex_the:D \etex_interactionmode:D \scan_stop:
      }
  }
\cs_generate_variant:Nn \box_log:Nnn { c }
\cs_new_protected:Npn \__box_show:NNnn #1#2#3#4
  {
    \group_begin:
      \int_set:Nn \tex_showboxbreadth:D {#3}
      \int_set:Nn \tex_showboxdepth:D   {#4}
      \int_set_eq:NN \tex_tracingonline:D #1
      \box_if_exist:NTF #2
        { \tex_showbox:D \use:n {#2} }
        {
          \__msg_kernel_error:nnx { kernel } { variable-not-defined }
            { \token_to_str:N #2 }
        }
    \group_end:
  }
\cs_new_protected:Npn \hbox:n { \tex_hbox:D \scan_stop: }
\cs_new_protected:Npn \hbox_set:Nn #1#2 { \tex_setbox:D #1 \tex_hbox:D {#2} }
\cs_new_protected:Npn \hbox_gset:Nn { \tex_global:D \hbox_set:Nn }
\cs_generate_variant:Nn \hbox_set:Nn { c }
\cs_generate_variant:Nn \hbox_gset:Nn { c }
\cs_new_protected:Npn \hbox_set_to_wd:Nnn #1#2#3
  { \tex_setbox:D #1 \tex_hbox:D to \__dim_eval:w #2 \__dim_eval_end: {#3} }
\cs_new_protected:Npn \hbox_gset_to_wd:Nnn
  { \tex_global:D \hbox_set_to_wd:Nnn }
\cs_generate_variant:Nn \hbox_set_to_wd:Nnn { c }
\cs_generate_variant:Nn \hbox_gset_to_wd:Nnn { c }
\cs_new_protected:Npn \hbox_set:Nw  #1
  { \tex_setbox:D #1 \tex_hbox:D \c_group_begin_token }
\cs_new_protected:Npn \hbox_gset:Nw
  { \tex_global:D \hbox_set:Nw }
\cs_generate_variant:Nn \hbox_set:Nw  { c }
\cs_generate_variant:Nn \hbox_gset:Nw { c }
\cs_new_eq:NN \hbox_set_end:  \c_group_end_token
\cs_new_eq:NN \hbox_gset_end: \c_group_end_token
\cs_new_eq:NN \hbox_set_inline_begin:N  \hbox_set:Nw
\cs_new_eq:NN \hbox_set_inline_begin:c  \hbox_set:cw
\cs_new_eq:NN \hbox_set_inline_end:     \hbox_set_end:
\cs_new_eq:NN \hbox_gset_inline_begin:N \hbox_gset:Nw
\cs_new_eq:NN \hbox_gset_inline_begin:c \hbox_gset:cw
\cs_new_eq:NN \hbox_gset_inline_end:    \hbox_gset_end:
\cs_new_protected:Npn \hbox_to_wd:nn #1#2
   { \tex_hbox:D to \__dim_eval:w #1 \__dim_eval_end: {#2} }
\cs_new_protected:Npn \hbox_to_zero:n #1 { \tex_hbox:D to \c_zero_dim {#1} }
\cs_new_protected:Npn \hbox_overlap_left:n  #1
  { \hbox_to_zero:n { \tex_hss:D #1 } }
\cs_new_protected:Npn \hbox_overlap_right:n #1
  { \hbox_to_zero:n { #1 \tex_hss:D } }
\cs_new_eq:NN \hbox_unpack:N \tex_unhcopy:D
\cs_new_eq:NN \hbox_unpack_clear:N \tex_unhbox:D
\cs_generate_variant:Nn \hbox_unpack:N { c }
\cs_generate_variant:Nn \hbox_unpack_clear:N { c }
\cs_new_protected:Npn \vbox:n #1     { \tex_vbox:D { #1 \par } }
\cs_new_protected:Npn \vbox_top:n #1 { \tex_vtop:D { #1 \par } }
\cs_new_protected:Npn \vbox_to_ht:nn #1#2
  { \tex_vbox:D to \__dim_eval:w #1 \__dim_eval_end: { #2 \par } }
\cs_new_protected:Npn \vbox_to_zero:n #1
  { \tex_vbox:D to \c_zero_dim { #1 \par } }
\cs_new_protected:Npn \vbox_set:Nn #1#2
  { \tex_setbox:D #1 \tex_vbox:D { #2 \par } }
\cs_new_protected:Npn \vbox_gset:Nn  { \tex_global:D \vbox_set:Nn }
\cs_generate_variant:Nn \vbox_set:Nn  { c }
\cs_generate_variant:Nn \vbox_gset:Nn { c }
\cs_new_protected:Npn \vbox_set_top:Nn #1#2
  { \tex_setbox:D #1 \tex_vtop:D { #2 \par } }
\cs_new_protected:Npn \vbox_gset_top:Nn
  { \tex_global:D \vbox_set_top:Nn }
\cs_generate_variant:Nn \vbox_set_top:Nn { c }
\cs_generate_variant:Nn \vbox_gset_top:Nn { c }
\cs_new_protected:Npn \vbox_set_to_ht:Nnn #1#2#3
  { \tex_setbox:D #1 \tex_vbox:D to \__dim_eval:w #2 \__dim_eval_end: { #3 \par } }
\cs_new_protected:Npn \vbox_gset_to_ht:Nnn
  { \tex_global:D \vbox_set_to_ht:Nnn }
\cs_generate_variant:Nn \vbox_set_to_ht:Nnn  { c }
\cs_generate_variant:Nn \vbox_gset_to_ht:Nnn { c }
\cs_new_protected:Npn \vbox_set:Nw #1
  { \tex_setbox:D #1 \tex_vbox:D \c_group_begin_token }
\cs_new_protected:Npn \vbox_gset:Nw
  { \tex_global:D \vbox_set:Nw }
\cs_generate_variant:Nn \vbox_set:Nw  { c }
\cs_generate_variant:Nn \vbox_gset:Nw { c }
\cs_new_protected:Npn \vbox_set_end:
  {
    \par
    \c_group_end_token
  }
\cs_new_eq:NN \vbox_gset_end: \vbox_set_end:
\cs_new_eq:NN \vbox_set_inline_begin:N  \vbox_set:Nw
\cs_new_eq:NN \vbox_set_inline_begin:c  \vbox_set:cw
\cs_new_eq:NN \vbox_set_inline_end:  \vbox_set_end:
\cs_new_eq:NN \vbox_gset_inline_begin:N \vbox_gset:Nw
\cs_new_eq:NN \vbox_gset_inline_begin:c \vbox_gset:cw
\cs_new_eq:NN \vbox_gset_inline_end: \vbox_gset_end:
\cs_new_eq:NN \vbox_unpack:N \tex_unvcopy:D
\cs_new_eq:NN \vbox_unpack_clear:N \tex_unvbox:D
\cs_generate_variant:Nn \vbox_unpack:N { c }
\cs_generate_variant:Nn \vbox_unpack_clear:N { c }
\cs_new_protected:Npn \vbox_set_split_to_ht:NNn #1#2#3
  { \tex_setbox:D #1 \tex_vsplit:D #2 to \__dim_eval:w #3 \__dim_eval_end: }
%% 
%%
%% End of file `l3box.sty'.