From 738b6caad48af590f150127a579adc3ceec948b2 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 7 Jan 2011 01:32:07 +0000 Subject: xpackages (6jan11) git-svn-id: svn://tug.org/texlive/trunk@20954 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/xpackages/xbase/xtemplate.sty | 15 +- .../tex/latex/xpackages/xcoffins/l3coffins.sty | 1002 ++++++++++++++++++++ .../tex/latex/xpackages/xcoffins/xcoffins.sty | 125 +++ 3 files changed, 1136 insertions(+), 6 deletions(-) create mode 100644 Master/texmf-dist/tex/latex/xpackages/xcoffins/l3coffins.sty create mode 100644 Master/texmf-dist/tex/latex/xpackages/xcoffins/xcoffins.sty (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/latex/xpackages/xbase/xtemplate.sty b/Master/texmf-dist/tex/latex/xpackages/xbase/xtemplate.sty index 7c6356a2605..381a0ad19a6 100644 --- a/Master/texmf-dist/tex/latex/xpackages/xbase/xtemplate.sty +++ b/Master/texmf-dist/tex/latex/xpackages/xbase/xtemplate.sty @@ -54,7 +54,7 @@ %% ----------------------------------------------------------------------- %% \RequirePackage{l3names} -\GetIdInfo$Id: xtemplate.dtx 2063 2010-10-03 08:26:49Z mittelba $ +\GetIdInfo$Id: xtemplate.dtx 2115 2011-01-03 21:46:30Z joseph $ {Prototype document functions} @@ -775,11 +775,14 @@ \bool_set_true:N \l_xtemplate_global_bool } \cs_new:Npn \xtemplate_use_template:nnn #1#2#3 { - \xtemplate_recover_defaults:n { #1 / #2 } - \xtemplate_recover_vars:n { #1 / #2 } - \xtemplate_parse_values:nn { #1 / #2 } {#3} - \xtemplate_convert_to_assignments: - \use:c { \c_xtemplate_code_root_tl #1 / #2 :w } + \xtemplate_execute_if_code_exist:nnT {#1} {#2} + { + \xtemplate_recover_defaults:n { #1 / #2 } + \xtemplate_recover_vars:n { #1 / #2 } + \xtemplate_parse_values:nn { #1 / #2 } {#3} + \xtemplate_convert_to_assignments: + \use:c { \c_xtemplate_code_root_tl #1 / #2 :w } + } } \cs_new_nopar:Npn \xtemplate_assign_boolean: { \bool_if:NTF \l_xtemplate_global_bool { diff --git a/Master/texmf-dist/tex/latex/xpackages/xcoffins/l3coffins.sty b/Master/texmf-dist/tex/latex/xpackages/xcoffins/l3coffins.sty new file mode 100644 index 00000000000..cf83a54f0c5 --- /dev/null +++ b/Master/texmf-dist/tex/latex/xpackages/xcoffins/l3coffins.sty @@ -0,0 +1,1002 @@ +%% +%% This is file `l3coffins.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3coffins.dtx (with options: `package') +%% +%% (C) Copyright The LaTeX3 Project and any individual authors +%% listed elsewhere in this file. +%% +%% This is a generated file. +%% +%% This file was generated from file(s) of the xcoffins bundle. +%% ----------------------------------------------------------- +%% +%% This file may only be distributed together with a copy of this bundle. +%% You may however distribute the bundle without such generated files. +%% +%% ====================================================================== +%% +%% File l3coffins.dtx (C) Copyright 2010 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 ``xcoffins 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 LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +\RequirePackage{expl3} +\RequirePackage{graphicx,xcolor,trace} +\GetIdInfo$Id: l3coffins.dtx 2109 2010-12-23 19:39:41Z joseph $ + {Coffins} +\ProvidesExplPackage + {\filename}{\filedate}{\fileversion}{\filedescription} +\box_new:N \l_coffin_tmp_box +\dim_new:N \l_coffin_tmp_dim +\fp_new:N \l_coffin_tmp_fp +\tl_new:N \l_coffin_tmp_tl +\prop_new:N \c_coffin_corners_prop +\tl_set:Nn \l_coffin_tmp_tl { { 0 pt } { 0 pt } } +\prop_put:Nno \c_coffin_corners_prop { tl } { \l_coffin_tmp_tl } +\prop_put:Nno \c_coffin_corners_prop { tr } { \l_coffin_tmp_tl } +\prop_put:Nno \c_coffin_corners_prop { bl } { \l_coffin_tmp_tl } +\prop_put:Nno \c_coffin_corners_prop { br } { \l_coffin_tmp_tl } +\prop_new:N \c_coffin_poles_prop +\tl_set:Nn \l_coffin_tmp_tl { { 0 pt } { 0 pt } { 0 pt } { 1000 pt } } +\prop_put:Nno \c_coffin_poles_prop { l } { \l_coffin_tmp_tl } +\prop_put:Nno \c_coffin_poles_prop { hc } { \l_coffin_tmp_tl } +\prop_put:Nno \c_coffin_poles_prop { r } { \l_coffin_tmp_tl } +\tl_set:Nn \l_coffin_tmp_tl { { 0 pt } { 0 pt } { 1000 pt } { 0 pt } } +\prop_put:Nno \c_coffin_poles_prop { b } { \l_coffin_tmp_tl } +\prop_put:Nno \c_coffin_poles_prop { vc } { \l_coffin_tmp_tl } +\prop_put:Nno \c_coffin_poles_prop { t } { \l_coffin_tmp_tl } +\prop_put:Nno \c_coffin_poles_prop { B } { \l_coffin_tmp_tl } +\prop_put:Nno \c_coffin_poles_prop { H } { \l_coffin_tmp_tl } +\prop_put:Nno \c_coffin_poles_prop { T } { \l_coffin_tmp_tl } +\fp_new:N \l_coffin_calc_a_fp +\fp_new:N \l_coffin_calc_b_fp +\fp_new:N \l_coffin_calc_c_fp +\fp_new:N \l_coffin_calc_d_fp +\fp_new:N \l_coffin_calc_result_fp +\bool_new:N \l_coffin_error_bool +\dim_new:N \l_coffin_offset_x_dim +\dim_new:N \l_coffin_offset_y_dim +\tl_new:N \l_coffin_pole_a_tl +\tl_new:N \l_coffin_pole_b_tl +\fp_new:N \l_coffin_sin_fp +\fp_new:N \l_coffin_cos_fp +\dim_new:N \l_coffin_x_dim +\dim_new:N \l_coffin_y_dim +\dim_new:N \l_coffin_x_prime_dim +\dim_new:N \l_coffin_y_prime_dim +\fp_new:N \l_coffin_x_fp +\fp_new:N \l_coffin_y_fp +\fp_new:N \l_coffin_x_prime_fp +\fp_new:N \l_coffin_y_prime_fp +\dim_new:N \l_coffin_Depth_dim +\dim_new:N \l_coffin_Height_dim +\dim_new:N \l_coffin_TotalHeight_dim +\dim_new:N \l_coffin_Width_dim +\cs_new_nopar:Npn \coffin_saved_Depth: { } +\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 + { + \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 + } + { + \msg_kernel_error:nnx { coffin }{ variable-already-defined } + { \token_to_str:N #1 } + } +} +\cs_new_protected:Npn \hcoffin_set:Nn #1#2 { + \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 +} +\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 } } +} +\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_new:N \c_empty_coffin +\hbox_set:Nn \c_empty_coffin { } +\coffin_new:N \l_coffin_aligned_coffin +\coffin_new:N \l_coffin_aligned_internal_coffin +\cs_set_protected_nopar:Npn \coffin_get_pole:NnN #1#2#3 { + \prop_get:cnN { l_coffin_poles_ \tex_number:D #1 _prop } {#2} #3 + \quark_if_no_value:NT #3 + { + \msg_kernel_error:nnxx { coffin } { unknown-coffin-pole } + {#2} { \token_to_str:N #1 } + \tl_set:Nn #3 { { 0 pt } { 0 pt } { 0 pt } { 0 pt } } + } +} +\cs_new_protected_nopar:Npn \coffin_reset_structure:N #1 { + \prop_set_eq:cN { l_coffin_corners_ \tex_number:D #1 _prop } + \c_coffin_corners_prop + \prop_set_eq:cN { l_coffin_poles_ \tex_number:D #1 _prop } + \c_coffin_poles_prop +} +\cs_new_protected_nopar:Npn \coffin_set_eq_structure:NN #1#2 { + \prop_set_eq:cc { l_coffin_corners_ \tex_number:D #1 _prop } + { l_coffin_corners_ \tex_number:D #2 _prop } + \prop_set_eq:cc { l_coffin_poles_ \tex_number:D #1 _prop } + { l_coffin_poles_ \tex_number:D #2 _prop } +} +\cs_new_protected_nopar:Npn \coffin_set_user_dimensions:N #1 { + \cs_set_eq:NN \coffin_saved_Height: \Height + \cs_set_eq:NN \coffin_saved_Depth: \Depth + \cs_set_eq:NN \coffin_saved_TotalHeight: \TotalHeight + \cs_set_eq:NN \coffin_saved_Width: \Width + \cs_set_eq:NN \Height \l_coffin_Height_dim + \cs_set_eq:NN \Depth \l_coffin_Depth_dim + \cs_set_eq:NN \TotalHeight \l_coffin_TotalHeight_dim + \cs_set_eq:NN \Width \l_coffin_Width_dim + \dim_set:Nn \Height { \box_ht:N #1 } + \dim_set:Nn \Depth { \box_dp:N #1 } + \dim_set:Nn \TotalHeight { \box_ht:N #1 - \box_dp:N #1 } + \dim_set:Nn \Width { \box_wd:N #1 } +} +\cs_new_protected_nopar:Npn \coffin_end_user_dimensions: { + \cs_set_eq:NN \Height \coffin_saved_Height: + \cs_set_eq:NN \Depth \coffin_saved_Depth: + \cs_set_eq:NN \TotalHeight \coffin_saved_TotalHeight: + \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} + { + { 0 pt } { \tex_the:D \etex_dimexpr:D #3 \scan_stop: } + { 1000 pt } { 0 pt } + } + \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} + { + { \tex_the:D \etex_dimexpr:D #3 \scan_stop: } { 0 pt } + { 0 pt } { 1000 pt } + } + \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_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 } + { { 0 pt } { \dim_use:N \box_ht:N #1 } } + \prop_put:cnx { l_coffin_corners_ \tex_number:D #1 _prop } { tr } + { { \dim_use:N \box_wd:N #1 } { \dim_use:N \box_ht:N #1 } } + \dim_set:Nn \l_coffin_tmp_dim { - \dim_use:N \box_dp:N #1 } + \prop_put:cnx { l_coffin_corners_ \tex_number:D #1 _prop } { bl } + { { 0 pt } { \dim_use:N \l_coffin_tmp_dim } } + \prop_put:cnx { l_coffin_corners_ \tex_number:D #1 _prop } { br } + { { \dim_use:N \box_wd:N #1 } { \dim_use:N \l_coffin_tmp_dim } } +} +\cs_new_protected_nopar:Npn \coffin_update_poles:N #1 { + \dim_set:Nn \l_coffin_tmp_dim { 0.5 \box_wd:N #1 } + \prop_put:cnx { l_coffin_poles_ \tex_number:D #1 _prop } { hc } + { { \dim_use:N \l_coffin_tmp_dim } { 0 pt } { 0 pt } { 1000 pt } } + \prop_put:cnx { l_coffin_poles_ \tex_number:D #1 _prop } { r } + { { \dim_use:N \box_wd:N #1 } { 0 pt } { 0 pt } { 1000 pt } } + \dim_set:Nn \l_coffin_tmp_dim { ( \box_ht:N #1 - \box_dp:N #1 ) / 2 } + \prop_put:cnx { l_coffin_poles_ \tex_number:D #1 _prop } { vc } + { { 0 pt } { \dim_use:N \l_coffin_tmp_dim } { 1000 pt } { 0 pt } } + \prop_put:cnx { l_coffin_poles_ \tex_number:D #1 _prop } { t } + { { 0 pt } { \dim_use:N \box_ht:N #1 } { 1000 pt } { 0 pt } } + \dim_set:Nn \l_coffin_tmp_dim { \box_dp:N #1 } + \dim_compare:nNnF { \l_coffin_tmp_dim } = { \c_zero_dim } + { \dim_set:Nn \l_coffin_tmp_dim { -\l_coffin_tmp_dim } } + \prop_put:cnx { l_coffin_poles_ \tex_number:D #1 _prop } { b } + { { 0 pt } { \dim_use:N \l_coffin_tmp_dim } { 1000 pt } { 0 pt } } +} +\cs_new_protected_nopar:Npn \coffin_calculate_intersection:Nnn #1#2#3 { + \coffin_get_pole:NnN #1 {#2} \l_coffin_pole_a_tl + \coffin_get_pole:NnN #1 {#3} \l_coffin_pole_b_tl + \bool_set_false:N \l_coffin_error_bool + \exp_last_two_unbraced:Noo + \coffin_calculate_intersection:nnnnnnnn + \l_coffin_pole_a_tl \l_coffin_pole_b_tl + \bool_if:NT \l_coffin_error_bool + { + \msg_kernel_error:nn { coffin } { no-pole-intersection } + \dim_zero:N \l_coffin_x_dim + \dim_zero:N \l_coffin_y_dim + } +} +\cs_new_protected_nopar:Npn + \coffin_calculate_intersection:nnnnnnnn #1#2#3#4#5#6#7#8 { + \dim_compare:nNnTF {#3} = { \c_zero_dim } + { + \dim_set:Nn \l_coffin_x_dim {#1} + \dim_compare:nNnTF {#7} = { \c_zero_dim } + { \bool_set_true:N \l_coffin_error_bool } + { + \dim_compare:nNnTF {#8} = { \c_zero_dim } + { \dim_set:Nn \l_coffin_y_dim {#6} } + { + \coffin_calculate_intersection_aux:nnnnnN + {#1} {#5} {#6} {#7} {#8} \l_coffin_y_dim + } + } + } + { + \dim_compare:nNnTF {#4} = { \c_zero_dim } + { + \dim_set:Nn \l_coffin_y_dim {#2} + \dim_compare:nNnTF {#8} = { \c_zero_dim } + { \bool_set_true:N \l_coffin_error_bool } + { + \dim_compare:nNnTF {#7} = { \c_zero_dim } + { \dim_set:Nn \l_coffin_x_dim {#5} } + { + \coffin_calculate_intersection_aux:nnnnnN + {#2} {#6} {#5} {#8} {#7} \l_coffin_x_dim + } + } + } + { + \dim_compare:nNnTF {#7} = { \c_zero_dim } + { + \dim_set:Nn \l_coffin_x_dim {#5} + \coffin_calculate_intersection_aux:nnnnnN + {#5} {#1} {#2} {#3} {#4} \l_coffin_y_dim + } + { + \dim_compare:nNnTF {#8} = { \c_zero_dim } + { + \dim_set:Nn \l_coffin_x_dim {#6} + \coffin_calculate_intersection_aux:nnnnnN + {#6} {#2} {#1} {#4} {#3} \l_coffin_x_dim + } + { + \fp_set_from_dim:Nn \l_coffin_calc_a_fp {#3} + \fp_set_from_dim:Nn \l_coffin_calc_b_fp {#4} + \fp_set_from_dim:Nn \l_coffin_calc_c_fp {#7} + \fp_set_from_dim:Nn \l_coffin_calc_d_fp {#8} + \fp_div:Nn \l_coffin_calc_b_fp \l_coffin_calc_a_fp + \fp_div:Nn \l_coffin_calc_d_fp \l_coffin_calc_c_fp + \fp_compare:nNnTF + { \l_coffin_calc_b_fp } = { \l_coffin_calc_d_fp } + { \bool_set_true:N \l_coffin_error_bool } + { + \fp_set_from_dim:Nn \l_coffin_calc_result_fp {#6} + \fp_set_from_dim:Nn \l_coffin_calc_a_fp {#2} + \fp_sub:Nn \l_coffin_calc_result_fp + { \l_coffin_calc_a_fp } + \fp_set_from_dim:Nn \l_coffin_calc_a_fp {#1} + \fp_mul:Nn \l_coffin_calc_a_fp + { \l_coffin_calc_b_fp } + \fp_add:Nn \l_coffin_calc_result_fp + { \l_coffin_calc_a_fp } + \fp_set_from_dim:Nn \l_coffin_calc_a_fp {#5} + \fp_mul:Nn \l_coffin_calc_a_fp + { \l_coffin_calc_d_fp } + \fp_sub:Nn \l_coffin_calc_result_fp + { \l_coffin_calc_a_fp } + \fp_sub:Nn \l_coffin_calc_b_fp + { \l_coffin_calc_d_fp } + \fp_div:Nn \l_coffin_calc_result_fp + { \l_coffin_calc_b_fp } + \dim_set:Nn \l_coffin_x_dim + { \fp_to_dim:N \l_coffin_calc_result_fp } + \coffin_calculate_intersection_aux:nnnnnN + { \l_coffin_x_dim } + {#5} {#6} {#8} {#7} \l_coffin_y_dim + } + } + } + } + } +} +\cs_new_protected_nopar:Npn + \coffin_calculate_intersection_aux:nnnnnN #1#2#3#4#5#6 { + \fp_set_from_dim:Nn \l_coffin_calc_result_fp {#1} + \fp_set_from_dim:Nn \l_coffin_calc_a_fp {#2} + \fp_set_from_dim:Nn \l_coffin_calc_b_fp {#3} + \fp_set_from_dim:Nn \l_coffin_calc_c_fp {#4} + \fp_set_from_dim:Nn \l_coffin_calc_d_fp {#5} + \fp_sub:Nn \l_coffin_calc_result_fp { \l_coffin_calc_a_fp } + \fp_div:Nn \l_coffin_calc_result_fp { \l_coffin_calc_d_fp } + \fp_mul:Nn \l_coffin_calc_result_fp { \l_coffin_calc_c_fp } + \fp_add:Nn \l_coffin_calc_result_fp { \l_coffin_calc_b_fp } + \dim_set:Nn #6 { \fp_to_dim:N \l_coffin_calc_result_fp } +} +\cs_new_protected_nopar:Npn \coffin_join:NnnNnnnn #1#2#3#4#5#6#7#8 { + \coffin_align:NnnNnnnnN + #1 {#2} {#3} #4 {#5} {#6} {#7} {#8} \l_coffin_aligned_coffin + \hbox_set:Nn \l_coffin_aligned_coffin + { + \dim_compare:nNnT { \l_coffin_offset_x_dim } < { \c_zero_dim } + { \tex_kern:D -\l_coffin_offset_x_dim } + \hbox_unpack:N \l_coffin_aligned_coffin + \dim_set:Nn \l_coffin_tmp_dim + { \l_coffin_offset_x_dim - \box_wd:N #1 + \box_wd:N #4 } + \dim_compare:nNnT { \l_coffin_tmp_dim } < { \c_zero_dim } + { \tex_kern:D -\l_coffin_tmp_dim } + } + \coffin_reset_structure:N \l_coffin_aligned_coffin + \prop_clear:c + { + l_coffin_corners_ \tex_number:D \l_coffin_aligned_coffin _ prop + } + \coffin_update_poles:N \l_coffin_aligned_coffin + \dim_compare:nNnTF { \l_coffin_offset_x_dim } < { \c_zero_dim } + { + \coffin_offset_poles:Nnn #1 { -\l_coffin_offset_x_dim } { 0 pt } + \coffin_offset_poles:Nnn #4 { 0 pt } { \l_coffin_offset_y_dim } + \coffin_offset_corners:Nnn #1 { -\l_coffin_offset_x_dim } { 0 pt } + \coffin_offset_corners:Nnn #4 { 0 pt } { \l_coffin_offset_y_dim } + } + { + \coffin_offset_poles:Nnn #1 { 0 pt } { 0 pt } + \coffin_offset_poles:Nnn #4 + { \l_coffin_offset_x_dim } { \l_coffin_offset_y_dim } + \coffin_offset_corners:Nnn #1 { 0 pt } { 0 pt } + \coffin_offset_corners:Nnn #4 + { \l_coffin_offset_x_dim } { \l_coffin_offset_y_dim } + } + \coffin_update_vertical_poles:NNN #1 #4 \l_coffin_aligned_coffin + \coffin_set_eq:NN #1 \l_coffin_aligned_coffin +} +\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 + \box_set_ht:Nn \l_coffin_aligned_coffin { \box_ht:N #1 } + \box_set_dp:Nn \l_coffin_aligned_coffin { \box_dp:N #1 } + \box_set_wd:Nn \l_coffin_aligned_coffin { \box_wd:N #1 } + \coffin_reset_structure:N \l_coffin_aligned_coffin + \prop_set_eq:cc + { l_coffin_corners_ \tex_number:D \l_coffin_aligned_coffin _prop } + { l_coffin_corners_ \tex_number:D #1 _prop } + \coffin_update_poles:N \l_coffin_aligned_coffin + \coffin_offset_poles:Nnn #1 { 0 pt } { 0 pt } + \coffin_offset_poles:Nnn #4 + { \l_coffin_offset_x_dim } { \l_coffin_offset_y_dim } + \coffin_update_vertical_poles:NNN #1 #4 \l_coffin_aligned_coffin + \coffin_set_eq:NN #1 \l_coffin_aligned_coffin +} +\cs_new_protected_nopar:Npn + \coffin_attach_mark:NnnNnnnn #1#2#3#4#5#6#7#8 { + \coffin_align:NnnNnnnnN + #1 {#2} {#3} #4 {#5} {#6} {#7} {#8} \l_coffin_aligned_coffin + \box_set_ht:Nn \l_coffin_aligned_coffin { \box_ht:N #1 } + \box_set_dp:Nn \l_coffin_aligned_coffin { \box_dp:N #1 } + \box_set_wd:Nn \l_coffin_aligned_coffin { \box_wd:N #1 } + \box_set_eq:NN #1 \l_coffin_aligned_coffin +} +\cs_new_protected_nopar:Npn + \coffin_align:NnnNnnnnN #1#2#3#4#5#6#7#8#9 { + \coffin_calculate_intersection:Nnn #4 {#5} {#6} + \dim_set:Nn \l_coffin_x_prime_dim { \l_coffin_x_dim } + \dim_set:Nn \l_coffin_y_prime_dim { \l_coffin_y_dim } + \coffin_calculate_intersection:Nnn #1 {#2} {#3} + \dim_set:Nn \l_coffin_offset_x_dim + { \l_coffin_x_dim - \l_coffin_x_prime_dim + #7 } + \dim_set:Nn \l_coffin_offset_y_dim + { \l_coffin_y_dim - \l_coffin_y_prime_dim + #8 } + \hbox_set:Nn \l_coffin_aligned_internal_coffin + { + \box_use:N #1 + \tex_kern:D -\box_wd:N #1 + \tex_kern:D \l_coffin_offset_x_dim + \box_move_up:nn { \l_coffin_offset_y_dim } { \box_use:N #4 } + } + \coffin_set_eq:NN #9 \l_coffin_aligned_internal_coffin +} +\cs_new_protected_nopar:Npn \coffin_offset_poles:Nnn #1#2#3 { + \prop_map_inline:cn { l_coffin_poles_ \tex_number:D #1 _prop } + { \coffin_offset_pole:Nnnnnnn #1 {##1} ##2 {#2} {#3} } +} +\cs_new_protected_nopar:Npn + \coffin_offset_pole:Nnnnnnn #1#2#3#4#5#6#7#8 { + \dim_set:Nn \l_coffin_x_dim { #3 + #7 } + \dim_set:Nn \l_coffin_y_dim { #4 + #8 } + \tl_if_in:nnTF {#2} { - } + { \tl_set:Nn \l_coffin_tmp_tl { {#2} } } + { \tl_set:Nn \l_coffin_tmp_tl { { #1 - #2 } } } + \exp_last_unbraced:NNo \coffin_set_pole:Nnx \l_coffin_aligned_coffin + { \l_coffin_tmp_tl } + { + { \dim_use:N \l_coffin_x_dim } { \dim_use:N \l_coffin_y_dim } + {#5} {#6} + } +} +\cs_new_protected_nopar:Npn \coffin_offset_corners:Nnn #1#2#3 { + \prop_map_inline:cn { l_coffin_corners_ \tex_number:D #1 _prop } + { \coffin_offset_corner:Nnnnn #1 {##1} ##2 {#2} {#3} } +} +\cs_new_protected_nopar:Npn \coffin_offset_corner:Nnnnn #1#2#3#4#5#6 { + \prop_put:cnx + { 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: } + } +} +\cs_new_protected_nopar:Npn \coffin_update_vertical_poles:NNN #1#2#3 { + \coffin_get_pole:NnN #3 { #1 -T } \l_coffin_pole_a_tl + \coffin_get_pole:NnN #3 { #2 -T } \l_coffin_pole_b_tl + \exp_last_two_unbraced:Noo \coffin_update_T:nnnnnnnnN + \l_coffin_pole_a_tl \l_coffin_pole_b_tl #3 + \coffin_get_pole:NnN #3 { #1 -B } \l_coffin_pole_a_tl + \coffin_get_pole:NnN #3 { #2 -B } \l_coffin_pole_b_tl + \exp_last_two_unbraced:Noo \coffin_update_B:nnnnnnnnN + \l_coffin_pole_a_tl \l_coffin_pole_b_tl #3 +} +\cs_new_protected_nopar:Npn + \coffin_update_T:nnnnnnnnN #1#2#3#4#5#6#7#8#9 { + \dim_compare:nNnTF {#2} < {#6} + { + \coffin_set_pole:Nnx #9 { T } + { { 0 pt } {#6} { 1000 pt } { 0 pt } } + } + { + \coffin_set_pole:Nnx #9 { T } + { { 0 pt } {#2} { 1000 pt } { 0 pt } } + } +} +\cs_new_protected_nopar:Npn + \coffin_update_B:nnnnnnnnN #1#2#3#4#5#6#7#8#9 { + \dim_compare:nNnTF {#2} < {#6} + { + \coffin_set_pole:Nnx #9 { B } + { { 0 pt } {#2} { 1000 pt } { 0 pt } } + } + { + \coffin_set_pole:Nnx #9 { B } + { { 0 pt } {#6} { 1000 pt } { 0 pt } } + } +} +\cs_new_protected_nopar:Npn \coffin_typeset:Nnnnn #1#2#3#4#5 { + \coffin_align:NnnNnnnnN \c_empty_coffin { H } { l } + #1 {#2} {#3} {#4} {#5} \l_coffin_aligned_coffin + \hbox_set:Nn \l_coffin_aligned_coffin + { + \dim_compare:nNnT { \l_coffin_offset_x_dim } < { \c_zero_dim } + { \tex_kern:D -\l_coffin_offset_x_dim } + \hbox_unpack:N \l_coffin_aligned_coffin + \dim_set:Nn \l_coffin_tmp_dim + { \l_coffin_offset_x_dim + \box_wd:N #1 } + \dim_compare:nNnT { \l_coffin_tmp_dim } < { \c_zero_dim } + { \tex_kern:D -\l_coffin_tmp_dim } + } + \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 +} +\prop_new:N \l_coffin_bounding_prop +\dim_new:N \l_coffin_bounding_shift_dim +\dim_new:N \l_coffin_left_corner_dim +\dim_new:N \l_coffin_right_corner_dim +\dim_new:N \l_coffin_bottom_corner_dim +\dim_new:N \l_coffin_top_corner_dim +\cs_new_protected_nopar:Npn \coffin_rotate:Nn #1#2 { + \fp_set:Nn \l_coffin_tmp_fp {#2} + \fp_div:Nn \l_coffin_tmp_fp { 180 } + \fp_mul:Nn \l_coffin_tmp_fp { \c_pi_fp } + \fp_sin:Nn \l_coffin_sin_fp { \l_coffin_tmp_fp } + \fp_cos:Nn \l_coffin_cos_fp { \l_coffin_tmp_fp } + \prop_map_inline:cn { l_coffin_corners_ \tex_number:D #1 _prop } + { \coffin_rotate_corner:Nnnn #1 {##1} ##2 } + \prop_map_inline:cn { l_coffin_poles_ \tex_number:D #1 _prop } + { \coffin_rotate_pole:Nnnnnn #1 {##1} ##2 } + \coffin_set_bounding:N #1 + \prop_map_inline:Nn \l_coffin_bounding_prop + { \coffin_rotate_bounding:nnn {##1} ##2 } + \coffin_find_corner_maxima:N #1 + \coffin_find_bounding_shift: + \hbox_set:Nn #1 { \rotatebox {#2} { \box_use:N #1 } } + \hbox_set:Nn #1 + { + \tex_kern:D \l_coffin_bounding_shift_dim + \tex_kern:D -\l_coffin_left_corner_dim + \box_move_down:nn { \l_coffin_bottom_corner_dim } + { \box_use:N #1 } + } + \box_set_ht:Nn #1 + { \l_coffin_top_corner_dim - \l_coffin_bottom_corner_dim } + \box_set_dp:Nn #1 { 0 pt } + \box_set_wd:Nn #1 + { \l_coffin_right_corner_dim - \l_coffin_left_corner_dim } + \prop_map_inline:cn { l_coffin_corners_ \tex_number:D #1 _prop } + { \coffin_shift_corner:Nnnn #1 {##1} ##2 } + \prop_map_inline:cn { l_coffin_poles_ \tex_number:D #1 _prop } + { \coffin_shift_pole:Nnnnnn #1 {##1} ##2 } +} +\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 } } + \prop_put:Nnx \l_coffin_bounding_prop { tr } + { { \dim_use:N \box_wd:N #1 } { \dim_use:N \box_ht:N #1 } } + \dim_set:Nn \l_coffin_tmp_dim { - \dim_use:N \box_dp:N #1 } + \prop_put:Nnx \l_coffin_bounding_prop { bl } + { { 0 pt } { \dim_use:N \l_coffin_tmp_dim } } + \prop_put:Nnx \l_coffin_bounding_prop { br } + { { \dim_use:N \box_wd:N #1 } { \dim_use:N \l_coffin_tmp_dim } } +} +\cs_new_protected_nopar:Npn \coffin_rotate_bounding:nnn #1#2#3 { + \coffin_rotate_vector:nnNN {#2} {#3} \l_coffin_x_dim \l_coffin_y_dim + \prop_put:Nnx \l_coffin_bounding_prop {#1} + { { \dim_use:N \l_coffin_x_dim } { \dim_use:N \l_coffin_y_dim } } +} +\cs_new_protected_nopar:Npn \coffin_rotate_corner:Nnnn #1#2#3#4 { + \coffin_rotate_vector:nnNN {#3} {#4} \l_coffin_x_dim \l_coffin_y_dim + \prop_put:cnx { l_coffin_corners_ \tex_number:D #1 _prop } {#2} + { { \dim_use:N \l_coffin_x_dim } { \dim_use:N \l_coffin_y_dim } } +} +\cs_new_protected_nopar:Npn \coffin_rotate_pole:Nnnnnn #1#2#3#4#5#6 { + \coffin_rotate_vector:nnNN {#3} {#4} \l_coffin_x_dim \l_coffin_y_dim + \coffin_rotate_vector:nnNN {#5} {#6} + \l_coffin_x_prime_dim \l_coffin_y_prime_dim + \coffin_set_pole:Nnx #1 {#2} + { + { \dim_use:N \l_coffin_x_dim } { \dim_use:N \l_coffin_y_dim } + { \dim_use:N \l_coffin_x_prime_dim } + { \dim_use:N \l_coffin_y_prime_dim } + } +} +\cs_new_protected_nopar:Npn \coffin_rotate_vector:nnNN #1#2#3#4 { + \fp_set_from_dim:Nn \l_coffin_x_fp {#1} + \fp_set_from_dim:Nn \l_coffin_y_fp {#2} + \fp_set_eq:NN \l_coffin_x_prime_fp \l_coffin_x_fp + \fp_set_eq:NN \l_coffin_tmp_fp \l_coffin_y_fp + \fp_mul:Nn \l_coffin_x_prime_fp { \l_coffin_cos_fp } + \fp_mul:Nn \l_coffin_tmp_fp { \l_coffin_sin_fp } + \fp_sub:Nn \l_coffin_x_prime_fp { \l_coffin_tmp_fp } + \fp_set_eq:NN \l_coffin_y_prime_fp \l_coffin_y_fp + \fp_set_eq:NN \l_coffin_tmp_fp \l_coffin_x_fp + \fp_mul:Nn \l_coffin_y_prime_fp { \l_coffin_cos_fp } + \fp_mul:Nn \l_coffin_tmp_fp { \l_coffin_sin_fp } + \fp_add:Nn \l_coffin_y_prime_fp { \l_coffin_tmp_fp } + \dim_set:Nn #3 { \fp_to_dim:N \l_coffin_x_prime_fp } + \dim_set:Nn #4 { \fp_to_dim:N \l_coffin_y_prime_fp } +} +\cs_new_protected_nopar:Npn \coffin_find_corner_maxima:N #1 { + \dim_set:Nn \l_coffin_top_corner_dim { -\c_max_dim } + \dim_set:Nn \l_coffin_right_corner_dim { -\c_max_dim } + \dim_set:Nn \l_coffin_bottom_corner_dim { \c_max_dim } + \dim_set:Nn \l_coffin_left_corner_dim { \c_max_dim } + \prop_map_inline:cn { l_coffin_corners_ \tex_number:D #1 _prop } + { \coffin_find_corner_maxima_aux:nn ##2 } +} +\cs_new_protected_nopar:Npn \coffin_find_corner_maxima_aux:nn #1#2 { + \dim_set_min:Nn \l_coffin_left_corner_dim {#1} + \dim_set_max:Nn \l_coffin_right_corner_dim {#1} + \dim_set_min:Nn \l_coffin_bottom_corner_dim {#2} + \dim_set_max:Nn \l_coffin_top_corner_dim {#2} +} +\cs_new_protected_nopar:Npn \coffin_find_bounding_shift: { + \dim_set:Nn \l_coffin_bounding_shift_dim { \c_max_dim } + \prop_map_inline:Nn \l_coffin_bounding_prop + { \coffin_find_bounding_shift_aux:nn ##2 } +} +\cs_new_protected_nopar:Npn \coffin_find_bounding_shift_aux:nn #1#2 { + \dim_set_min:Nn \l_coffin_bounding_shift_dim {#1} +} +\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: + } + } +} +\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: + } + {#5} {#6} + } +} +\fp_new:N \l_coffin_scale_x_fp +\fp_new:N \l_coffin_scale_y_fp +\dim_new:N \l_coffin_scaled_total_height_dim +\dim_new:N \l_coffin_scaled_width_dim +\cs_new_protected_nopar:Npn \coffin_resize:Nnn #1#2#3 { + \coffin_set_user_dimensions:N #1 + \fp_set_from_dim:Nn \l_coffin_scale_x_fp {#2} + \fp_set_from_dim:Nn \l_coffin_tmp_fp { \Width } + \fp_div:Nn \l_coffin_scale_x_fp { \l_coffin_tmp_fp } + \fp_set_from_dim:Nn \l_coffin_scale_y_fp {#3} + \fp_set_from_dim:Nn \l_coffin_tmp_fp { \TotalHeight } + \fp_div:Nn \l_coffin_scale_y_fp { \l_coffin_tmp_fp } + \hbox_set:Nn #1 { \resizebox * {#2} {#3} { \box_use:N #1 } } + \coffin_resize_common:Nnn #1 {#2} {#3} +} +\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 } + \prop_map_inline:cn { l_coffin_poles_ \tex_number:D #1 _prop } + { \coffin_scale_pole:Nnnnnn #1 {##1} ##2 } + \fp_compare:NNNT \l_coffin_scale_x_fp < \c_zero_fp + { + \prop_map_inline:cn { l_coffin_corners_ \tex_number:D #1 _prop } + { \coffin_x_shift_corner:Nnnn #1 {##1} ##2 } + \prop_map_inline:cn { l_coffin_poles_ \tex_number:D #1 _prop } + { \coffin_x_shift_pole:Nnnnnn #1 {##1} ##2 } + } + \coffin_end_user_dimensions: +} +\cs_new_protected_nopar:Npn \coffin_scale:Nnn #1#2#3 { + \coffin_set_user_dimensions:N #1 + \fp_set:Nn \l_coffin_scale_x_fp {#2} + \fp_set:Nn \l_coffin_scale_y_fp {#3} + \fp_compare:NNNTF \l_coffin_scale_y_fp > \c_zero_fp + { \l_coffin_scaled_total_height_dim #3 \TotalHeight } + { \l_coffin_scaled_total_height_dim -#3 \TotalHeight } + \fp_compare:NNNTF \l_coffin_scale_x_fp > \c_zero_fp + { \l_coffin_scaled_width_dim -#2 \Width } + { \l_coffin_scaled_width_dim #2 \Width } + \hbox_set:Nn #1 { \scalebox {#2} [#3] { \box_use:N #1 } } + \coffin_resize_common:Nnn #1 + { \l_coffin_scaled_width_dim } { \l_coffin_scaled_total_height_dim } +} +\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 } + \dim_set:Nn #3 { \fp_to_dim:N \l_coffin_tmp_fp } + \fp_set_from_dim:Nn \l_coffin_tmp_fp {#2} + \fp_mul:Nn \l_coffin_tmp_fp { \l_coffin_scale_y_fp } + \dim_set:Nn #4 { \fp_to_dim:N \l_coffin_tmp_fp } +} +\cs_new_protected_nopar:Npn \coffin_scale_corner:Nnnn #1#2#3#4 { + \coffin_scale_vector:nnNN {#3} {#4} \l_coffin_x_dim \l_coffin_y_dim + \prop_put:cnx { l_coffin_corners_ \tex_number:D #1 _prop } {#2} + { { \dim_use:N \l_coffin_x_dim } { \dim_use:N \l_coffin_y_dim } } +} +\cs_new_protected_nopar:Npn \coffin_scale_pole:Nnnnnn #1#2#3#4#5#6 { + \coffin_scale_vector:nnNN {#3} {#4} \l_coffin_x_dim \l_coffin_y_dim + \coffin_set_pole:Nnx #1 {#2} + { + { \dim_use:N \l_coffin_x_dim } { \dim_use:N \l_coffin_y_dim } + {#5} {#6} + } +} +\cs_new_protected_nopar:Npn \coffin_x_shift_corner:Nnnn #1#2#3#4 { + \prop_put:cnx { l_coffin_corners_ \tex_number:D #1 _prop } {#2} + { + { \the_tex:D \etex_dimexpr:D #3 + \box_wd:N #1 \scan_stop: } {#4} + } +} +\cs_new_protected_nopar:Npn \coffin_x_shift_pole:Nnnnnn #1#2#3#4#5#6 { + \prop_put:cnx { l_coffin_poles_ \tex_number:D #1 _prop } {#2} + { + { \the_tex:D \etex_dimexpr:D #3 + \box_wd:N #1 \scan_stop: } {#4} + {#5} {#6} + } +} +\coffin_new:N \l_coffin_display_coffin +\coffin_new:N \l_coffin_display_coord_coffin +\coffin_new:N \l_coffin_display_pole_coffin +\prop_new:N \l_coffin_display_handles_prop +\prop_put:Nnn \l_coffin_display_handles_prop { tl } + { { b } { r } { -1 } { 1 } } +\prop_put:Nnn \l_coffin_display_handles_prop { thc } + { { b } { hc } { 0 } { 1 } } +\prop_put:Nnn \l_coffin_display_handles_prop { tr } + { { b } { l } { 1 } { 1 } } +\prop_put:Nnn \l_coffin_display_handles_prop { vcl } + { { vc } { r } { -1 } { 0 } } +\prop_put:Nnn \l_coffin_display_handles_prop { vchc } + { { vc } { hc } { 0 } { 0 } } +\prop_put:Nnn \l_coffin_display_handles_prop { vcr } + { { vc } { l } { 1 } { 0 } } +\prop_put:Nnn \l_coffin_display_handles_prop { bl } + { { t } { r } { -1 } { -1 } } +\prop_put:Nnn \l_coffin_display_handles_prop { bhc } + { { t } { hc } { 0 } { -1 } } +\prop_put:Nnn \l_coffin_display_handles_prop { br } + { { t } { l } { 1 } { -1 } } +\prop_put:Nnn \l_coffin_display_handles_prop { Tl } + { { t } { r } { -1 } { -1 } } +\prop_put:Nnn \l_coffin_display_handles_prop { Thc } + { { t } { hc } { 0 } { -1 } } +\prop_put:Nnn \l_coffin_display_handles_prop { Tr } + { { t } { l } { 1 } { -1 } } +\prop_put:Nnn \l_coffin_display_handles_prop { Hl } + { { vc } { r } { -1 } { 1 } } +\prop_put:Nnn \l_coffin_display_handles_prop { Hhc } + { { vc } { hc } { 0 } { 1 } } +\prop_put:Nnn \l_coffin_display_handles_prop { Hr } + { { vc } { l } { 1 } { 1 } } +\prop_put:Nnn \l_coffin_display_handles_prop { Bl } + { { b } { r } { -1 } { -1 } } +\prop_put:Nnn \l_coffin_display_handles_prop { Bhc } + { { b } { hc } { 0 } { -1 } } +\prop_put:Nnn \l_coffin_display_handles_prop { Br } + { { b } { l } { 1 } { -1 } } +\dim_new:N \l_coffin_display_offset_dim +\dim_set:Nn \l_coffin_display_offset_dim { 2 pt } +\dim_new:N \l_coffin_display_x_dim +\dim_new:N \l_coffin_display_y_dim +\prop_new:N \l_coffin_display_poles_prop +\tl_new:N \l_coffin_display_font_tl +\tl_set:Nn \l_coffin_display_font_tl { \sffamily \tiny } +\cs_new_eq:NN \l_coffin_show_toks \toks@ +\prop_new:N \l_coffin_handles_tmp_prop +\cs_new_protected_nopar:Npn \coffin_mark_handle:Nnnn #1#2#3#4 { + \hcoffin_set:Nn \l_coffin_display_pole_coffin + { + \color {#4} + \rule { 1 pt } { 1 pt } + \hbox:n { \tex_vrule:D width 1 pt height 1 pt \scan_stop: } % TEMP + } + \coffin_attach_mark:NnnNnnnn #1 {#2} {#3} + \l_coffin_display_pole_coffin { hc } { vc } { 0 pt } { 0 pt } + \hcoffin_set:Nn \l_coffin_display_coord_coffin + { + \color {#4} + \l_coffin_display_font_tl + ( \tl_to_str:n { #2 , #3 } ) + } + \prop_get:NnN \l_coffin_display_handles_prop + { #2 #3 } \l_coffin_tmp_tl + \quark_if_no_value:NTF \l_coffin_tmp_tl + { + \prop_get:NnN \l_coffin_display_handles_prop + { #3 #2 } \l_coffin_tmp_tl + \quark_if_no_value:NTF \l_coffin_tmp_tl + { + \coffin_attach_mark:NnnNnnnn #1 {#2} {#3} + \l_coffin_display_coord_coffin { l } { vc } + { 1 pt } { 0 pt } + } + { + \exp_last_unbraced:No \coffin_mark_handle_aux:nnnnNnn + \l_coffin_tmp_tl #1 {#2} {#3} + } + } + { + \exp_last_unbraced:No \coffin_mark_handle_aux:nnnnNnn + \l_coffin_tmp_tl #1 {#2} {#3} + } +} +\cs_new_protected_nopar:Npn + \coffin_mark_handle_aux:nnnnNnn #1#2#3#4#5#6#7 { + \coffin_attach_mark:NnnNnnnn #5 {#6} {#7} + \l_coffin_display_coord_coffin {#1} {#2} + { #3 \l_coffin_display_offset_dim } + { #4 \l_coffin_display_offset_dim } +} +\cs_new_protected_nopar:Npn \coffin_display_handles:Nn #1#2 { + \hcoffin_set:Nn \l_coffin_display_pole_coffin + { + \color {#2} + \rule { 1 pt } { 1 pt } + } + \prop_set_eq:Nc \l_coffin_display_poles_prop + { l_coffin_poles_ \tex_number:D #1 _prop } + \coffin_get_pole:NnN #1 { H } \l_coffin_pole_a_tl + \coffin_get_pole:NnN #1 { T } \l_coffin_pole_b_tl + \tl_if_eq:NNT \l_coffin_pole_a_tl \l_coffin_pole_b_tl + { \prop_del:Nn \l_coffin_display_poles_prop { T } } + \coffin_get_pole:NnN #1 { B } \l_coffin_pole_b_tl + \tl_if_eq:NNT \l_coffin_pole_a_tl \l_coffin_pole_b_tl + { \prop_del:Nn \l_coffin_display_poles_prop { B } } + \coffin_set_eq:NN \l_coffin_display_coffin #1 + \prop_clear:N \l_coffin_handles_tmp_prop + \prop_map_inline:Nn \l_coffin_display_poles_prop + { + \prop_del:Nn \l_coffin_display_poles_prop {##1} + \coffin_display_handles_aux:nnnnnn {##1} ##2 {#2} + } + \box_use:N \l_coffin_display_coffin +} +\cs_new_protected_nopar:Npn + \coffin_display_handles_aux:nnnnnn #1#2#3#4#5#6 { + \prop_map_inline:Nn \l_coffin_display_poles_prop + { + \bool_set_false:N \l_coffin_error_bool + \coffin_calculate_intersection:nnnnnnnn {#2} {#3} {#4} {#5} ##2 + \bool_if:NF \l_coffin_error_bool + { + \dim_set:Nn \l_coffin_display_x_dim { \l_coffin_x_dim } + \dim_set:Nn \l_coffin_display_y_dim { \l_coffin_y_dim } + \coffin_display_attach:Nnnnn + \l_coffin_display_pole_coffin { hc } { vc } + { 0 pt } { 0 pt } + \hcoffin_set:Nn \l_coffin_display_coord_coffin + { + \color {#6} + \l_coffin_display_font_tl + ( \tl_to_str:n { #1 , ##1 } ) + } + \prop_get:NnN \l_coffin_display_handles_prop + { #1 ##1 } \l_coffin_tmp_tl + \quark_if_no_value:NTF \l_coffin_tmp_tl + { + \prop_get:NnN \l_coffin_display_handles_prop + { ##1 #1 } \l_coffin_tmp_tl + \quark_if_no_value:NTF \l_coffin_tmp_tl + { + \coffin_display_attach:Nnnnn + \l_coffin_display_coord_coffin { l } { vc } + { 1 pt } { 0 pt } + } + { + \exp_last_unbraced:No + \coffin_display_handles_aux:nnnn + \l_coffin_tmp_tl + } + } + { + \exp_last_unbraced:No \coffin_display_handles_aux:nnnn + \l_coffin_tmp_tl + } + } + } +} +\cs_new_protected_nopar:Npn \coffin_display_handles_aux:nnnn #1#2#3#4 { + \coffin_display_attach:Nnnnn + \l_coffin_display_coord_coffin {#1} {#2} + { #3 \l_coffin_display_offset_dim } + { #4 \l_coffin_display_offset_dim } +} +\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 } + \dim_set:Nn \l_coffin_y_prime_dim { \l_coffin_y_dim } + \dim_set:Nn \l_coffin_offset_x_dim + { \l_coffin_display_x_dim - \l_coffin_x_prime_dim + #4 } + \dim_set:Nn \l_coffin_offset_y_dim + { \l_coffin_display_y_dim - \l_coffin_y_prime_dim + #5 } + \hbox_set:Nn \l_coffin_aligned_coffin + { + \box_use:N \l_coffin_display_coffin + \tex_kern:D -\box_wd:N \l_coffin_display_coffin + \tex_kern:D \l_coffin_offset_x_dim + \box_move_up:nn { \l_coffin_offset_y_dim } { \box_use:N #1 } + } + \box_set_ht:Nn \l_coffin_aligned_coffin + { \box_ht:N \l_coffin_display_coffin } + \box_set_dp:Nn \l_coffin_aligned_coffin + { \box_dp:N \l_coffin_display_coffin } + \box_set_wd:Nn \l_coffin_aligned_coffin + { \box_wd:N \l_coffin_display_coffin } + \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? } + } + { + \iow_term:x { Poles~of~coffin~\token_to_str:N #1 : } + \prop_map_inline:cn { l_coffin_poles_ \tex_number:D #1 _prop } + { + \toks_if_empty:NF \l_coffin_show_toks + { + \toks_put_right:Nx \l_coffin_show_toks + { \iow_newline: > ~ } + } + \toks_put_right:Nx \l_coffin_show_toks + { ~ \exp_not:n {##1} \c_space_tl => ~ \exp_not:n {##2} } + } + } + \toks_show:N \l_coffin_show_toks +} +\cs_generate_variant:Nn \coffin_show_structure:N { c } +\msg_kernel_new:nnnn { coffin } { no-pole-intersection } + { No~intersection~between~coffin~poles. } + { + \l_msg_coding_error_text_tl + LaTeX~was~asked~to~find~the~intersection~between~two~poles,~ + but~they~do~not~have~a~unique~meeting~point:~ + the~value~(0~pt,~0~pt)~will~be~used. + } +\msg_kernel_new:nnnn { coffin } { unknown-coffin } + { Unknown~coffin~'#1'. } + { The~coffin~'#1'~was~never~defined. } +\msg_kernel_new:nnnn { coffin } { unknown-coffin-pole } + { Pole~'#1'~unknown~for~coffin~'#2'. } + { + \l_msg_coding_error_text_tl + LaTeX~was~asked~to~find~a~typesetting~pole~for~a~coffin,~ + but~either~the~coffin~does~not~exist~or~the~pole~name~is~wrong. + } +\cs_new:Npn \exp_last_two_unbraced:Noo #1 #2 #3{ + \exp_after:wN \exp_after:wN \exp_after:wN #1 \exp_after:wN #2 #3 +} +\endinput +%% +%% End of file `l3coffins.sty'. diff --git a/Master/texmf-dist/tex/latex/xpackages/xcoffins/xcoffins.sty b/Master/texmf-dist/tex/latex/xpackages/xcoffins/xcoffins.sty new file mode 100644 index 00000000000..efed9bd8982 --- /dev/null +++ b/Master/texmf-dist/tex/latex/xpackages/xcoffins/xcoffins.sty @@ -0,0 +1,125 @@ +%% +%% This is file `xcoffins.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% xcoffins.dtx (with options: `package') +%% +%% (C) Copyright The LaTeX3 Project and any individual authors +%% listed elsewhere in this file. +%% +%% This is a generated file. +%% +%% This file was generated from file(s) of the xcoffins bundle. +%% ----------------------------------------------------------- +%% +%% This file may only be distributed together with a copy of this bundle. +%% You may however distribute the bundle without such generated files. +%% +%% ====================================================================== +%% +%% File xcoffins.dtx (C) Copyright 2010 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 ``xcoffins 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 LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +\RequirePackage{expl3} +\RequirePackage{graphicx,xcolor} +\GetIdInfo$Id: xcoffins.dtx 2097 2010-12-05 21:59:21Z mittelba $ + {Coffins} +\ProvidesExplPackage + {\filename}{\filedate}{\fileversion}{\filedescription} +\RequirePackage{l3coffins,xparse} +\NewDocumentCommand \NewCoffin { m } { + \coffin_new:N #1 +} +\NewDocumentCommand \SetHorizontalCoffin { m +m } { + \hcoffin_set:Nn #1 {#2} +} +\NewDocumentCommand \SetVerticalCoffin { m m +m } { + \vcoffin_set:Nnn #1 {#2} {#3} +} +\NewDocumentCommand \SetHorizontalPole { m m m } { + \coffin_set_horizontal_pole:Nnn #1 {#2} {#3} +} +\NewDocumentCommand \SetVerticalPole { m m m } { + \coffin_set_vertical_pole:Nnn #1 {#2} {#3} +} +\NewDocumentCommand \JoinCoffins + { + s + m + > { \SplitArgument { 1 } { , } } O { H , l } + m + > { \SplitArgument { 1 } { , } } O { H , l } + > { \SplitArgument { 1 } { , } } D ( ) { 0 pt , 0 pt } + } + { + \IfBooleanTF #1 + { \coffin_attach:NnnNnnnn #2 #3 #4 #5 #6 } + { \coffin_join:NnnNnnnn #2 #3 #4 #5 #6 } + } +\NewDocumentCommand \TypesetCoffin + { + m + > { \SplitArgument { 1 } { , } } O { H , l } + > { \SplitArgument { 1 } { , } } D ( ) { 0 pt , 0 pt } + } + { \coffin_typeset:Nnnnn #1 #2 #3 } +\NewDocumentCommand \RotateCoffin { m m } { + \coffin_rotate:Nn #1 {#2} +} +\NewDocumentCommand \ResizeCoffin { m m m } { + \coffin_resize:Nnn #1 {#2} {#3} +} +\NewDocumentCommand \ScaleCoffin { m m m } { + \coffin_scale:Nnn #1 {#2} {#3} +} +\NewDocumentCommand \DisplayCoffinHandles { m m } { + \cs_if_exist:cTF { l_coffin_poles_ \tex_number:D #1 _prop } + { \coffin_display_handles:Nn #1 {#2} } + { \msg_kernel_error:nx { unknown-coffin } { \token_to_str:N #1 } } +} +\NewDocumentCommand \MarkCoffinHandle + { m > { \SplitArgument { 1 } { , } } O { H , l } m } + { + \cs_if_exist:cTF { l_coffin_poles_ \tex_number:D #1 _prop } + { \coffin_mark_handle:Nnnn #1 #2 {#3} } + { \msg_kernel_error:nx { unknown-coffin } { \token_to_str:N #1 } + } +} +\NewDocumentCommand \ShowCoffinStructure { m } { + \coffin_show_structure:N #1 +} +\endinput +%% +%% End of file `xcoffins.sty'. -- cgit v1.2.3