%% %% This is file `l3candidates.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% l3candidates.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: l3candidates.dtx Copyright(C) 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 LaTeX Project Team. %% %% ----------------------------------------------------------------------- %% \RequirePackage{l3bootstrap} \GetIdInfo$Id: l3candidates.dtx 4468 2013-03-14 20:30:45Z joseph $ {L3 Experimental additions to l3kernel} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \__expl_package_check: \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 \cs_new_protected:Npn \box_rotate:Nn #1#2 { \hbox_set:Nn #1 { \group_begin: \fp_set:Nn \l__box_angle_fp {#2} \fp_set:Nn \l__box_sin_fp { sin ( \l__box_angle_fp * deg ) } \fp_set:Nn \l__box_cos_fp { cos ( \l__box_angle_fp * deg ) } \__box_rotate:N #1 \group_end: } } \cs_new_protected:Npn \__box_rotate: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_x:nnN #1#2#3 { \dim_set:Nn #3 { \fp_to_dim:n { \l__box_cos_fp * \dim_to_fp:n {#1} - ( \l__box_sin_fp * \dim_to_fp:n {#2} ) } } } \cs_new_protected:Npn \__box_rotate_y:nnN #1#2#3 { \dim_set:Nn #3 { \fp_to_dim:n { \l__box_sin_fp * \dim_to_fp:n {#1} + \l__box_cos_fp * \dim_to_fp:n {#2} } } } \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:Nn \l__box_scale_x_fp { \dim_to_fp:n {#2} / ( \dim_to_fp:n \l__box_right_dim ) } \fp_set:Nn \l__box_scale_y_fp { \dim_to_fp:n {#3} / ( \dim_to_fp:n { \l__box_top_dim - \l__box_bottom_dim } ) } \__box_resize:Nnn #1 {#2} {#3} \group_end: } } \cs_generate_variant:Nn \box_resize:Nnn { c } \cs_new_protected:Npn \__box_resize:Nnn #1#2#3 { \dim_set:Nn \l__box_right_new_dim { \dim_abs:n {#2} } \dim_set:Nn \l__box_bottom_new_dim { \fp_abs:n { \l__box_scale_y_fp } \l__box_bottom_dim } \dim_set:Nn \l__box_top_new_dim { \fp_abs:n { \l__box_scale_y_fp } \l__box_top_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:Nn \l__box_scale_y_fp { \dim_to_fp:n {#2} / ( \dim_to_fp:n { \l__box_top_dim - \l__box_bottom_dim } ) } \fp_set_eq:NN \l__box_scale_x_fp \l__box_scale_y_fp \__box_resize: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:Nn \l__box_scale_x_fp { \dim_to_fp:n {#2} / ( \dim_to_fp:n \l__box_right_dim ) } \fp_set_eq:NN \l__box_scale_y_fp \l__box_scale_x_fp \__box_resize: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 \dim_set:Nn \l__box_top_new_dim { \fp_abs:n { \l__box_scale_y_fp } \l__box_top_dim } \dim_set:Nn \l__box_bottom_new_dim { \fp_abs:n { \l__box_scale_y_fp } \l__box_bottom_dim } \dim_set:Nn \l__box_right_new_dim { \fp_abs:n { \l__box_scale_x_fp } \l__box_right_dim } \__box_resize_common:N #1 \group_end: } } \cs_generate_variant:Nn \box_scale:Nnn { c } \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 } \hbox:n { \tex_kern:D \c_zero_dim \box_use:N \l__box_internal_box \tex_hss:D } } } \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 { \hbox_set:Nn \l__box_internal_box { \tex_kern:D -\__dim_eval:w #2 \__dim_eval_end: \box_use:N #1 \tex_kern:D -\__dim_eval:w #4 \__dim_eval_end: } \dim_compare:nNnTF { \box_dp:N #1 } > {#3} { \hbox_set:Nn \l__box_internal_box { \box_move_down:nn \c_zero_dim { \box_use:N \l__box_internal_box } } \box_set_dp:Nn \l__box_internal_box { \box_dp:N #1 - (#3) } } { \hbox_set:Nn \l__box_internal_box { \box_move_down:nn { #3 - \box_dp:N #1 } { \box_use:N \l__box_internal_box } } \box_set_dp:Nn \l__box_internal_box \c_zero_dim } \dim_compare:nNnTF { \box_ht:N \l__box_internal_box } > {#5} { \hbox_set:Nn \l__box_internal_box { \box_move_up:nn \c_zero_dim { \box_use:N \l__box_internal_box } } \box_set_ht:Nn \l__box_internal_box { \box_ht:N \l__box_internal_box - (#5) } } { \hbox_set:Nn \l__box_internal_box { \box_move_up:nn { #5 - \box_ht:N \l__box_internal_box } { \box_use:N \l__box_internal_box } } \box_set_ht:Nn \l__box_internal_box \c_zero_dim } \box_set_eq:NN #1 \l__box_internal_box } \cs_generate_variant:Nn \box_trim:Nnnnn { c } \cs_new_protected:Npn \box_viewport:Nnnnn #1#2#3#4#5 { \hbox_set:Nn \l__box_internal_box { \tex_kern:D -\__dim_eval:w #2 \__dim_eval_end: \box_use:N #1 \tex_kern:D \__dim_eval:w #4 - \box_wd:N #1 \__dim_eval_end: } \dim_compare:nNnTF {#3} < \c_zero_dim { \hbox_set:Nn \l__box_internal_box { \box_move_down:nn \c_zero_dim { \box_use:N \l__box_internal_box } } \box_set_dp:Nn \l__box_internal_box { -\dim_eval:n {#3} } } { \hbox_set:Nn \l__box_internal_box { \box_move_down:nn {#3} { \box_use:N \l__box_internal_box } } \box_set_dp:Nn \l__box_internal_box \c_zero_dim } \dim_compare:nNnTF {#5} > \c_zero_dim { \hbox_set:Nn \l__box_internal_box { \box_move_up:nn \c_zero_dim { \box_use:N \l__box_internal_box } } \box_set_ht:Nn \l__box_internal_box { #5 \dim_compare:nNnT {#3} > \c_zero_dim { - (#3) } } } { \hbox_set:Nn \l__box_internal_box { \box_move_up:nn { -\dim_eval:n {#5} } { \box_use:N \l__box_internal_box } } \box_set_ht:Nn \l__box_internal_box \c_zero_dim } \box_set_eq:NN #1 \l__box_internal_box } \cs_generate_variant:Nn \box_viewport:Nnnnn { c } \cs_new:Npn \clist_item:Nn #1#2 { \exp_args:Nfo \__clist_item:nnNn { \clist_count:N #1 } #1 \__clist_item_N_loop:nw {#2} } \cs_new:Npn \__clist_item:nnNn #1#2#3#4 { \int_compare:nNnTF {#4} < \c_zero { \int_compare:nNnTF {#4} < { - #1 } { \use_none_delimit_by_q_stop:w } { \exp_args:Nf #3 { \int_eval:n { #4 + \c_one + #1 } } } } { \int_compare:nNnTF {#4} > {#1} { \use_none_delimit_by_q_stop:w } { #3 {#4} } } { } , #2 , \q_stop } \cs_new:Npn \__clist_item_N_loop:nw #1 #2, { \int_compare:nNnTF {#1} = \c_zero { \use_i_delimit_by_q_stop:nw { \exp_not:n {#2} } } { \exp_args:Nf \__clist_item_N_loop:nw { \int_eval:n { #1 - 1 } } } } \cs_generate_variant:Nn \clist_item:Nn { c } \cs_new:Npn \clist_item:nn #1#2 { \exp_args:Nf \__clist_item:nnNn { \clist_count:n {#1} } {#1} \__clist_item_n:nw {#2} } \cs_new:Npn \__clist_item_n:nw #1 { \__clist_item_n_loop:nw {#1} \prg_do_nothing: } \cs_new:Npn \__clist_item_n_loop:nw #1 #2, { \exp_args:No \tl_if_blank:nTF {#2} { \__clist_item_n_loop:nw {#1} \prg_do_nothing: } { \int_compare:nNnTF {#1} = \c_zero { \exp_args:No \__clist_item_n_end:n {#2} } { \exp_args:Nf \__clist_item_n_loop:nw { \int_eval:n { #1 - 1 } } \prg_do_nothing: } } } \cs_new:Npn \__clist_item_n_end:n #1 #2 \q_stop { \__tl_trim_spaces:nn { \q_mark #1 } { \exp_last_unbraced:No \__clist_item_n_strip:w } , } \cs_new:Npn \__clist_item_n_strip:w #1 , { \exp_not:n {#1} } \cs_new_protected:Npn \clist_set_from_seq:NN { \__clist_set_from_seq:NNNN \clist_clear:N \tl_set:Nx } \cs_new_protected:Npn \clist_gset_from_seq:NN { \__clist_set_from_seq:NNNN \clist_gclear:N \tl_gset:Nx } \cs_new_protected:Npn \__clist_set_from_seq:NNNN #1#2#3#4 { \seq_if_empty:NTF #4 { #1 #3 } { #2 #3 { \exp_last_unbraced:Nf \use_none:n { \seq_map_function:NN #4 \__clist_wrap_item:n } } } } \cs_new:Npn \__clist_wrap_item:n #1 { , \tl_if_empty:oTF { \__clist_set_from_seq:w #1 ~ , #1 ~ } { \exp_not:n {#1} } { \exp_not:n { {#1} } } } \cs_new:Npn \__clist_set_from_seq:w #1 , #2 ~ { } \cs_generate_variant:Nn \clist_set_from_seq:NN { Nc } \cs_generate_variant:Nn \clist_set_from_seq:NN { c , cc } \cs_generate_variant:Nn \clist_gset_from_seq:NN { Nc } \cs_generate_variant:Nn \clist_gset_from_seq:NN { c , cc } \cs_new_protected:Npn \clist_const:Nn #1#2 { \tl_const:Nx #1 { \__clist_trim_spaces:n {#2} } } \cs_generate_variant:Nn \clist_const:Nn { c , Nx , cx } \prg_new_conditional:Npnn \clist_if_empty:n #1 { p , T , F , TF } { \__clist_if_empty_n:w ? #1 , \q_mark \prg_return_false: , \q_mark \prg_return_true: \q_stop } \cs_new:Npn \__clist_if_empty_n:w #1 , { \tl_if_empty:oTF { \use_none:nn #1 ? } { \__clist_if_empty_n:w ? } { \__clist_if_empty_n:wNw } } \cs_new:Npn \__clist_if_empty_n:wNw #1 \q_mark #2#3 \q_stop {#2} \cs_new:Npn \clist_use:Nnnn #1#2#3#4 { \clist_if_exist:NTF #1 { \int_case:nnn { \clist_count:N #1 } { { 0 } { } { 1 } { \exp_after:wN \__clist_use:wwn #1 , , { } } { 2 } { \exp_after:wN \__clist_use:wwn #1 , {#2} } } { \exp_after:wN \__clist_use:nwwwwnwn \exp_after:wN { \exp_after:wN } #1 , \q_mark , { \__clist_use:nwwwwnwn {#3} } \q_mark , { \__clist_use:nwwn {#4} } \q_stop { } } } { \__msg_kernel_expandable_error:nnn { kernel } { bad-variable } {#1} } } \cs_new:Npn \__clist_use:wwn #1 , #2 , #3 { \exp_not:n { #1 #3 #2 } } \cs_new:Npn \__clist_use:nwwwwnwn #1#2 , #3 , #4 , #5 \q_mark , #6#7 \q_stop #8 { #6 {#3} , {#4} , #5 \q_mark , {#6} #7 \q_stop { #8 #1 #2 } } \cs_new:Npn \__clist_use:nwwn #1#2 , #3 \q_stop #4 { \exp_not:n { #4 #1 #2 } } \fp_new:N \l__coffin_sin_fp \fp_new:N \l__coffin_cos_fp \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:Npn \coffin_rotate:Nn #1#2 { \fp_set:Nn \l__coffin_sin_fp { sin ( ( #2 ) * deg ) } \fp_set:Nn \l__coffin_cos_fp { cos ( ( #2 ) * deg ) } \prop_map_inline:cn { l__coffin_corners_ \__int_value:w #1 _prop } { \__coffin_rotate_corner:Nnnn #1 {##1} ##2 } \prop_map_inline:cn { l__coffin_poles_ \__int_value:w #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: \box_rotate:Nn #1 {#2} \hbox_set:Nn \l__coffin_internal_box { \tex_kern:D \__dim_eval:w \l__coffin_bounding_shift_dim - \l__coffin_left_corner_dim \__dim_eval_end: \box_move_down:nn { \l__coffin_bottom_corner_dim } { \box_use:N #1 } } \box_set_ht:Nn \l__coffin_internal_box { \l__coffin_top_corner_dim - \l__coffin_bottom_corner_dim } \box_set_dp:Nn \l__coffin_internal_box { 0 pt } \box_set_wd:Nn \l__coffin_internal_box { \l__coffin_right_corner_dim - \l__coffin_left_corner_dim } \hbox_set:Nn #1 { \box_use:N \l__coffin_internal_box } \prop_map_inline:cn { l__coffin_corners_ \__int_value:w #1 _prop } { \__coffin_shift_corner:Nnnn #1 {##1} ##2 } \prop_map_inline:cn { l__coffin_poles_ \__int_value:w #1 _prop } { \__coffin_shift_pole:Nnnnnn #1 {##1} ##2 } } \cs_generate_variant:Nn \coffin_rotate:Nn { c } \cs_new_protected: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_internal_dim { - \box_dp:N #1 } \prop_put:Nnx \l__coffin_bounding_prop { bl } { { 0 pt } { \dim_use:N \l__coffin_internal_dim } } \prop_put:Nnx \l__coffin_bounding_prop { br } { { \dim_use:N \box_wd:N #1 } { \dim_use:N \l__coffin_internal_dim } } } \cs_new_protected: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: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_ \__int_value:w #1 _prop } {#2} { { \dim_use:N \l__coffin_x_dim } { \dim_use:N \l__coffin_y_dim } } } \cs_new_protected: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:Npn \__coffin_rotate_vector:nnNN #1#2#3#4 { \dim_set:Nn #3 { \fp_to_dim:n { \dim_to_fp:n {#1} * \l__coffin_cos_fp - ( \dim_to_fp:n {#2} * \l__coffin_sin_fp ) } } \dim_set:Nn #4 { \fp_to_dim:n { \dim_to_fp:n {#1} * \l__coffin_sin_fp + ( \dim_to_fp:n {#2} * \l__coffin_cos_fp ) } } } \cs_new_protected: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_ \__int_value:w #1 _prop } { \__coffin_find_corner_maxima_aux:nn ##2 } } \cs_new_protected:Npn \__coffin_find_corner_maxima_aux:nn #1#2 { \dim_set:Nn \l__coffin_left_corner_dim { \dim_min:nn { \l__coffin_left_corner_dim } {#1} } \dim_set:Nn \l__coffin_right_corner_dim { \dim_max:nn { \l__coffin_right_corner_dim } {#1} } \dim_set:Nn \l__coffin_bottom_corner_dim { \dim_min:nn { \l__coffin_bottom_corner_dim } {#2} } \dim_set:Nn \l__coffin_top_corner_dim { \dim_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:Npn \__coffin_find_bounding_shift_aux:nn #1#2 { \dim_set:Nn \l__coffin_bounding_shift_dim { \dim_min:nn { \l__coffin_bounding_shift_dim } {#1} } } \cs_new_protected:Npn \__coffin_shift_corner:Nnnn #1#2#3#4 { \prop_put:cnx { l__coffin_corners_ \__int_value:w #1 _ prop } {#2} { { \dim_eval:n { #3 - \l__coffin_left_corner_dim } } { \dim_eval:n { #4 - \l__coffin_bottom_corner_dim } } } } \cs_new_protected:Npn \__coffin_shift_pole:Nnnnnn #1#2#3#4#5#6 { \prop_put:cnx { l__coffin_poles_ \__int_value:w #1 _ prop } {#2} { { \dim_eval:n { #3 - \l__coffin_left_corner_dim } } { \dim_eval:n { #4 - \l__coffin_bottom_corner_dim } } {#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:Npn \coffin_resize:Nnn #1#2#3 { \fp_set:Nn \l__coffin_scale_x_fp { \dim_to_fp:n {#2} / \dim_to_fp:n { \coffin_wd:N #1 } } \fp_set:Nn \l__coffin_scale_y_fp { \dim_to_fp:n {#3} / \dim_to_fp:n { \coffin_ht:N #1 + \coffin_dp:N #1 } } \box_resize:Nnn #1 {#2} {#3} \__coffin_resize_common:Nnn #1 {#2} {#3} } \cs_generate_variant:Nn \coffin_resize:Nnn { c } \cs_new_protected:Npn \__coffin_resize_common:Nnn #1#2#3 { \prop_map_inline:cn { l__coffin_corners_ \__int_value:w #1 _prop } { \__coffin_scale_corner:Nnnn #1 {##1} ##2 } \prop_map_inline:cn { l__coffin_poles_ \__int_value:w #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_ \__int_value:w #1 _prop } { \__coffin_x_shift_corner:Nnnn #1 {##1} ##2 } \prop_map_inline:cn { l__coffin_poles_ \__int_value:w #1 _prop } { \__coffin_x_shift_pole:Nnnnnn #1 {##1} ##2 } } } \cs_new_protected:Npn \coffin_scale:Nnn #1#2#3 { \fp_set:Nn \l__coffin_scale_x_fp {#2} \fp_set:Nn \l__coffin_scale_y_fp {#3} \box_scale:Nnn #1 { \l__coffin_scale_x_fp } { \l__coffin_scale_y_fp } \dim_set:Nn \l__coffin_internal_dim { \coffin_ht:N #1 + \coffin_dp:N #1 } \dim_set:Nn \l__coffin_scaled_total_height_dim { \fp_abs:n { \l__coffin_scale_y_fp } \l__coffin_internal_dim } \dim_set:Nn \l__coffin_scaled_width_dim { -\fp_abs:n { \l__coffin_scale_x_fp } \coffin_wd:N #1 } \__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:Npn \__coffin_scale_vector:nnNN #1#2#3#4 { \dim_set:Nn #3 { \fp_to_dim:n { \dim_to_fp:n {#1} * \l__coffin_scale_x_fp } } \dim_set:Nn #4 { \fp_to_dim:n { \dim_to_fp:n {#2} * \l__coffin_scale_y_fp } } } \cs_new_protected: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_ \__int_value:w #1 _prop } {#2} { { \dim_use:N \l__coffin_x_dim } { \dim_use:N \l__coffin_y_dim } } } \cs_new_protected: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:Npn \__coffin_x_shift_corner:Nnnn #1#2#3#4 { \prop_put:cnx { l__coffin_corners_ \__int_value:w #1 _prop } {#2} { { \dim_eval:n { #3 + \box_wd:N #1 } } {#4} } } \cs_new_protected:Npn \__coffin_x_shift_pole:Nnnnnn #1#2#3#4#5#6 { \prop_put:cnx { l__coffin_poles_ \__int_value:w #1 _prop } {#2} { { \dim_eval:n #3 + \box_wd:N #1 } {#4} {#5} {#6} } } \cs_new_nopar:Npn \ior_map_break: { \__prg_map_break:Nn \ior_map_break: { } } \cs_new_nopar:Npn \ior_map_break:n { \__prg_map_break:Nn \ior_map_break: } \cs_new_protected_nopar:Npn \ior_map_inline:Nn { \__ior_map_inline:NNn \ior_get:NN } \cs_new_protected_nopar:Npn \ior_str_map_inline:Nn { \__ior_map_inline:NNn \ior_get_str:NN } \cs_new_protected_nopar:Npn \__ior_map_inline:NNn { \int_gincr:N \g__prg_map_int \exp_args:Nc \__ior_map_inline:NNNn { __prg_map_ \int_use:N \g__prg_map_int :n } } \cs_new_protected:Npn \__ior_map_inline:NNNn #1#2#3#4 { \cs_set:Npn #1 ##1 {#4} \ior_if_eof:NF #3 { \__ior_map_inline_loop:NNN #1#2#3 } \__prg_break_point:Nn \ior_map_break: { \int_gdecr:N \g__prg_map_int } } \cs_new_protected:Npn \__ior_map_inline_loop:NNN #1#2#3 { #2 #3 \l__ior_internal_tl \ior_if_eof:NF #3 { \exp_args:No #1 \l__ior_internal_tl \__ior_map_inline_loop:NNN #1#2#3 } } \tl_new:N \l__ior_internal_tl \cs_new_protected:Npn \fp_set_from_dim:Nn #1#2 { \tl_set:Nx #1 { \dim_to_fp:n {#2} } } \cs_new_protected:Npn \fp_gset_from_dim:Nn #1#2 { \tl_gset:Nx #1 { \dim_to_fp:n {#2} } } \cs_generate_variant:Nn \fp_set_from_dim:Nn { c } \cs_generate_variant:Nn \fp_gset_from_dim:Nn { c } \cs_new:Npn \prop_map_tokens:Nn #1#2 { \exp_last_unbraced:Nno \__prop_map_tokens:nwn {#2} #1 \s__prop \q_recursion_tail \s__prop { } \__prg_break_point:Nn \prop_map_break: { } } \cs_new:Npn \__prop_map_tokens:nwn #1 \s__prop #2 \s__prop #3 { \if_meaning:w \q_recursion_tail #2 \exp_after:wN \prop_map_break: \fi: \use:n {#1} {#2} {#3} \__prop_map_tokens:nwn {#1} } \cs_generate_variant:Nn \prop_map_tokens:Nn { c } \cs_new:Npn \prop_get:Nn #1#2 { \__prop_get:No #1 { \tl_to_str:n {#2} } } \cs_new:Npn \__prop_get:Nn #1#2 { \exp_last_unbraced:Nno \__prop_get_Nn:nwn {#2} #1 \s__prop #2 \s__prop { } \__prg_break_point: } \cs_generate_variant:Nn \__prop_get:Nn { No } \cs_new:Npn \__prop_get_Nn:nwn #1 \s__prop #2 \s__prop #3 { \str_if_eq_x:nnTF {#1} {#2} { \__prg_break:n { \exp_not:n {#3} } } { \__prop_get_Nn:nwn {#1} } } \cs_generate_variant:Nn \prop_get:Nn { c } \cs_new:Npn \seq_item:Nn #1#2 { \exp_last_unbraced:Nfo \__seq_item:nnn { \int_eval:n { \int_compare:nNnT {#2} < \c_zero { \seq_count:N #1 + \c_one + } #2 } } #1 { ? \__prg_break: } { } \__prg_break_point: } \cs_new:Npn \__seq_item:nnn #1#2#3 { \use_none:n #2 \int_compare:nNnTF {#1} = \c_one { \__prg_break:n { \exp_not:n {#3} } } { \exp_args:Nf \__seq_item:nnn { \int_eval:n { #1 - 1 } } } } \cs_generate_variant:Nn \seq_item:Nn { c } \cs_new:Npn \seq_mapthread_function:NNN #1#2#3 { \exp_after:wN \__seq_mapthread_function:NN \exp_after:wN #3 \exp_after:wN #1 #2 { ? \__prg_break: } { } \__prg_break_point: } \cs_new:Npn \__seq_mapthread_function:NN #1#2 { \exp_after:wN \__seq_mapthread_function:Nnnwnn \exp_after:wN #1 #2 { ? \__prg_break: } { } \q_stop } \cs_new:Npn \__seq_mapthread_function:Nnnwnn #1#2#3#4 \q_stop #5#6 { \use_none:n #2 \use_none:n #5 #1 {#3} {#6} \__seq_mapthread_function:Nnnwnn #1 #4 \q_stop } \cs_generate_variant:Nn \seq_mapthread_function:NNN { Nc } \cs_generate_variant:Nn \seq_mapthread_function:NNN { c , cc } \cs_new_protected:Npn \seq_set_from_clist:NN #1#2 { \tl_set:Nx #1 { \clist_map_function:NN #2 \__seq_wrap_item:n } } \cs_new_protected:Npn \seq_set_from_clist:Nn #1#2 { \tl_set:Nx #1 { \clist_map_function:nN {#2} \__seq_wrap_item:n } } \cs_new_protected:Npn \seq_gset_from_clist:NN #1#2 { \tl_gset:Nx #1 { \clist_map_function:NN #2 \__seq_wrap_item:n } } \cs_new_protected:Npn \seq_gset_from_clist:Nn #1#2 { \tl_gset:Nx #1 { \clist_map_function:nN {#2} \__seq_wrap_item:n } } \cs_generate_variant:Nn \seq_set_from_clist:NN { Nc } \cs_generate_variant:Nn \seq_set_from_clist:NN { c , cc } \cs_generate_variant:Nn \seq_set_from_clist:Nn { c } \cs_generate_variant:Nn \seq_gset_from_clist:NN { Nc } \cs_generate_variant:Nn \seq_gset_from_clist:NN { c , cc } \cs_generate_variant:Nn \seq_gset_from_clist:Nn { c } \cs_new_protected_nopar:Npn \__seq_tmp:w { } \cs_new_protected_nopar:Npn \seq_reverse:N { \__seq_reverse:NN \tl_set:Nx } \cs_new_protected_nopar:Npn \seq_greverse:N { \__seq_reverse:NN \tl_gset:Nx } \cs_new_protected:Npn \__seq_reverse:NN #1 #2 { \cs_set_eq:NN \__seq_tmp:w \__seq_item:n \cs_set_eq:NN \__seq_item:n \__seq_reverse_item:nwn #1 #2 { #2 \exp_not:n { } } \cs_set_eq:NN \__seq_item:n \__seq_tmp:w } \cs_new:Npn \__seq_reverse_item:nwn #1 #2 \exp_not:n #3 { #2 \exp_not:n { \__seq_item:n {#1} #3 } } \cs_generate_variant:Nn \seq_reverse:N { c } \cs_generate_variant:Nn \seq_greverse:N { c } \cs_new_protected_nopar:Npn \seq_set_filter:NNn { \__seq_set_filter:NNNn \tl_set:Nx } \cs_new_protected_nopar:Npn \seq_gset_filter:NNn { \__seq_set_filter:NNNn \tl_gset:Nx } \cs_new_protected:Npn \__seq_set_filter:NNNn #1#2#3#4 { \__seq_push_item_def:n { \bool_if:nT {#4} { \__seq_wrap_item:n {##1} } } #1 #2 { #3 } \__seq_pop_item_def: } \cs_new_protected_nopar:Npn \seq_set_map:NNn { \__seq_set_map:NNNn \tl_set:Nx } \cs_new_protected_nopar:Npn \seq_gset_map:NNn { \__seq_set_map:NNNn \tl_gset:Nx } \cs_new_protected:Npn \__seq_set_map:NNNn #1#2#3#4 { \__seq_push_item_def:n { \exp_not:N \__seq_item:n {#4} } #1 #2 { #3 } \__seq_pop_item_def: } \cs_new:Npn \seq_use:Nnnn #1#2#3#4 { \seq_if_exist:NTF #1 { \int_case:nnn { \seq_count:N #1 } { { 0 } { } { 1 } { \exp_after:wN \__seq_use:NnNnn #1 \__seq_item:n { } { } } { 2 } { \exp_after:wN \__seq_use:NnNnn #1 {#2} } } { \exp_after:wN \__seq_use:nwwwwnwn \exp_after:wN { \exp_after:wN } #1 \__seq_item:n \q_mark { \__seq_use:nwwwwnwn {#3} } \q_mark { \__seq_use:nwwn {#4} } \q_stop { } } } { \__msg_kernel_expandable_error:nnn { kernel } { bad-variable } {#1} } } \cs_new:Npn \__seq_use:NnNnn \__seq_item:n #1 \__seq_item:n #2#3 { \exp_not:n { #1 #3 #2 } } \cs_new:Npn \__seq_use:nwwwwnwn #1 \__seq_item:n #2 \__seq_item:n #3 \__seq_item:n #4#5 \q_mark #6#7 \q_stop #8 { #6 \__seq_item:n {#3} \__seq_item:n {#4} #5 \q_mark {#6} #7 \q_stop { #8 #1 #2 } } \cs_new:Npn \__seq_use:nwwn #1 \__seq_item:n #2 #3 \q_stop #4 { \exp_not:n { #4 #1 #2 } } \cs_new:Npn \skip_split_finite_else_action:nnNN #1#2#3#4 { \skip_if_finite:nTF {#1} { #3 = \etex_gluestretch:D #1 \scan_stop: #4 = \etex_glueshrink:D #1 \scan_stop: } { #3 = \c_zero_skip #4 = \c_zero_skip #2 } } \prg_new_conditional:Npnn \tl_if_single_token:n #1 { p , T , F , TF } { \tl_if_head_is_N_type:nTF {#1} { \__str_if_eq_x_return:nn { \exp_not:o { \use_none:n #1 } } { } } { \__str_if_eq_x_return:nn { \exp_not:n {#1} } { ~ } } } \cs_new:Npn \tl_reverse_tokens:n #1 { \etex_unexpanded:D \exp_after:wN { \tex_romannumeral:D \__tl_act:NNNnn \__tl_reverse_normal:nN \__tl_reverse_group:nn \__tl_reverse_space:n { } {#1} } } \cs_new:Npn \__tl_reverse_group:nn #1 { \__tl_act_group_recurse:Nnn \__tl_act_reverse_output:n { \tl_reverse_tokens:n } } \cs_new:Npn \__tl_act_group_recurse:Nnn #1#2#3 { \exp_args:Nf #1 { \exp_after:wN \exp_after:wN \exp_after:wN { #2 {#3} } } } \cs_new:Npn \tl_count_tokens:n #1 { \int_eval:n { \__tl_act:NNNnn \__tl_act_count_normal:nN \__tl_act_count_group:nn \__tl_act_count_space:n { } {#1} } } \cs_new:Npn \__tl_act_count_normal:nN #1 #2 { 1 + } \cs_new:Npn \__tl_act_count_space:n #1 { 1 + } \cs_new:Npn \__tl_act_count_group:nn #1 #2 { 2 + \tl_count_tokens:n {#2} + } \tl_const:Nn \c__tl_act_uppercase_tl { aA bB cC dD eE fF gG hH iI jJ kK lL mM nN oO pP qQ rR sS tT uU vV wW xX yY zZ } \tl_const:Nn \c__tl_act_lowercase_tl { Aa Bb Cc Dd Ee Ff Gg Hh Ii Jj Kk Ll Mm Nn Oo Pp Qq Rr Ss Tt Uu Vv Ww Xx Yy Zz } \cs_new:Npn \tl_expandable_uppercase:n #1 { \etex_unexpanded:D \exp_after:wN { \tex_romannumeral:D \__tl_act_case_aux:nn { \c__tl_act_uppercase_tl } {#1} } } \cs_new:Npn \tl_expandable_lowercase:n #1 { \etex_unexpanded:D \exp_after:wN { \tex_romannumeral:D \__tl_act_case_aux:nn { \c__tl_act_lowercase_tl } {#1} } } \cs_new:Npn \__tl_act_case_aux:nn { \__tl_act:NNNnn \__tl_act_case_normal:nN \__tl_act_case_group:nn \__tl_act_case_space:n } \cs_new:Npn \__tl_act_case_space:n #1 { \__tl_act_output:n {~} } \cs_new:Npn \__tl_act_case_normal:nN #1 #2 { \exp_args:Nf \__tl_act_output:n { \exp_args:NNo \str_case:nnn #2 {#1} { \exp_stop_f: #2 } } } \cs_new:Npn \__tl_act_case_group:nn #1 #2 { \exp_after:wN \__tl_act_output:n \exp_after:wN { \exp_after:wN { \tex_romannumeral:D \__tl_act_case_aux:nn {#1} {#2} } } } \cs_new:Npn \tl_item:nn #1#2 { \exp_args:Nf \__tl_item:nn { \int_eval:n { \int_compare:nNnT {#2} < \c_zero { \tl_count:n {#1} + \c_one + } #2 } } #1 \q_recursion_tail \__prg_break_point: } \cs_new:Npn \__tl_item:nn #1#2 { \__quark_if_recursion_tail_break:nN {#2} \__prg_break: \int_compare:nNnTF {#1} = \c_one { \__prg_break:n { \exp_not:n {#2} } } { \exp_args:Nf \__tl_item:nn { \int_eval:n { #1 - 1 } } } } \cs_new_nopar:Npn \tl_item:Nn { \exp_args:No \tl_item:nn } \cs_generate_variant:Nn \tl_item:Nn { c } \group_begin: \char_set_catcode_active:N \^^@ \cs_set:Npn \char_tmp:NN #1#2 { \cs_new:Npn #1 ##1 { \char_set_catcode_active:n { `##1 } \group_begin: \char_set_lccode:nn { `\^^@ } { `##1 } \tl_to_lowercase:n { \group_end: #2 ^^@ } } } \char_tmp:NN \char_set_active:Npn \cs_set:Npn \char_tmp:NN \char_set_active:Npx \cs_set:Npx \char_tmp:NN \char_gset_active:Npn \cs_gset:Npn \char_tmp:NN \char_gset_active:Npx \cs_gset:Npx \char_tmp:NN \char_set_active_eq:NN \cs_set_eq:NN \char_tmp:NN \char_gset_active_eq:NN \cs_gset_eq:NN \group_end: \group_begin: \char_set_catcode_other:N \O \char_set_catcode_other:N \U \char_set_catcode_other:N \T \char_set_catcode_other:N \E \char_set_catcode_other:N \R \tl_to_lowercase:n { \cs_new_protected_nopar:Npn \__peek_execute_branches_N_type: { \if_int_odd:w \if_catcode:w \exp_not:N \l_peek_token { \c_two \fi: \if_catcode:w \exp_not:N \l_peek_token } \c_two \fi: \if_meaning:w \l_peek_token \c_space_token \c_two \fi: \c_one \exp_after:wN \__peek_N_type:w \token_to_meaning:N \l_peek_token \q_mark \__peek_N_type_aux:nnw OUTER \q_mark \use_none_delimit_by_q_stop:w \q_stop \exp_after:wN \__peek_true:w \else: \exp_after:wN \__peek_false:w \fi: } \cs_new_protected:Npn \__peek_N_type:w #1 OUTER #2 \q_mark #3 { #3 {#1} {#2} } } \group_end: \cs_new_protected:Npn \__peek_N_type_aux:nnw #1 #2 #3 \fi: { \fi: \tl_if_in:noTF {#1} { \tl_to_str:n {ma} } { \__peek_true:w } { \tl_if_empty:nTF {#2} { \__peek_true:w } { \__peek_false:w } } } \cs_new_protected_nopar:Npn \peek_N_type:TF { \__peek_token_generic:NNTF \__peek_execute_branches_N_type: \scan_stop: } \cs_new_protected_nopar:Npn \peek_N_type:T { \__peek_token_generic:NNT \__peek_execute_branches_N_type: \scan_stop: } \cs_new_protected_nopar:Npn \peek_N_type:F { \__peek_token_generic:NNF \__peek_execute_branches_N_type: \scan_stop: } %% %% %% End of file `l3candidates.sty'.