diff options
Diffstat (limited to 'Master/texmf-dist/doc/generic/witharrows/witharrows.tex')
-rw-r--r-- | Master/texmf-dist/doc/generic/witharrows/witharrows.tex | 240 |
1 files changed, 185 insertions, 55 deletions
diff --git a/Master/texmf-dist/doc/generic/witharrows/witharrows.tex b/Master/texmf-dist/doc/generic/witharrows/witharrows.tex index 3655e422ca1..b1c30db494b 100644 --- a/Master/texmf-dist/doc/generic/witharrows/witharrows.tex +++ b/Master/texmf-dist/doc/generic/witharrows/witharrows.tex @@ -18,8 +18,8 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -\def\myfileversion{2.4} -\def\myfiledate{2020/03/31} +\def\myfileversion{2.5} +\def\myfiledate{2020/06/22} \input tikz.tex \input expl3-generic.tex \usetikzlibrary{arrows.meta,bending} @@ -41,7 +41,7 @@ \clist_map_inline:nn { amsmath, amsthm, autonum, cleveref, hyperref, mathtools, showlabels, - typedref, unicode-math, varwidth + typedref, unicode-math } { \bool_new:c { c__witharrows_#1_loaded_bool } @@ -188,6 +188,9 @@ \dim_set_eq:NN \l__witharrows_arrow_width_dim \c_max_dim \dim_new:N \l__witharrows_up_and_down_radius_dim \dim_set:Nn \l__witharrows_up_and_down_radius_dim { 4 pt } +\seq_new:N \l__witharrows_o_arrows_seq +\dim_new:N \l__witharrows_xoffset_for_o_arrows_dim +\dim_set:Nn \l__witharrows_xoffset_for_o_arrows_dim { 2 mm } \cs_new_protected:Npn \__witharrows_eval_if_allowed:n #1 { \str_if_empty:NTF \l__witharrows_previous_key_str @@ -405,6 +408,8 @@ allow-duplicate-names .code:n = \__witharrows_msg_redirect_name:nn { Duplicate~name } { none } , allow-duplicate-names .value_forbidden:n = true , + xoffset-for-o-arrows .dim_set:N = \l__witharrows_xoffset_for_o_arrows_dim , + xoffset-for-o-arrows .value_required:n = true , unknown .code:n = \__witharrows_sort_seq:N \l__witharrows_options_WithArrowsOptions_seq \__witharrows_error:n { Unknown~option~WithArrowsOptions } @@ -416,7 +421,7 @@ displaystyle, end-adjust, fleqn, group, groups, i, interline, jot, ll, lr, mathindent, max-length-of-arrow, no-arrows, up-and-down, rl, rr, show-node-names, show-nodes, start-adjust, t, tikz, wrap-lines, xoffset, - ygap, ystart, + xoffset-for-o-arrows, ygap, ystart, } \cs_new_protected:Npn \__witharrows_set_independent: { @@ -450,11 +455,22 @@ rl .default:n = NoValue , lr .default:n = NoValue , i .default:n = NoValue , - new-group .value_forbidden:n = true, + new-group .value_forbidden:n = true , new-group .code:n = \int_compare:nTF { \l__witharrows_pos_arrow_int = 6 } { \str_set:Nn \l__witharrows_status_arrow_str { new-group } } { \__witharrows_error:n { new-group~without~groups } } , + o .code:n = + \str_if_empty:NTF \l__witharrows_previous_key_str + { + \int_compare:nNnTF \l__witharrows_pos_arrow_int < 6 + { \__witharrows_error:n { invalid~key~o } } + { + \str_set:Nn \l__witharrows_status_arrow_str { over } + \str_set_eq:NN \l__witharrows_previous_key_str \l_keys_key_str + } + } + { \__witharrows_error:n { Incompatible~options~in~Arrow } } , tikz-code .code:n = \prg_do_nothing: , tikz-code .value_required:n = true , tikz .code:n = \prg_do_nothing: , @@ -479,8 +495,8 @@ \seq_new:N \l__witharrows_options_Arrow_seq \__witharrows_set_seq_of_str_from_clist:Nn \l__witharrows_options_Arrow_seq { - adjust, end-adjust, i, jump, ll, lr, rl, rr, start-adjust, tikz, tikz-code, - xoffset + adjust, end-adjust, i, jump, ll, lr, o , rl, rr, start-adjust, tikz, + tikz-code, xoffset } \cs_new_protected:Npn \__witharrows_fix_pos_arrow:n #1 { @@ -501,6 +517,7 @@ rl .code:n = \__witharrows_fix_pos_arrow:n 2 , lr .code:n = \__witharrows_fix_pos_arrow:n 0 , i .code:n = \__witharrows_fix_pos_arrow:n 5 , + o .code:n = \str_set:Nn \l__witharrows_previous_key_str { o } , xoffset .code:n = \bool_if:nTF { @@ -548,6 +565,7 @@ \prop_put:Nnn \l_tmpa_prop { options } { #1 , #3 } \prop_put:Nnn \l_tmpa_prop { label } { #2 } \prop_put:Nnx \l_tmpa_prop { input-line } \msg_line_number: + \prop_put:Nnn \l_tmpa_prop { width } { 0 pt } \prop_gclear_new:c { g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \g__witharrows_arrow_int _ prop } \prop_gset_eq:cN @@ -781,12 +799,12 @@ \bool_if:NT \l__witharrows_in_DispWithArrows_bool { & - \pgfpicture - \pgfrememberpicturepositiononpagetrue - \pgfcoordinate - { wa - \l__witharrows_prefix_str - \int_use:N \g__witharrows_line_int - v } - \pgfpointorigin - \endpgfpicture + \pgfpicture + \pgfrememberpicturepositiononpagetrue + \pgfcoordinate + { wa - \l__witharrows_prefix_str - \int_use:N \g__witharrows_line_int - v } + \pgfpointorigin + \endpgfpicture } \dim_compare:nNnT { #1 } < \c_zero_dim { \__witharrows_error:n { option~of~cr~negative } } @@ -932,7 +950,9 @@ { pgf @ sh @ ns @ wa - \l__witharrows_prefix_str - \l_tmpa_int - v } { \__witharrows_fatal:n { Inexistent~v-node } } { - \pgfpointanchor { wa - \l__witharrows_prefix_str - \l_tmpa_int - v } { center } + \pgfpointanchor + { wa - \l__witharrows_prefix_str - \l_tmpa_int - v } + { center } \dim_compare:nNnT \pgf@x < \g__witharrows_right_x_dim { \dim_gset_eq:NN \g__witharrows_right_x_dim \pgf@x } } @@ -993,15 +1013,18 @@ \int_compare:nNnF \l__witharrows_pos_arrow_int = 8 { \__witharrows_error:n { Too~few~lines~for~an~arrow } } } - \__witharrows_code_for_possible_arrow: + \__witharrows_treat_an_arrow_in_scan: \int_incr:N \l__witharrows_arrow_int } - \bool_lazy_and:nnT - { \bool_not_p:n { \int_compare_p:nNn \l__witharrows_pos_arrow_int = 7 } } - { \int_compare_p:nNn \l__witharrows_first_arrow_of_group_int > 0 } + \bool_if:nT + { + ! \int_compare_p:nNn \l__witharrows_pos_arrow_int = 7 + && + \int_compare_p:nNn \l__witharrows_first_arrow_of_group_int > 0 + } { \__witharrows_draw_arrows:nn \l__witharrows_first_arrow_of_group_int \g__witharrows_arrow_int } } -\cs_new_protected:Npn \__witharrows_code_for_possible_arrow: +\cs_new_protected:Npn \__witharrows_treat_an_arrow_in_scan: { \bool_lazy_and:nnT { \int_compare_p:nNn \l__witharrows_arrow_int > 1 } @@ -1040,8 +1063,7 @@ { \dim_set:Nn \l__witharrows_x_dim { - \c_max_dim } } } { - \bool_if:nF - { \str_if_eq_p:Vn \l__witharrows_status_arrow_str { independent } } + \str_if_eq:VnF \l__witharrows_status_arrow_str { independent } { \int_compare:nT { \l__witharrows_initial_int = \l__witharrows_first_line_of_group_int } @@ -1058,7 +1080,7 @@ } } } - \bool_if:nF { \str_if_eq_p:Vn \l__witharrows_status_arrow_str { independent } } + \str_if_eq:VnF \l__witharrows_status_arrow_str { independent } { \int_compare:nNnF \l__witharrows_pos_arrow_int = 8 { \__witharrows_update_x:nn \l__witharrows_initial_int \l__witharrows_final_int } @@ -1085,12 +1107,21 @@ { g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop } { final } \l_tmpa_tl \int_set:Nn \l__witharrows_final_int \l_tmpa_tl - \int_compare:nT { \l__witharrows_final_int <= \g__witharrows_line_int } \__witharrows_draw_arrows_i: + \prop_get:cnN + { g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop } + { status } \l__witharrows_status_arrow_str + \int_compare:nNnF \l__witharrows_final_int > \g__witharrows_line_int + { + \str_if_eq:VnTF \l__witharrows_status_arrow_str { over } + { \seq_put_right:NV \l__witharrows_o_arrows_seq \l__witharrows_arrow_int } + \__witharrows_draw_arrow: + } \int_incr:N \l__witharrows_arrow_int } + \__witharrows_draw_o_arrows_of_the_group: \group_end: } -\cs_new_protected:Npn \__witharrows_draw_arrows_i: +\cs_new_protected:Npn \__witharrows_draw_arrow: { \group_begin: \prop_get:cnN @@ -1208,18 +1239,28 @@ \cs_set:Npn \__witharrows_tmpa:nnn ##1 ##2 ##3 { \tikzpicture - [ - __witharrows_standard , - every~path / .style = WithArrows / arrow - ] + [ + __witharrows_standard , + every~path / .style = WithArrows / arrow + ] + \pgf@relevantforpicturesizetrue #1 + \dim_compare:nNnTF \pgf@picminx = { 16000 pt } + { \dim_set_eq:NN \l_tmpa_dim \c_zero_dim } + { \dim_set:Nn \l_tmpa_dim { \pgf@picmaxx - \pgf@picminx } } + \dim_add:Nn \l_tmpa_dim \l__witharrows_xoffset_dim + \prop_gput:cnV + { g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop } + { width } + \l_tmpa_dim + \pgfresetboundingbox \endtikzpicture } } \cs_new_protected:Npn \__witharrows_draw_arrow:nnn #1 #2 #3 { \bool_lazy_and:nnT \l__witharrows_wrap_lines_bool \l__witharrows_in_DispWithArrows_bool - { \tl_set_eq:NN \l__witharrows_tikz_code_tl \c__witharrows_tikz_code_wrap_lines_tl } + { \tl_set_eq:NN \l__witharrows_tikz_code_tl \c__witharrows_tikz_code_wrap_lines_tl } \exp_args:NV \__witharrows_def_function_tmpa:n \l__witharrows_tikz_code_tl \__witharrows_tmpa:nnn { #1 } { #2 } { #3 } } @@ -1241,7 +1282,7 @@ { \path ( __witharrows_label.west ) node [ anchor = west , text~width = \dim_use:N \l_tmpa_dim ] - { #3 } ; + { #3 } ; } } \cs_new_protected:Npn \__witharrows_update_x:nn #1 #2 @@ -1257,7 +1298,90 @@ \endpgfpicture \dim_set_eq:NN \l__witharrows_x_dim \g_tmpa_dim } -\cs_new:Npn \WithArrowsLastEnv { \int_use:N \g__witharrows_last_env_int } +\cs_new_protected:Npn \__witharrows_draw_o_arrows_of_the_group: + { + \seq_sort:Nn \l__witharrows_o_arrows_seq + { + \prop_get:cnN + { g__witharrows_arrow _ \l__witharrows_prefix_str _ ##1 _ prop } + { final } \l_tmpa_tl + \prop_get:cnN + { g__witharrows_arrow _ \l__witharrows_prefix_str _ ##2 _ prop } + { final } \l_tmpb_tl + \int_compare:nNnTF \l_tmpa_tl < \l_tmpb_tl + \sort_return_same: + { + \int_compare:nNnTF \l_tmpa_tl > \l_tmpb_tl + \sort_return_swapped: + { + \prop_get:cnN + { g__witharrows_arrow _ \l__witharrows_prefix_str _ ##1 _ prop } + { initial } \l_tmpa_tl + \prop_get:cnN + { g__witharrows_arrow _ \l__witharrows_prefix_str _ ##2 _ prop } + { initial } \l_tmpb_tl + \int_compare:nNnTF \l_tmpa_tl < \l_tmpb_tl + \sort_return_swapped: + \sort_return_same: + } + } + } + \seq_map_inline:Nn \l__witharrows_o_arrows_seq + { + \prop_get:cnN + { g__witharrows_arrow _ \l__witharrows_prefix_str _ ##1 _ prop } + { initial } \l_tmpa_tl + \int_set:Nn \l__witharrows_initial_int \l_tmpa_tl + \prop_get:cnN + { g__witharrows_arrow _ \l__witharrows_prefix_str _ ##1 _ prop } + { final } \l_tmpa_tl + \int_set:Nn \l__witharrows_final_int \l_tmpa_tl + \prop_get:cnN + { g__witharrows_arrow _ \l__witharrows_prefix_str _ ##1 _ prop } + { input-line } \l__witharrows_input_line_str + \dim_gzero:N \g_tmpa_dim + \bool_set_false:N \g_tmpa_bool + \pgfpicture + \pgfrememberpicturepositiononpagetrue + \int_step_inline:nnn \l__witharrows_first_arrow_int \l__witharrows_last_arrow_int + { + \prop_get:cnN + { g__witharrows_arrow _ \l__witharrows_prefix_str _ ####1 _ prop } + { initial } \l_tmpa_tl + \prop_get:cnN + { g__witharrows_arrow _ \l__witharrows_prefix_str _ ####1 _ prop } + { final } \l_tmpb_tl + \prop_get:cnN + { g__witharrows_arrow _ \l__witharrows_prefix_str _ ####1 _ prop } + { status } \l__witharrows_status_arrow_str + \bool_if:nT + { + ! \int_compare_p:n { ##1 = ####1 } + && \int_compare_p:n { \l__witharrows_initial_int <= \l_tmpa_tl } + && \int_compare_p:n { \l_tmpb_tl <= \l__witharrows_final_int } + && ! \str_if_eq_p:Vn \l__witharrows_status_arrow_str { independent } + } + { + \bool_gset_true:N \g_tmpa_bool + \prop_get:cnN + { g__witharrows _ arrow _ \l__witharrows_prefix_str _ ####1 _ prop } + { width } + \l_tmpa_tl + \dim_gset:Nn \g_tmpa_dim { \dim_max:nn \g_tmpa_dim \l_tmpa_tl } + } + } + \endpgfpicture + \bool_if:NTF \g_tmpa_bool + { + \int_set:Nn \l__witharrows_arrow_int { ##1 } + \dim_set_eq:NN \l__witharrows_xoffset_dim \g_tmpa_dim + \dim_add:Nn \l__witharrows_xoffset_dim \l__witharrows_xoffset_for_o_arrows_dim + \__witharrows_draw_arrow: + } + { \__witharrows_error:n { o~arrow~with~no~arrow~under } } + } + } +\cs_new:Npn \WithArrowsLastEnv { \int_use:N \g__witharrows_last_env_int } \keys_define:nn { WithArrows / Arrow / code-after } { tikz .code:n = @@ -1476,6 +1600,12 @@ must~not~be~empty.\\ \c__witharrows_option_ignored_str } +\__witharrows_msg_new:nn { invalid~key~o } + { + The~key~'o'~for~individual~arrows~can~be~used~only~in~mode~ + 'group'~or~in~mode~'groups'.\\ + \c__witharrows_option_ignored_str + } \__witharrows_msg_new:nn { Value~for~a~key } { The~key~'\l_keys_key_str'~should~be~used~without~value. \\ @@ -1574,11 +1704,17 @@ { Too~few~lines~for~an~arrow } { Line~\l__witharrows_input_line_str\ - :~an~arrow~specified~in~the~row~\int_use:N \l__witharrows_initial_int\ + :~an~arrow~specifiead~in~the~row~\int_use:N \l__witharrows_initial_int\ of~your~environment~\{\l__witharrows_type_env_str\}~can't~be~drawn~ because~it~arrives~after~the~last~row~of~the~environment. \\ If~you~go~on,~this~arrow~will~be~ignored. } +\__witharrows_msg_new:nn { o~arrow~with~no~arrow~under } + { + Line~\l__witharrows_input_line_str\ + :~there~is~no~arrow~'under'~your~arrow~of~type~'o'.\\ + If~you~go~on,~this~arrow~won't~be~drawn. + } \__witharrows_msg_new:nn { WithArrows~outside~math~mode } { The~environment~\{\l__witharrows_type_env_str\}~should~be~used~only~in~math~mode~ @@ -1588,7 +1724,7 @@ \__witharrows_msg_new:nn { DispWithArrows~in~math~mode } { The~environment~\{\l__witharrows_type_env_str\}~should~be~used~only~outside~math~ - mode~like~the~environment~\{align\}~of~amsmath. \\ + mode~like~the~environments~\{align\}~and~\{align*\}~of~amsmath. \\ This~error~is~fatal. } \__witharrows_msg_new:nn { Incompatible~options~in~Arrow } @@ -1830,37 +1966,31 @@ \str_if_empty:NT \l__witharrows_previous_key_str { \str_set:Nn \l__witharrows_previous_key_str { up } - \cs_if_exist:cTF { tikz@library@calc@loaded } - { - \keys_set:nV { WithArrows / up-and-down } \l_keys_value_tl - \int_set:Nn \l__witharrows_pos_arrow_int 1 - \bool_set_false:N \l__witharrows_wrap_lines_bool - \tl_set_eq:NN \l__witharrows_tikz_code_tl \c__witharrows_tikz_code_up_tl - } - { \__witharrows_error:n { calc~not~loaded } } + \cs_if_exist:cTF { tikz@library@calc@loaded } + { + \keys_set:nV { WithArrows / up-and-down } \l_keys_value_tl + \int_set:Nn \l__witharrows_pos_arrow_int 1 + \bool_set_false:N \l__witharrows_wrap_lines_bool + \tl_set_eq:NN \l__witharrows_tikz_code_tl \c__witharrows_tikz_code_up_tl + } + { \__witharrows_error:n { calc~not~loaded } } } , down .code:n = \str_if_empty:NT \l__witharrows_previous_key_str { \str_set:Nn \l__witharrows_previous_key_str { down } - \cs_if_exist:cTF { tikz@library@calc@loaded } - { - \keys_set:nV { WithArrows / up-and-down } \l_keys_value_tl - \int_set:Nn \l__witharrows_pos_arrow_int 1 - \bool_set_false:N \l__witharrows_wrap_lines_bool - \tl_set_eq:NN \l__witharrows_tikz_code_tl \c__witharrows_tikz_code_down_tl - } - { \__witharrows_error:n { calc~not~loaded } } + \cs_if_exist:cTF { tikz@library@calc@loaded } + { + \keys_set:nV { WithArrows / up-and-down } \l_keys_value_tl + \int_set:Nn \l__witharrows_pos_arrow_int 1 + \bool_set_false:N \l__witharrows_wrap_lines_bool + \tl_set_eq:NN \l__witharrows_tikz_code_tl \c__witharrows_tikz_code_down_tl + } + { \__witharrows_error:n { calc~not~loaded } } } } \seq_put_right:Nn \l__witharrows_options_Arrow_seq { down } \seq_put_right:Nn \l__witharrows_options_Arrow_seq { up } -\__witharrows_msg_new:nn { varwidth~not~loaded } - { - You~can't~use~the~option~'\l_keys_key_str'~because~ - you~don't~have~loaded~the~package~'varwidth'. \\ - \c__witharrows_option_ignored_str - } \__witharrows_msg_new:nn { calc~not~loaded } { You~can't~use~the~option~'\l_keys_key_str'~because~you~don't~have~loaded~the~ |