diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/xpackages/xcoffins/l3coffins.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/xpackages/xcoffins/l3coffins.sty | 208 |
1 files changed, 116 insertions, 92 deletions
diff --git a/Master/texmf-dist/tex/latex/xpackages/xcoffins/l3coffins.sty b/Master/texmf-dist/tex/latex/xpackages/xcoffins/l3coffins.sty index cf83a54f0c5..9c3636292f5 100644 --- a/Master/texmf-dist/tex/latex/xpackages/xcoffins/l3coffins.sty +++ b/Master/texmf-dist/tex/latex/xpackages/xcoffins/l3coffins.sty @@ -54,7 +54,7 @@ %% \RequirePackage{expl3} \RequirePackage{graphicx,xcolor,trace} -\GetIdInfo$Id: l3coffins.dtx 2109 2010-12-23 19:39:41Z joseph $ +\GetIdInfo$Id: l3coffins.dtx 2209 2011-03-23 08:33:19Z joseph $ {Coffins} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} @@ -108,60 +108,89 @@ \cs_new_nopar:Npn \coffin_saved_Height: { } \cs_new_nopar:Npn \coffin_saved_TotalHeight: { } \cs_new_nopar:Npn \coffin_saved_Width: { } -\cs_new_protected_nopar:Npn \coffin_clear:N #1 { - \box_clear:N #1 - \coffin_reset_structure:N #1 -} -\cs_new_protected_nopar:Npn \coffin_new:N #1 { - \cs_if_free:NTF #1 +\cs_new_protected:Npn \coffin_if_exist_execute:Nn #1#2 { + \cs_if_exist:NTF #1 { - \box_new:N #1 - \prop_new:c { l_coffin_corners_ \tex_number:D #1 _prop } - \prop_new:c { l_coffin_poles_ \tex_number:D #1 _prop } - \prop_gset_eq:cN { l_coffin_corners_ \tex_number:D #1 _prop } - \c_coffin_corners_prop - \prop_gset_eq:cN { l_coffin_poles_ \tex_number:D #1 _prop } - \c_coffin_poles_prop + \cs_if_exist:cTF { l_coffin_poles_ \tex_number:D #1 _prop } + { #2 } + { + \msg_kernel_error:nnx { coffin } { unknown-coffin } + { \token_to_str:N #1 } + } } { - \msg_kernel_error:nnx { coffin }{ variable-already-defined } + \msg_kernel_error:nnx { coffin } { unknown-coffin } { \token_to_str:N #1 } } } +\cs_new_protected_nopar:Npn \coffin_clear:N #1 { + \coffin_if_exist_execute:Nn #1 + { + \box_clear:N #1 + \coffin_reset_structure:N #1 + } +} +\cs_generate_variant:Nn \coffin_clear:N { c } +\cs_new_protected_nopar:Npn \coffin_new:N #1 { + \box_new:N #1 + \cs_gundefine:c { l_coffin_corners_ \tex_number:D #1 _prop } + \cs_gundefine:c { l_coffin_poles_ \tex_number:D #1 _prop } + \prop_new:c { l_coffin_corners_ \tex_number:D #1 _prop } + \prop_new:c { l_coffin_poles_ \tex_number:D #1 _prop } + \prop_gset_eq:cN { l_coffin_corners_ \tex_number:D #1 _prop } + \c_coffin_corners_prop + \prop_gset_eq:cN { l_coffin_poles_ \tex_number:D #1 _prop } + \c_coffin_poles_prop +} +\cs_generate_variant:Nn \coffin_new:N { c } \cs_new_protected:Npn \hcoffin_set:Nn #1#2 { - \hbox_set:Nn #1 + \coffin_if_exist_execute:Nn #1 { - \group_begin: - \set@color - #2 - \group_end: + \hbox_set:Nn #1 + { + \group_begin: + \set@color + #2 + \group_end: + } + \coffin_reset_structure:N #1 + \coffin_update_poles:N #1 + \coffin_update_corners:N #1 } - \coffin_reset_structure:N #1 - \coffin_update_poles:N #1 - \coffin_update_corners:N #1 } +\cs_generate_variant:Nn \hcoffin_set:Nn { c } \cs_new_protected:Npn \vcoffin_set:Nnn #1#2#3 { - \vbox_set:Nn #1 - { - \dim_set:Nn \tex_hsize:D {#2} - \group_begin: - \set@color - #3 - \group_end: - } - \coffin_reset_structure:N #1 - \coffin_update_poles:N #1 - \coffin_update_corners:N #1 - \vbox_set_top:Nn \l_coffin_tmp_box { \vbox_unpack:N #1 } - \dim_set:Nn \l_coffin_tmp_dim - { \box_ht:N #1 - \box_ht:N \l_coffin_tmp_box } - \coffin_set_pole:Nnx #1 { T } - { { 0 pt } { \dim_use:N \l_coffin_tmp_dim } { 1000 pt } { 0 pt } } + \coffin_if_exist_execute:Nn #1 + { + \vbox_set:Nn #1 + { + \dim_set:Nn \tex_hsize:D {#2} + \group_begin: + \set@color + #3 + \group_end: + } + \coffin_reset_structure:N #1 + \coffin_update_poles:N #1 + \coffin_update_corners:N #1 + \vbox_set_top:Nn \l_coffin_tmp_box { \vbox_unpack:N #1 } + \dim_set:Nn \l_coffin_tmp_dim + { \box_ht:N #1 - \box_ht:N \l_coffin_tmp_box } + \coffin_set_pole:Nnx #1 { T } + { + { 0 pt } { \dim_use:N \l_coffin_tmp_dim } { 1000 pt } { 0 pt } + } + } } +\cs_generate_variant:Nn \vcoffin_set:Nnn { c } \cs_new_protected_nopar:Npn \coffin_set_eq:NN #1#2 { - \box_set_eq:NN #1 #2 - \coffin_set_eq_structure:NN #1 #2 + \coffin_if_exist_execute:Nn #1 + { + \box_set_eq:NN #1 #2 + \coffin_set_eq_structure:NN #1 #2 + } } +\cs_generate_variant:Nn \coffin_set_eq:NN { c , Nc , cc } \coffin_new:N \c_empty_coffin \hbox_set:Nn \c_empty_coffin { } \coffin_new:N \l_coffin_aligned_coffin @@ -208,26 +237,34 @@ \cs_set_eq:NN \Width \coffin_saved_Width: } \cs_new_protected_nopar:Npn \coffin_set_horizontal_pole:Nnn #1#2#3 { - \coffin_set_user_dimensions:N #1 - \coffin_set_pole:Nnx #1 {#2} + \coffin_if_exist_execute:Nn #1 { - { 0 pt } { \tex_the:D \etex_dimexpr:D #3 \scan_stop: } - { 1000 pt } { 0 pt } + \coffin_set_user_dimensions:N #1 + \coffin_set_pole:Nnx #1 {#2} + { + { 0 pt } { \dim_eval:n {#3} } + { 1000 pt } { 0 pt } + } + \coffin_end_user_dimensions: } - \coffin_end_user_dimensions: } \cs_new_protected_nopar:Npn \coffin_set_vertical_pole:Nnn #1#2#3 { - \coffin_set_user_dimensions:N #1 - \coffin_set_pole:Nnx #1 {#2} + \coffin_if_exist_execute:Nn #1 { - { \tex_the:D \etex_dimexpr:D #3 \scan_stop: } { 0 pt } - { 0 pt } { 1000 pt } + \coffin_set_user_dimensions:N #1 + \coffin_set_pole:Nnx #1 {#2} + { + { \dim_eval:n {#3} } { 0 pt } + { 0 pt } { 1000 pt } + } + \coffin_end_user_dimensions: } - \coffin_end_user_dimensions: } \cs_new_protected_nopar:Npn \coffin_set_pole:Nnn #1#2#3 { \prop_put:cnn { l_coffin_poles_ \tex_number:D #1 _prop } {#2} {#3} } +\cs_generate_variant:Nn \coffin_set_horizontal_pole:Nnn { c } +\cs_generate_variant:Nn \coffin_set_vertical_pole:Nnn { c } \cs_generate_variant:Nn \coffin_set_pole:Nnn { Nnx } \cs_new_protected_nopar:Npn \coffin_update_corners:N #1 { \prop_put:cnx { l_coffin_corners_ \tex_number:D #1 _prop } { tl } @@ -406,6 +443,7 @@ \coffin_update_vertical_poles:NNN #1 #4 \l_coffin_aligned_coffin \coffin_set_eq:NN #1 \l_coffin_aligned_coffin } +\cs_generate_variant:Nn \coffin_join:NnnNnnnn { c , Nnnc , cnnc } \cs_new_protected_nopar:Npn \coffin_attach:NnnNnnnn #1#2#3#4#5#6#7#8 { \coffin_align:NnnNnnnnN #1 {#2} {#3} #4 {#5} {#6} {#7} {#8} \l_coffin_aligned_coffin @@ -432,6 +470,7 @@ \box_set_wd:Nn \l_coffin_aligned_coffin { \box_wd:N #1 } \box_set_eq:NN #1 \l_coffin_aligned_coffin } +\cs_generate_variant:Nn \coffin_attach:NnnNnnnn { c , Nnnc , cnnc } \cs_new_protected_nopar:Npn \coffin_align:NnnNnnnnN #1#2#3#4#5#6#7#8#9 { \coffin_calculate_intersection:Nnn #4 {#5} {#6} @@ -478,8 +517,8 @@ { l_coffin_corners_ \tex_number:D \l_coffin_aligned_coffin _prop } { #1 - #2 } { - { \tex_the:D \etex_dimexpr:D #3 + #5 \scan_stop: } - { \tex_the:D \etex_dimexpr:D #4 + #6 \scan_stop: } + { \dim_eval:n { #3 + #5 } } + { \dim_eval:n { #4 + #6 } } } } \cs_new_protected_nopar:Npn \coffin_update_vertical_poles:NNN #1#2#3 { @@ -532,15 +571,7 @@ \hbox_unpack:N \c_empty_box \box_use:N \l_coffin_aligned_coffin } -\cs_new_protected_nopar:Npn \coffin_typeset_overlay:Nnnnn #1#2#3#4#5 { - \coffin_align:NnnNnnnnN \c_empty_coffin { H } { l } - #1 {#2} {#3} {#4} {#5} \l_coffin_aligned_coffin - \box_set_ht:Nn \l_coffin_aligned_coffin { \c_zero_dim } - \box_set_dp:Nn \l_coffin_aligned_coffin { \c_zero_dim } - \box_set_wd:Nn \l_coffin_aligned_coffin { \c_zero_dim } - \hbox_unpack:N \c_empty_box - \box_use:N \l_coffin_aligned_coffin -} +\cs_generate_variant:Nn \coffin_typeset:Nnnnn { c } \prop_new:N \l_coffin_bounding_prop \dim_new:N \l_coffin_bounding_shift_dim \dim_new:N \l_coffin_left_corner_dim @@ -580,6 +611,7 @@ \prop_map_inline:cn { l_coffin_poles_ \tex_number:D #1 _prop } { \coffin_shift_pole:Nnnnnn #1 {##1} ##2 } } +\cs_generate_variant:Nn \coffin_rotate:Nn { c } \cs_new_protected_nopar:Npn \coffin_set_bounding:N #1 { \prop_put:Nnx \l_coffin_bounding_prop { tl } { { 0 pt } { \dim_use:N \box_ht:N #1 } } @@ -653,27 +685,15 @@ \cs_new_protected_nopar:Npn \coffin_shift_corner:Nnnn #1#2#3#4 { \prop_put:cnx { l_coffin_corners_ \tex_number:D #1 _ prop } {#2} { - { - \tex_the:D \etex_dimexpr:D #3 - \l_coffin_left_corner_dim - \scan_stop: - } - { - \tex_the:D \etex_dimexpr:D #4 - \l_coffin_bottom_corner_dim - \scan_stop: - } + { \dim_eval:n { #3 - \l_coffin_left_corner_dim } } + { \dim_eval:n { #4 - \l_coffin_bottom_corner_dim } } } } \cs_new_protected_nopar:Npn \coffin_shift_pole:Nnnnnn #1#2#3#4#5#6 { \prop_put:cnx { l_coffin_poles_ \tex_number:D #1 _ prop } {#2} { - { - \tex_the:D \etex_dimexpr:D #3 - \l_coffin_left_corner_dim - \scan_stop: - } - { - \tex_the:D \etex_dimexpr:D #4 - \l_coffin_bottom_corner_dim - \scan_stop: - } + { \dim_eval:n { #3 - \l_coffin_left_corner_dim } } + { \dim_eval:n { #4 - \l_coffin_bottom_corner_dim } } {#5} {#6} } } @@ -692,6 +712,7 @@ \hbox_set:Nn #1 { \resizebox * {#2} {#3} { \box_use:N #1 } } \coffin_resize_common:Nnn #1 {#2} {#3} } +\cs_generate_variant:Nn \coffin_resize:Nnn { c } \cs_new_protected_nopar:Npn \coffin_resize_common:Nnn #1#2#3 { \prop_map_inline:cn { l_coffin_corners_ \tex_number:D #1 _prop } { \coffin_scale_corner:Nnnn #1 {##1} ##2 } @@ -720,6 +741,7 @@ \coffin_resize_common:Nnn #1 { \l_coffin_scaled_width_dim } { \l_coffin_scaled_total_height_dim } } +\cs_generate_variant:Nn \coffin_scale:Nnn { c } \cs_new_protected_nopar:Npn \coffin_scale_vector:nnNN #1#2#3#4 { \fp_set_from_dim:Nn \l_coffin_tmp_fp {#1} \fp_mul:Nn \l_coffin_tmp_fp { \l_coffin_scale_x_fp } @@ -847,6 +869,7 @@ { #3 \l_coffin_display_offset_dim } { #4 \l_coffin_display_offset_dim } } +\cs_generate_variant:Nn \coffin_mark_handle:Nnnn { c } \cs_new_protected_nopar:Npn \coffin_display_handles:Nn #1#2 { \hcoffin_set:Nn \l_coffin_display_pole_coffin { @@ -921,6 +944,7 @@ { #3 \l_coffin_display_offset_dim } { #4 \l_coffin_display_offset_dim } } +\cs_generate_variant:Nn \coffin_display_handles:Nn { c } \cs_new_protected_nopar:Npn \coffin_display_attach:Nnnnn #1#2#3#4#5 { \coffin_calculate_intersection:Nnn #1 {#2} {#3} \dim_set:Nn \l_coffin_x_prime_dim { \l_coffin_x_dim } @@ -945,22 +969,17 @@ \box_set_eq:NN \l_coffin_display_coffin \l_coffin_aligned_coffin } \cs_new_protected_nopar:Npn \coffin_show_structure:N #1 { - \iow_term:x - { - \iow_newline: - Size~of~coffin~\token_to_str:N #1 : \iow_newline: - > ~ ht~=~\dim_use:N \box_ht:N #1 \iow_newline: - > ~ dp~=~\dim_use:N \box_dp:N #1 \iow_newline: - > ~ wd~=~\dim_use:N \box_wd:N #1 \iow_newline: - } \toks_clear:N \l_coffin_show_toks - \cs_if_free:cTF { l_coffin_poles_ \tex_number:D #1 _prop } - { - \iow_term:x { ---~No~poles~found~--- } - \toks_put_right:Nn \l_coffin_show_toks - { Is~this~really~a~coffin? } - } + \cs_if_exist:cTF { l_coffin_poles_ \tex_number:D #1 _prop } { + \iow_term:x + { + \iow_newline: + Size~of~coffin~\token_to_str:N #1 : \iow_newline: + > ~ ht~=~\dim_use:N \box_ht:N #1 \iow_newline: + > ~ dp~=~\dim_use:N \box_dp:N #1 \iow_newline: + > ~ wd~=~\dim_use:N \box_wd:N #1 \iow_newline: + } \iow_term:x { Poles~of~coffin~\token_to_str:N #1 : } \prop_map_inline:cn { l_coffin_poles_ \tex_number:D #1 _prop } { @@ -973,6 +992,11 @@ { ~ \exp_not:n {##1} \c_space_tl => ~ \exp_not:n {##2} } } } + { + \iow_term:x { ---~No~poles~found~--- } + \toks_put_right:Nn \l_coffin_show_toks + { Is~this~really~a~coffin? } + } \toks_show:N \l_coffin_show_toks } \cs_generate_variant:Nn \coffin_show_structure:N { c } |