diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3kernel/l3box.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/l3kernel/l3box.sty | 431 |
1 files changed, 47 insertions, 384 deletions
diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3box.sty b/Master/texmf-dist/tex/latex/l3kernel/l3box.sty index c78a4f2122e..7e275624379 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3box.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3box.sty @@ -46,14 +46,14 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3box.dtx 3490 2012-03-04 01:00:53Z bruno $ +\GetIdInfo$Id: l3box.dtx 3986 2012-07-15 19:23:51Z joseph $ {L3 Experimental boxes} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\package_check_loaded_expl: +\__expl_package_check: \cs_new_protected:Npn \box_new:N #1 { - \chk_if_free_cs:N #1 + \__chk_if_free_cs:N #1 \newbox #1 } \cs_generate_variant:Nn \box_new:N { c } @@ -73,14 +73,14 @@ { \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 { cN , Nc , cc } -\cs_generate_variant:Nn \box_gset_eq:NN { cN , Nc , cc } +\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 { cN , Nc , cc } -\cs_generate_variant:Nn \box_gset_eq_clear:NN { cN , Nc , cc } +\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 @@ -96,11 +96,11 @@ \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: } + { \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: } + { \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: } + { \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 } @@ -109,13 +109,13 @@ \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 } + { \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 } + { \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 } + { \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 } + { \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 @@ -146,36 +146,50 @@ \cs_new_eq:NN \c_empty_box \voidb@x \cs_new_eq:NN \l_tmpa_box \@tempboxa \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 { - \box_if_exist:NTF #1 - { \tex_showbox:D \use:n {#1} } + \use:x { - \msg_kernel_error:nnx { kernel } { variable-not-defined } - { \token_to_str:N #1 } + \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_show:N { c } -\cs_new_protected:Npn \box_show:Nnn #1#2#3 +\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 {#2} - \int_set:Nn \tex_showboxdepth:D {#3} - \int_set_eq:NN \tex_tracingonline:D \c_one - \box_show:N #1 + \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_generate_variant:Nn \box_show:Nnn { c } -\cs_new_protected:Npn \box_show_full:N #1 - { \box_show:Nnn #1 { \c_max_int } { \c_max_int } } -\cs_generate_variant:Nn \box_show_full:N { c } \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} } + { \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 } @@ -195,7 +209,7 @@ \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} } + { \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_skip {#1} } \cs_new_protected:Npn \hbox_overlap_left:n #1 { \hbox_to_zero:n { \tex_hss:D #1 } } @@ -208,7 +222,7 @@ \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 } } + { \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 @@ -223,7 +237,7 @@ \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 } } + { \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 } @@ -251,358 +265,7 @@ \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: } -\fp_new:N \l_box_angle_fp -\fp_new:N \l_box_cos_fp -\fp_new:N \l_box_sin_fp -\dim_new:N \l_box_top_dim -\dim_new:N \l_box_bottom_dim -\dim_new:N \l_box_left_dim -\dim_new:N \l_box_right_dim -\dim_new:N \l_box_top_new_dim -\dim_new:N \l_box_bottom_new_dim -\dim_new:N \l_box_left_new_dim -\dim_new:N \l_box_right_new_dim -\box_new:N \l_box_internal_box -\fp_new:N \l_box_internal_fp -\fp_new:N \l_box_x_fp -\fp_new:N \l_box_y_fp -\fp_new:N \l_box_x_new_fp -\fp_new:N \l_box_y_new_fp -\cs_new_protected:Npn \box_rotate:Nn #1#2 - { - \hbox_set:Nn #1 - { - \group_begin: - \fp_set:Nn \l_box_angle_fp {#2} - \box_rotate_set_sin_cos: - \fp_compare:NNNTF \l_box_sin_fp = \c_zero_fp - { - \fp_compare:NNNTF \l_box_cos_fp = \c_one_fp - { \box_use:N #1 } - { \box_rotate_aux:N #1 } - } - { \box_rotate_aux:N #1 } - \group_end: - } - } -\cs_new_protected:Npn \box_rotate_aux:N #1 - { - \dim_set:Nn \l_box_top_dim { \box_ht:N #1 } - \dim_set:Nn \l_box_bottom_dim { -\box_dp:N #1 } - \dim_set:Nn \l_box_right_dim { \box_wd:N #1 } - \dim_zero:N \l_box_left_dim - \fp_compare:NNNTF \l_box_sin_fp > \c_zero_fp - { - \fp_compare:NNNTF \l_box_cos_fp > \c_zero_fp - { \box_rotate_quadrant_one: } - { \box_rotate_quadrant_two: } - } - { - \fp_compare:NNNTF \l_box_cos_fp < \c_zero_fp - { \box_rotate_quadrant_three: } - { \box_rotate_quadrant_four: } - } - \hbox_set:Nn \l_box_internal_box { \box_use:N #1 } - \hbox_set:Nn \l_box_internal_box - { - \tex_kern:D -\l_box_left_new_dim - \hbox:n - { - \driver_box_rotate_begin: - \box_use:N \l_box_internal_box - \driver_box_rotate_end: - } - } - \box_set_ht:Nn \l_box_internal_box { \l_box_top_new_dim } - \box_set_dp:Nn \l_box_internal_box { -\l_box_bottom_new_dim } - \box_set_wd:Nn \l_box_internal_box - { \l_box_right_new_dim - \l_box_left_new_dim } - \box_use:N \l_box_internal_box - } -\cs_new_protected:Npn \box_rotate_set_sin_cos: - { - \fp_set_eq:NN \l_box_internal_fp \l_box_angle_fp - \fp_div:Nn \l_box_internal_fp { 180 } - \fp_mul:Nn \l_box_internal_fp { \c_pi_fp } - \fp_sin:Nn \l_box_sin_fp { \l_box_internal_fp } - \fp_cos:Nn \l_box_cos_fp { \l_box_internal_fp } - } -\cs_new_protected:Npn \box_rotate_x:nnN #1#2#3 - { - \fp_set_from_dim:Nn \l_box_x_fp {#1} - \fp_set_from_dim:Nn \l_box_y_fp {#2} - \fp_set_eq:NN \l_box_x_new_fp \l_box_x_fp - \fp_set_eq:NN \l_box_internal_fp \l_box_y_fp - \fp_mul:Nn \l_box_x_new_fp { \l_box_cos_fp } - \fp_mul:Nn \l_box_internal_fp { \l_box_sin_fp } - \fp_sub:Nn \l_box_x_new_fp { \l_box_internal_fp } - \dim_set:Nn #3 { \fp_to_dim:N \l_box_x_new_fp } - } -\cs_new_protected:Npn \box_rotate_y:nnN #1#2#3 - { - \fp_set_from_dim:Nn \l_box_x_fp {#1} - \fp_set_from_dim:Nn \l_box_y_fp {#2} - \fp_set_eq:NN \l_box_y_new_fp \l_box_y_fp - \fp_set_eq:NN \l_box_internal_fp \l_box_x_fp - \fp_mul:Nn \l_box_y_new_fp { \l_box_cos_fp } - \fp_mul:Nn \l_box_internal_fp { \l_box_sin_fp } - \fp_add:Nn \l_box_y_new_fp { \l_box_internal_fp } - \dim_set:Nn #3 { \fp_to_dim:N \l_box_y_new_fp } -} -\cs_new_protected:Npn \box_rotate_quadrant_one: - { - \box_rotate_y:nnN \l_box_right_dim \l_box_top_dim - \l_box_top_new_dim - \box_rotate_y:nnN \l_box_left_dim \l_box_bottom_dim - \l_box_bottom_new_dim - \box_rotate_x:nnN \l_box_left_dim \l_box_top_dim - \l_box_left_new_dim - \box_rotate_x:nnN \l_box_right_dim \l_box_bottom_dim - \l_box_right_new_dim - } -\cs_new_protected:Npn \box_rotate_quadrant_two: - { - \box_rotate_y:nnN \l_box_right_dim \l_box_bottom_dim - \l_box_top_new_dim - \box_rotate_y:nnN \l_box_left_dim \l_box_top_dim - \l_box_bottom_new_dim - \box_rotate_x:nnN \l_box_right_dim \l_box_top_dim - \l_box_left_new_dim - \box_rotate_x:nnN \l_box_left_dim \l_box_bottom_dim - \l_box_right_new_dim - } -\cs_new_protected:Npn \box_rotate_quadrant_three: - { - \box_rotate_y:nnN \l_box_left_dim \l_box_bottom_dim - \l_box_top_new_dim - \box_rotate_y:nnN \l_box_right_dim \l_box_top_dim - \l_box_bottom_new_dim - \box_rotate_x:nnN \l_box_right_dim \l_box_bottom_dim - \l_box_left_new_dim - \box_rotate_x:nnN \l_box_left_dim \l_box_top_dim - \l_box_right_new_dim - } -\cs_new_protected:Npn \box_rotate_quadrant_four: - { - \box_rotate_y:nnN \l_box_left_dim \l_box_top_dim - \l_box_top_new_dim - \box_rotate_y:nnN \l_box_right_dim \l_box_bottom_dim - \l_box_bottom_new_dim - \box_rotate_x:nnN \l_box_left_dim \l_box_bottom_dim - \l_box_left_new_dim - \box_rotate_x:nnN \l_box_right_dim \l_box_top_dim - \l_box_right_new_dim - } -\fp_new:N \l_box_scale_x_fp -\fp_new:N \l_box_scale_y_fp -\cs_new_protected:Npn \box_resize:Nnn #1#2#3 - { - \hbox_set:Nn #1 - { - \group_begin: - \dim_set:Nn \l_box_top_dim { \box_ht:N #1 } - \dim_set:Nn \l_box_bottom_dim { -\box_dp:N #1 } - \dim_set:Nn \l_box_right_dim { \box_wd:N #1 } - \dim_zero:N \l_box_left_dim - \fp_set_from_dim:Nn \l_box_scale_x_fp {#2} - \fp_set_from_dim:Nn \l_box_internal_fp { \l_box_right_dim } - \fp_div:Nn \l_box_scale_x_fp { \l_box_internal_fp } - \fp_set_from_dim:Nn \l_box_scale_y_fp {#3} - \fp_set_from_dim:Nn \l_box_internal_fp - { \l_box_top_dim - \l_box_bottom_dim } - \fp_div:Nn \l_box_scale_y_fp { \l_box_internal_fp } - \fp_compare:NNNTF \l_box_scale_x_fp = \c_one_fp - { - \fp_compare:NNNTF \l_box_scale_y_fp = \c_one_fp - { \box_use:N #1 } - { \box_resize_aux:Nnn #1 {#2} {#3} } - } - { \box_resize_aux:Nnn #1 {#2} {#3} } - \group_end: - } - } -\cs_generate_variant:Nn \box_resize:Nnn { c } -\cs_new_protected:Npn \box_resize_aux:Nnn #1#2#3 - { - \dim_compare:nNnTF {#2} > \c_zero_dim - { \dim_set:Nn \l_box_right_new_dim {#2} } - { \dim_set:Nn \l_box_right_new_dim { \c_zero_dim - ( #2 ) } } - \dim_compare:nNnTF {#3} > \c_zero_dim - { - \dim_set:Nn \l_box_top_new_dim - { \fp_use:N \l_box_scale_y_fp \l_box_top_dim } - \dim_set:Nn \l_box_bottom_new_dim - { \fp_use:N \l_box_scale_y_fp \l_box_bottom_dim } - } - { - \dim_set:Nn \l_box_top_new_dim - { - \fp_use:N \l_box_scale_y_fp \l_box_top_dim } - \dim_set:Nn \l_box_bottom_new_dim - { - \fp_use:N \l_box_scale_y_fp \l_box_bottom_dim } - } - \box_resize_common:N #1 - } -\cs_new_protected:Npn \box_resize_to_ht_plus_dp:Nn #1#2 - { - \hbox_set:Nn #1 - { - \group_begin: - \dim_set:Nn \l_box_top_dim { \box_ht:N #1 } - \dim_set:Nn \l_box_bottom_dim { -\box_dp:N #1 } - \dim_set:Nn \l_box_right_dim { \box_wd:N #1 } - \dim_zero:N \l_box_left_dim - \fp_set_from_dim:Nn \l_box_scale_y_fp {#2} - \fp_set_from_dim:Nn \l_box_internal_fp - { \l_box_top_dim - \l_box_bottom_dim } - \fp_div:Nn \l_box_scale_y_fp { \l_box_internal_fp } - \fp_set_eq:NN \l_box_scale_x_fp \l_box_scale_y_fp - \fp_compare:NNNTF \l_box_scale_y_fp = \c_one_fp - { \box_use:N #1 } - { \box_resize_aux:Nnn #1 {#2} {#2} } - \group_end: - } - } -\cs_generate_variant:Nn \box_resize_to_ht_plus_dp:Nn { c } -\cs_new_protected:Npn \box_resize_to_wd:Nn #1#2 - { - \hbox_set:Nn #1 - { - \group_begin: - \dim_set:Nn \l_box_top_dim { \box_ht:N #1 } - \dim_set:Nn \l_box_bottom_dim { -\box_dp:N #1 } - \dim_set:Nn \l_box_right_dim { \box_wd:N #1 } - \dim_zero:N \l_box_left_dim - \fp_set_from_dim:Nn \l_box_scale_x_fp {#2} - \fp_set_from_dim:Nn \l_box_internal_fp { \l_box_right_dim } - \fp_div:Nn \l_box_scale_x_fp { \l_box_internal_fp } - \fp_set_eq:NN \l_box_scale_y_fp \l_box_scale_x_fp - \fp_compare:NNNTF \l_box_scale_x_fp = \c_one_fp - { \box_use:N #1 } - { \box_resize_aux:Nnn #1 {#2} {#2} } - \group_end: - } - } -\cs_generate_variant:Nn \box_resize_to_wd:Nn { c } -\cs_new_protected:Npn \box_scale:Nnn #1#2#3 - { - \hbox_set:Nn #1 - { - \group_begin: - \fp_set:Nn \l_box_scale_x_fp {#2} - \fp_set:Nn \l_box_scale_y_fp {#3} - \dim_set:Nn \l_box_top_dim { \box_ht:N #1 } - \dim_set:Nn \l_box_bottom_dim { -\box_dp:N #1 } - \dim_set:Nn \l_box_right_dim { \box_wd:N #1 } - \dim_zero:N \l_box_left_dim - \fp_compare:NNNTF \l_box_scale_x_fp = \c_one_fp - { - \fp_compare:NNNTF \l_box_scale_y_fp = \c_one_fp - { \box_use:N #1 } - { \box_scale_aux:Nnn #1 {#2} {#3} } - } - { \box_scale_aux:Nnn #1 {#2} {#3} } - \group_end: - } - } -\cs_generate_variant:Nn \box_scale:Nnn { c } -\cs_new_protected:Npn \box_scale_aux:Nnn #1#2#3 - { - \fp_compare:NNNTF \l_box_scale_y_fp > \c_zero_fp - { - \dim_set:Nn \l_box_top_new_dim { #3 \l_box_top_dim } - \dim_set:Nn \l_box_bottom_new_dim { #3 \l_box_bottom_dim } - } - { - \dim_set:Nn \l_box_top_new_dim { -#3 \l_box_bottom_dim } - \dim_set:Nn \l_box_bottom_new_dim { -#3 \l_box_top_dim } - } - \fp_compare:NNNTF \l_box_scale_x_fp > \c_zero_fp - { \l_box_right_new_dim #2 \l_box_right_dim } - { \l_box_right_new_dim -#2 \l_box_right_dim } - \box_resize_common:N #1 - } -\cs_new_protected:Npn \box_resize_common:N #1 - { - \hbox_set:Nn \l_box_internal_box - { - \driver_box_scale_begin: - \hbox_overlap_right:n { \box_use:N #1 } - \driver_box_scale_end: - } - \box_set_ht:Nn \l_box_internal_box { \l_box_top_new_dim } - \box_set_dp:Nn \l_box_internal_box { \l_box_bottom_new_dim } - \fp_compare:NNNTF \l_box_scale_x_fp < \c_zero_fp - { - \hbox_to_wd:nn { \l_box_right_new_dim } - { - \tex_kern:D \l_box_right_new_dim - \box_use:N \l_box_internal_box - \tex_hss:D - } - } - { - \box_set_wd:Nn \l_box_internal_box { \l_box_right_new_dim } - \box_use:N \l_box_internal_box - } - } -\cs_new_protected:Npn \box_clip:N #1 - { \hbox_set:Nn #1 { \driver_box_use_clip:N #1 } } -\cs_generate_variant:Nn \box_clip:N { c } -\cs_new_protected:Npn \box_trim:Nnnnn #1#2#3#4#5 - { - \box_set_wd:Nn #1 { \box_wd:N #1 - \dim_eval:n {#4} - \dim_eval:n {#2} } - \hbox_set:Nn #1 - { - \skip_horizontal:n { - \dim_eval:n {#2} } - \box_use:N #1 - } - \dim_compare:nNnTF { \box_dp:N #1 } > {#3} - { \box_set_dp:Nn #1 { \box_dp:N #1 - \dim_eval:n {#3} } } - { - \hbox_set:Nn #1 - { - \box_move_down:nn { \dim_eval:n {#3} - \box_dp:N #1 } - { \box_use:N #1 } - } - \box_set_dp:Nn #1 \c_zero_dim - } - \dim_compare:nNnTF { \box_ht:N #1 } > {#5} - { \box_set_ht:Nn #1 { \box_ht:N #1 - \dim_eval:n {#5} } } - { - \hbox_set:Nn #1 - { - \box_move_up:nn { \dim_eval:n {#5} - \box_ht:N #1 } - { \box_use:N #1 } - } - \box_set_ht:Nn #1 \c_zero_dim - } - } -\cs_generate_variant:Nn \box_trim:Nnnnn { c } -\cs_new_protected:Npn \box_viewport:Nnnnn #1#2#3#4#5 - { - \box_set_wd:Nn #1 { \dim_eval:n {#4} - \dim_eval:n {#2} } - \hbox_set:Nn #1 - { - \skip_horizontal:n { - \dim_eval:n {#2} } - \box_use:N #1 - } - \dim_compare:nNnTF {#3} > \c_zero_dim - { - \hbox_set:Nn #1 { \box_move_down:nn {#3} { \box_use:N #1 } } - \box_set_dp:Nn #1 \c_zero_dim - } - { \box_set_dp:Nn #1 { - \dim_eval:n {#3} } } - \dim_compare:nNnTF {#5} > \c_zero_dim - { \box_set_ht:Nn #1 {#5} } - { - \hbox_set:Nn #1 - { \box_move_up:nn { -\dim_eval:n {#5} } { \box_use:N #1 } } - \box_set_ht:Nn #1 \c_zero_dim - } - } -\cs_generate_variant:Nn \box_viewport:Nnnnn { c } -\cs_new_eq:NN \l_last_box \tex_lastbox:D + { \tex_setbox:D #1 \tex_vsplit:D #2 to \__dim_eval:w #3 \__dim_eval_end: } %% %% %% End of file `l3box.sty'. |