diff options
author | Karl Berry <karl@freefriends.org> | 2017-11-29 22:08:38 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-11-29 22:08:38 +0000 |
commit | 7d16aaa59d05797f4d1053a1d2dbbe768df50e04 (patch) | |
tree | 7e838a5f8522cba5c754ef3e90fb674138938704 /Master/texmf-dist/tex | |
parent | 41621b0b484649afdce10d4a48951b78320c6728 (diff) |
witharrows (29nov17)
git-svn-id: svn://tug.org/texlive/trunk@45946 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/witharrows/witharrows.sty | 384 |
1 files changed, 196 insertions, 188 deletions
diff --git a/Master/texmf-dist/tex/latex/witharrows/witharrows.sty b/Master/texmf-dist/tex/latex/witharrows/witharrows.sty index 5f9619ed32c..b18863db15c 100644 --- a/Master/texmf-dist/tex/latex/witharrows/witharrows.sty +++ b/Master/texmf-dist/tex/latex/witharrows/witharrows.sty @@ -18,18 +18,17 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -\def\myfileversion{1.1} -\def\myfiledate{2017/11/06} +\def\myfileversion{1.2} +\def\myfiledate{2017/11/29} +\RequirePackage{tikz} +\usetikzlibrary{calc,arrows.meta,bending} \RequirePackage{l3keys2e} \ProvidesExplPackage {witharrows} {\myfiledate} {\myfileversion} {Draws arrows for explanations on the right} -\RequirePackage{expl3} \RequirePackage{xparse} -\RequirePackage{tikz} -\usetikzlibrary{calc,arrows.meta,bending} \RequirePackage{footnote} \tikzstyle{__wa_node_style}=[rectangle, inner~sep = 0 pt, @@ -44,157 +43,115 @@ \seq_new:N \g__wa_position_in_the_tree_seq \seq_gput_right:Nn \g__wa_position_in_the_tree_seq 1 \int_new:N \g__wa_last_env_int +\int_new:N \l__wa_level_int \skip_new:N \l__wa_interline_skip \bool_new:N \l__wa_MoreColumns_bool -\int_new:N \l__wa_pos_int -\bool_new:N \l__wa_initial_r_bool -\bool_set_true:N \l__wa_initial_r_bool -\bool_new:N \l__wa_final_r_bool -\bool_set_true:N \l__wa_final_r_bool -\bool_new:N \l__wa_i_bool +\int_new:N \l__wa_pos_env_int +\int_new:N \l__wa_pos_arrows_int +\int_new:N \l__wa_previous_pos_arrows_int \dim_new:N \l__wa_xoffset_dim \dim_set:Nn \l__wa_xoffset_dim {3mm} \bool_new:N \l__wa_shownodes_bool \bool_new:N \l__wa_shownodenames_bool \bool_new:N \l__wa_displaystyle_bool \tl_clear_new:N \l__wa_options_tikz_tl -\bool_new:N \l__wa_position_key_already_set_bool -\seq_new:N \g__wa_stack_counter_arrows_seq +\dim_new:N \g__wa_x_dim +\seq_new:N \g__wa_arrow_int_seq \int_new:N \g__wa_arrow_int -\seq_new:N \g__wa_stack_counter_lines_seq +\seq_new:N \g__wa_line_int_seq \int_new:N \g__wa_line_int -\seq_new:N \g__wa_stack_counter_lines_bis_seq +\seq_new:N \g__wa_line_bis_int_seq \int_new:N \g__wa_line_bis_int -\keys_define:nn {WithArrows} - { jump .groups:n = {jump,secondary}, - jump .code:n = {\int_set:Nn \l__wa_jump_int {#1} - \int_compare:nNnF \l__wa_jump_int > 0 - {\msg_error:nn {witharrows} - {The~option~"jump"~must~be~non~negative}}}, - jump .value_required:n = true, - t .groups:n = {global,env,secondary}, - t .code:n = {\int_set:Nn \l__wa_pos_int 0}, +\keys_define:nn {WithArrows/GlobalOrEnv} + { t .code:n = {\int_set:Nn \l__wa_pos_env_int 0}, t .value_forbidden:n = true, - c .groups:n = {global,env,secondary}, - c .code:n = {\int_set:Nn \l__wa_pos_int 1}, + c .code:n = {\int_set:Nn \l__wa_pos_env_int 1}, c .value_forbidden:n = true, - b .groups:n = {global,env,secondary}, - b .code:n = {\int_set:Nn \l__wa_pos_int 2}, + b .code:n = {\int_set:Nn \l__wa_pos_env_int 2}, b .value_forbidden:n = true, - MoreColumns .groups:n = {global,env,secondary}, MoreColumns .bool_set:N = \l__wa_MoreColumns_bool, - MoreColumns .default:n = true, MoreColumns .value_forbidden:n = true, - CommandName .groups:n = {global,env,secondary}, CommandName .tl_set:N = \l__wa_CommandName_tl, CommandName .initial:n = {Arrow}, CommandName .value_required:n = true, - displaystyle .groups:n = {global,env,secondary}, - displaystyle .bool_set:N = \l__wa_displaystyle_bool, - % - shownodes .groups:n = {global,env,secondary}, + displaystyle .bool_set:N = \l__wa_displaystyle_bool, shownodes .bool_set:N = \l__wa_shownodes_bool, - shownodes .default:n = true, - shownodenames .groups:n = {global,env,secondary}, - shownodenames .bool_set:N = \l__wa_shownodenames_bool, - shownodenames .default:n = true, - jot .groups:n = {env,secondary}, - jot .dim_set:N = \jot, - jot .value_required:n = true, - interline .groups:n = {env,secondary}, - interline .skip_set:N = \l__wa_interline_skip, - interline .initial:n = \c_zero_skip, - interline .value_required:n = true, - xoffset .groups:n = {global,env,local,secondary}, - xoffset .dim_set:N = \l__wa_xoffset_dim, - xoffset .value_required:n = true, - tikz .groups:n = {global,env,local,secondary}, - tikz .code:n = {\tl_put_right:Nn \l__wa_options_tikz_tl {,#1}}, + shownodenames .bool_set:N = \l__wa_shownodenames_bool, + group .code:n = {\int_compare:nNnT \l__wa_previous_pos_arrows_int > {-1} + {\msg_error:nn {witharrows} + {Two~options~are~incompatible}} + \int_set:Nn \l__wa_previous_pos_arrows_int 5 + \int_set:Nn \l__wa_pos_arrows_int 5}, + group .value_forbidden:n = true, + groups .code:n = {\int_compare:nNnT \l__wa_previous_pos_arrows_int > {-1} + {\msg_error:nn {witharrows} + {Two~options~are~incompatible}} + \int_set:Nn \l__wa_previous_pos_arrows_int 6 + \int_set:Nn \l__wa_pos_arrows_int 6}, + groups .value_forbidden:n = true} +\keys_define:nn {WithArrows} + {tikz .code:n = {\tl_put_right:Nn \l__wa_options_tikz_tl {,#1}}, tikz .value_required:n = true, - ll .groups:n = {global,env,local,secondary}, + rr .value_forbidden:n = true, + rr .code:n = {\__wa_analyze_option_position:n 0}, ll .value_forbidden:n = true, - ll .default:n = true, - ll .code:n = {\bool_if:NT \l__wa_position_key_already_set_bool - {\msg_error:nn {witharrows} - {Two~options~are~incompatible}} - \bool_if:NT \l__wa_group_bool - {\msg_error:nn {witharrows} - {Option~incompatible~with~group}} - \bool_set_true:N \l__wa_position_key_already_set_bool - \bool_set_false:N \l__wa_initial_r_bool - \bool_set_false:N \l__wa_final_r_bool - \bool_set_false:N \l__wa_i_bool }, - lr .groups:n = {global,env,local,secondary}, - lr .value_forbidden:n = true, - lr .default:n = true, - lr .code:n = {\bool_if:NT \l__wa_position_key_already_set_bool - {\msg_error:nn {witharrows} - {Two~options~are~incompatible}} - \bool_if:NT \l__wa_group_bool - {\msg_error:nn {witharrows} - {Option~incompatible~with~group}} - \bool_set_true:N \l__wa_position_key_already_set_bool - \bool_set_false:N \l__wa_initial_r_bool - \bool_set_true:N \l__wa_final_r_bool - \bool_set_false:N \l__wa_i_bool}, - rl .groups:n = {global,env,local,secondary}, + ll .code:n = {\__wa_analyze_option_position:n 1}, rl .value_forbidden:n = true, - rl .default:n = true, - rl .code:n = {\bool_if:NT \l__wa_position_key_already_set_bool - {\msg_error:nn {witharrows} - {Two~options~are~incompatible}} - \bool_if:NT \l__wa_group_bool - {\msg_error:nn {witharrows} - {Option~incompatible~with~group}} - \bool_set_true:N \l__wa_position_key_already_set_bool - \bool_set_true:N \l__wa_initial_r_bool - \bool_set_false:N \l__wa_final_r_bool - \bool_set_false:N \l__wa_i_bool}, - rr .groups:n = {global,env,local,secondary}, - rr .value_forbidden:n = true, - rr .default:n = true, - rr .code:n = {\bool_if:NT \l__wa_position_key_already_set_bool - {\msg_error:nn {witharrows} - {Two~options~are~incompatible}} - \bool_if:NT \l__wa_group_bool - {\msg_error:nn {witharrows} - {Option~incompatible~with~group}} - \bool_set_true:N \l__wa_position_key_already_set_bool - \bool_set_true:N \l__wa_initial_r_bool - \bool_set_true:N \l__wa_final_r_bool - \bool_set_false:N \l__wa_i_bool}, - i .groups:n = {global,env,local,secondary}, - i .code:n = {\bool_if:NT \l__wa_position_key_already_set_bool - {\msg_error:nn {witharrows} - {Two~options~are~incompatible}} - \bool_if:NT \l__wa_group_bool - {\msg_error:nn {witharrows} - {Option~incompatible~with~group}} - \bool_set_true:N \l__wa_position_key_already_set_bool - \bool_set_true:N \l__wa_i_bool}, + rl .code:n = {\__wa_analyze_option_position:n 2}, + lr .value_forbidden:n = true, + lr .code:n = {\__wa_analyze_option_position:n 3}, i .value_forbidden:n = true, - i .default:n = true, - group .groups:n = {global,env}, - group .bool_set:N = \l__wa_group_bool, - group .value_forbidden:n = true + i .code:n = {\__wa_analyze_option_position:n 4}, + xoffset .code:n = {\bool_if:nTF {\int_compare_p:nNn \l__wa_level_int = 2 && + \int_compare_p:nNn \l__wa_pos_arrows_int > 4} + {\msg_error:nn {witharrows} + {Option~incompatible~with~"group(s)"}} + {\dim_set:Nn \l__wa_xoffset_dim {#1}}}, + xoffset .value_required:n = true, + jot .code:n = {\int_compare:nNnTF \l__wa_level_int = 1 + {\dim_set:Nn \jot {#1}} + {\msg_error:nn {witharrows} {Option~will~be~ignored} }}, + jot .value_required:n = true, + interline .code:n = {\int_compare:nNnTF \l__wa_level_int = 1 + {\skip_set:Nn \l__wa_interline_skip {#1}} + {\msg_error:nn {witharrows} {Option~will~be~ignored}}}, + interline .value_required:n = true, + jump .code:n = {\msg_error:nn {witharrows} {Option~will~be~ignored}}, + unknown .code:n = {\msg_error:nn {witharrows} {Option~unknown}} } +\keys_define:nn {WithArrows/jump} + {jump .code:n = {\int_set:Nn \l__wa_jump_int {#1} + \int_compare:nNnF \l__wa_jump_int > 0 + {\msg_error:nn {witharrows} + {The~option~"jump"~must~be~non~negative}}}, + jump .value_required:n = true} +\cs_new_protected:Nn \__wa_analyze_option_position:n + {\int_compare:nNnT \l__wa_previous_pos_arrows_int > {-1} + {\msg_error:nn {witharrows} + {Two~options~are~incompatible}} + \int_set:Nn \l__wa_previous_pos_arrows_int {#1} + \bool_if:nTF { \int_compare_p:nNn \l__wa_level_int = 2 && + \int_compare_p:nNn \l__wa_pos_arrows_int > 4} + {\msg_error:nn {witharrows} + {Option~incompatible~with~"group(s)"}} + {\int_set:Nn \l__wa_pos_arrows_int {#1}}} \ProcessKeysOptions {WithArrows} \NewDocumentCommand \WithArrowsOptions {m} - {\bool_set_false:N \l__wa_position_key_already_set_bool - \keys_set_filter:nnn {WithArrows} {secondary} {#1} - \keys_set_groups:nnn {WithArrows} {global} {#1}} + {\int_set:Nn \l__wa_previous_pos_arrows_int {-1} + \keys_set_known:nnN {WithArrows} {#1} \l_tmpa_tl + \keys_set:nV {WithArrows/GlobalOrEnv} \l_tmpa_tl} \NewDocumentCommand \__wa_Arrow {O{} m O{}} {\tl_if_eq:noF {WithArrows} {\@currenvir} {\msg_error:nn {witharrows} {Arrow~used~outside~{WithArrows}~environment}} \int_gincr:N \g__wa_arrow_int \int_zero_new:N \l__wa_jump_int \int_set:Nn \l__wa_jump_int 1 - \keys_set_groups:nnn {WithArrows} {jump} {#1,#3} + \keys_set_known:nnN {WithArrows/jump} {#1,#3} \l_tmpa_tl \prop_put:NnV \l_tmpa_prop {initial} \g__wa_line_int \int_set:Nn \l_tmpa_int {\g__wa_line_int + \l__wa_jump_int} \prop_put:NnV \l_tmpa_prop {final} \l_tmpa_int - \prop_put:Nnn \l_tmpa_prop {options} {#1,#3} + \prop_put:NnV \l_tmpa_prop {options} \l_tmpa_tl \prop_put:Nnn \l_tmpa_prop {label} {#2} \prop_gclear_new:c {g__wa_arrow_\l__wa_prefix_tl _\int_use:N\g__wa_arrow_int _prop} @@ -203,11 +160,11 @@ \l_tmpa_prop } \NewDocumentEnvironment {WithArrows} {O{}} - { \seq_gput_right:NV \g__wa_stack_counter_arrows_seq \g__wa_arrow_int + { \seq_gput_right:NV \g__wa_arrow_int_seq \g__wa_arrow_int \int_gzero:N \g__wa_arrow_int - \seq_gput_right:NV \g__wa_stack_counter_lines_seq \g__wa_line_int + \seq_gput_right:NV \g__wa_line_int_seq \g__wa_line_int \int_gzero:N \g__wa_line_int - \seq_gput_right:NV \g__wa_stack_counter_lines_bis_seq \g__wa_line_bis_int + \seq_gput_right:NV \g__wa_line_bis_int_seq \g__wa_line_bis_int \int_gzero:N \g__wa_line_bis_int \seq_gput_right:Nn \g__wa_position_in_the_tree_seq 1 \seq_set_eq:NN \l_tmpa_seq \g__wa_position_in_the_tree_seq @@ -224,12 +181,13 @@ \int_zero_new:N \l__wa_initial_int \int_zero_new:N \l__wa_final_int \int_zero_new:N \l__wa_arrow_int - \bool_set_false:N \l__wa_position_key_already_set_bool \skip_zero:N \l__wa_interline_skip - \keys_set_filter:nnn {WithArrows} {secondary} {#1} - \keys_set_groups:nnn {WithArrows} {env} {#1} + \int_set:Nn \l__wa_previous_pos_arrows_int {-1} + \int_set:Nn \l__wa_level_int 1 + \keys_set_known:nnN {WithArrows} {#1} \l_tmpa_tl + \keys_set:nV {WithArrows/GlobalOrEnv} \l_tmpa_tl \cs_set_eq:cN \l__wa_CommandName_tl \__wa_Arrow - \int_case:nn \l__wa_pos_int + \int_case:nn \l__wa_pos_env_int {0 {\vtop} 1 {\vcenter} 2 {\vbox}} @@ -263,18 +221,20 @@ \int_compare:nNnT \g__wa_line_bis_int < \g__wa_line_int {\msg_error:nn {witharrows} {All~lines~must~have~an~ampersand}} \int_compare:nNnT \g__wa_arrow_int > 0 + {\int_compare:nNnTF \l__wa_pos_arrows_int > 4 \__wa_draw_arrows: + {\__wa_draw_arrows:nn 1 \g__wa_arrow_int}} \spewnotes \seq_gpop_right:NN \g__wa_position_in_the_tree_seq \l_tmpa_tl \seq_gpop_right:NN \g__wa_position_in_the_tree_seq \l_tmpa_tl \seq_gput_right:Nx \g__wa_position_in_the_tree_seq {\int_eval:n {\l_tmpa_tl + 1}} \int_compare:nNnT {\seq_count:N \g__wa_position_in_the_tree_seq} = 1 {\int_gincr:N \g__wa_last_env_int} - \seq_gpop_right:NN \g__wa_stack_counter_arrows_seq {\l_tmpa_tl} + \seq_gpop_right:NN \g__wa_arrow_int_seq {\l_tmpa_tl} \int_gset:Nn \g__wa_arrow_int {\l_tmpa_tl} - \seq_gpop_right:NN \g__wa_stack_counter_lines_seq \l_tmpa_tl + \seq_gpop_right:NN \g__wa_line_int_seq \l_tmpa_tl \int_gset:Nn \g__wa_line_int {\l_tmpa_tl} - \seq_gpop_right:NN \g__wa_stack_counter_lines_bis_seq \l_tmpa_tl + \seq_gpop_right:NN \g__wa_line_bis_int_seq \l_tmpa_tl \int_gset:Nn \g__wa_line_bis_int {\l_tmpa_tl} } \cs_set_protected:Nn \__wa_cr: @@ -287,18 +247,53 @@ {\group_align_safe_end: \cr\noalign{\skip_vertical:n {#1 + \l__wa_interline_skip} \scan_stop:}} -\cs_generate_variant:Nn \keys_set_groups:nnn {nno} -\cs_new_protected:Nn \keys_set_groups_WithArrows_local: - {\keys_set_groups:nno {WithArrows} {local}} -\cs_generate_variant:Nn \keys_set_filter:nnn {nno} -\cs_new_protected:Nn \keys_set_filter_WithArrows_secondary: - {\keys_set_filter:nno {WithArrows} {secondary}} \cs_new_protected:Nn \__wa_draw_arrows: - { - \bool_if:NT \l__wa_group_bool - \__wa_x_computation_for_option_group: - \int_set:Nn \l__wa_arrow_int 1 - \int_until_do:nNnn \l__wa_arrow_int > \g__wa_arrow_int + { \group_begin: + \int_zero_new:N \l__wa_first_arrow_of_group_int + \int_zero_new:N \l__wa_first_line_of_group_int + \int_zero_new:N \l__wa_last_line_of_group_int + \bool_set_true:N \l__wa_new_group_bool + \int_set:Nn \l__wa_arrow_int 1 + \int_until_do:nNnn \l__wa_arrow_int > \g__wa_arrow_int + { + \prop_get:cnN {g__wa_arrow_\l__wa_prefix_tl _\int_use:N\l__wa_arrow_int _prop} + {initial} \l_tmpa_tl + \int_set:Nn \l__wa_initial_int {\l_tmpa_tl} + \prop_get:cnN {g__wa_arrow_\l__wa_prefix_tl _\int_use:N\l__wa_arrow_int _prop} + {final} \l_tmpa_tl + \int_set:Nn \l__wa_final_int {\l_tmpa_tl} + \bool_if:nT { \int_compare_p:nNn \l__wa_pos_arrows_int = 6 + && \int_compare_p:nNn \l__wa_arrow_int > 1 + && \int_compare_p:nNn \l__wa_initial_int > \l__wa_last_line_of_group_int} + {\__wa_draw_arrows:nn \l__wa_first_arrow_of_group_int {\l__wa_arrow_int - 1} + \bool_set_true:N \l__wa_new_group_bool} + \bool_if:nTF \l__wa_new_group_bool + {\bool_set_false:N \l__wa_new_group_bool + \int_set:Nn \l__wa_first_arrow_of_group_int \l__wa_arrow_int + \int_set:Nn \l__wa_first_line_of_group_int \l__wa_initial_int + \int_set:Nn \l__wa_last_line_of_group_int \l__wa_final_int + \tikz[remember~picture] + \path let \p1 = (wa-\tl_use:N\l__wa_prefix_tl-\int_use:N\l__wa_initial_int-l) + in \pgfextra {\dim_gset:Nn \g__wa_x_dim {\x1}} ; + } + {\int_set:Nn \l__wa_last_line_of_group_int + {\int_max:nn \l__wa_last_line_of_group_int \l__wa_final_int}} + \__wa_actualise_x_value:nn \l__wa_initial_int \l__wa_final_int + \int_incr:N \l__wa_arrow_int + } + \__wa_draw_arrows:nn \l__wa_first_arrow_of_group_int \g__wa_arrow_int + \group_end: + } +\cs_generate_variant:Nn \keys_set:nn {no} +\cs_new_protected:Nn \keys_set_WithArrows: {\keys_set:no {WithArrows}} +\cs_new_protected:Nn \__wa_draw_arrows:nn + {\group_begin: + \int_zero_new:N \l__wa_first_arrow_int + \int_set:Nn \l__wa_first_arrow_int {#1} + \int_zero_new:N \l__wa_last_arrow_int + \int_set:Nn \l__wa_last_arrow_int {#2} + \int_set:Nn \l__wa_arrow_int \l__wa_first_arrow_int + \int_until_do:nNnn \l__wa_arrow_int > \l__wa_last_arrow_int { \prop_get:cnN {g__wa_arrow_\l__wa_prefix_tl _\int_use:N\l__wa_arrow_int _prop} {initial} \l_tmpa_tl @@ -309,14 +304,25 @@ \int_compare:nNnT \l__wa_final_int > \g__wa_line_int {\msg_error:nn {witharrows} {Too~few~lines~for~an~arrow}} \group_begin: - \keys_define:nn {WithArrows} {group .undefine:} - \bool_set_false:N \l__wa_position_key_already_set_bool + \int_set:Nn \l__wa_previous_pos_arrows_int {-1} + \int_set:Nn \l__wa_level_int 2 \prop_get:cnN {g__wa_arrow_\l__wa_prefix_tl _\int_use:N\l__wa_arrow_int _prop} {options} \l_tmpa_tl - \exp_args:NNo \exp_args:No \keys_set_filter_WithArrows_secondary: {\l_tmpa_tl} - \exp_args:NNo \exp_args:No \keys_set_groups_WithArrows_local: {\l_tmpa_tl} - \bool_if:NT \l__wa_i_bool - \__wa_x_computation_for_option_i: + \exp_args:NNo \exp_args:No \keys_set_WithArrows: {\l_tmpa_tl} +\bool_set_false:N \l__wa_initial_r_bool +\bool_set_false:N \l__wa_final_r_bool +\int_case:nn \l__wa_pos_arrows_int + {0 {\bool_set_true:N \l__wa_initial_r_bool + \bool_set_true:N \l__wa_final_r_bool} + 2 {\bool_set_true:N \l__wa_initial_r_bool} + 3 {\bool_set_true:N \l__wa_final_r_bool}} + \int_compare:nNnT \l__wa_pos_arrows_int = 4 + { + \tikz[remember~picture] + \path let \p1 = (wa-\tl_use:N\l__wa_prefix_tl-\int_use:N\l__wa_initial_int-l) + in \pgfextra {\dim_gset:Nn \g__wa_x_dim {\x1}} ; + \__wa_actualise_x_value:nn \l__wa_initial_int \l__wa_final_int + } \tl_set:Nx \l__wa_initial_tl {wa-\tl_use:N\l__wa_prefix_tl-\int_use:N\l__wa_initial_int- \bool_if:NTF\l__wa_initial_r_bool rl} @@ -337,27 +343,24 @@ \draw \exp_after:wN [\l__wa_options_tikz_tl] let \p1 = (\tl_use:N \l__wa_initial_tl), \p2 = (\tl_use:N \l__wa_final_tl) in - (\bool_if:nTF {\l__wa_group_bool || \l__wa_i_bool} + (\int_compare:nNnTF \l__wa_pos_arrows_int > 3 {\dim_use:N \g__wa_x_dim + \dim_use:N \l__wa_xoffset_dim, \y1} {\x1 + \dim_use:N \l__wa_xoffset_dim, \y1} ) to node [node~contents = {\tl_use:N \l_tmpa_tl}] {} - (\bool_if:nTF {\l__wa_group_bool || \l__wa_i_bool} + (\int_compare:nNnTF \l__wa_pos_arrows_int > 3 {\dim_use:N \g__wa_x_dim + \dim_use:N \l__wa_xoffset_dim, \y2} {\x2 + \dim_use:N \l__wa_xoffset_dim, \y2} ) ; \end{tikzpicture} \group_end: \int_incr:N \l__wa_arrow_int } + \group_end: } -\cs_new_protected:Nn \__wa_x_computation_for_option_i: - {\dim_gzero_new:N \g__wa_x_dim - \tikz[remember~picture] - \path let \p1 = (wa-\tl_use:N\l__wa_prefix_tl-\int_use:N\l__wa_initial_int-l) - in \pgfextra {\dim_gset:Nn \g__wa_x_dim {\x1}} ; - \__wa_x_computation_analyze_lines_between: - } -\cs_new_protected:Nn \__wa_x_computation_analyze_lines_between: - {\int_compare:nNnT \l__wa_final_int > \g__wa_line_int +\cs_new_protected:Nn \__wa_actualise_x_value:nn + {\group_begin: + \int_set:Nn \l__wa_initial_int {#1} + \int_set:Nn \l__wa_final_int {#2} + \int_compare:nNnT \l__wa_final_int > \g__wa_line_int {\msg_error:nn {witharrows} {Too~few~lines~for~an~arrow}} \int_set:Nn \l_tmpa_int \l__wa_initial_int \int_until_do:nNnn \l_tmpa_int > \l__wa_final_int @@ -366,29 +369,9 @@ in \pgfextra {\dim_gset:Nn \g__wa_x_dim {\dim_max:nn \g__wa_x_dim {\x1}}} ; \int_incr:N \l_tmpa_int } + \group_end: } -\cs_new_protected:Nn \__wa_x_computation_for_option_group: - {\dim_gzero_new:N \g__wa_x_dim - \prop_get:cnN {g__wa_arrow_\l__wa_prefix_tl _1_prop} {initial} \l_tmpa_tl - \tikz[remember~picture] - \path let \p1 = (wa-\tl_use:N\l__wa_prefix_tl-\tl_use:N\l_tmpa_tl-l) - in \pgfextra {\dim_gset:Nn \g__wa_x_dim {\x1}} ; - \int_set:Nn \l__wa_arrow_int 1 - \int_until_do:nNnn \l__wa_arrow_int > \g__wa_arrow_int - { - \prop_get:cnN {g__wa_arrow_\l__wa_prefix_tl _\int_use:N\l__wa_arrow_int _prop} - {initial} \l_tmpa_tl - \int_set:Nn \l__wa_initial_int {\l_tmpa_tl} - \prop_get:cnN {g__wa_arrow_\l__wa_prefix_tl _\int_use:N\l__wa_arrow_int _prop} - {final} \l_tmpa_tl - \int_set:Nn \l__wa_final_int {\l_tmpa_tl} - \__wa_x_computation_analyze_lines_between: - \int_incr:N \l__wa_arrow_int - } - } -\cs_generate_variant:Nn \int_compare:nNnT {cNnT} \cs_generate_variant:Nn \tl_if_eq:nnF {noF} -\bigskip \NewDocumentCommand \WithArrowsLastEnv {} {\int_use:N \g__wa_last_env_int} \msg_new:nnn {witharrows} @@ -415,16 +398,24 @@ {{WithArrows}~used~outside~math~mode} {The~environment~\{WithArrows\}~should~be~used~only~in~math~mode.~ Nevertheless,~you~can~go~on.} -\msg_new:nnn {witharrows} - {Option~incompatible~with~group} - {You~try~to~use~the~option~"\tl_use:N\l_keys_key_tl"~while~ - you~are~using~the~option~"group".~It's~incompatible.~You~can~go~on~ignoring~ - this~option~"\tl_use:N\l_keys_key_tl"~and~"group"~will~be~used.} -\msg_new:nnn {witharrows} - {Two~options~are~incompatible} - {You~try~to~use~the~option~"\tl_use:N\l_keys_key_tl"~but~ - this~option~is~incompatible~with~an~option~previously~set.~ - If~you~go~on,~I~will~overwrite~the~previous~option.} +\msg_new:nnn {witharrows} + {Two~options~are~incompatible} + {You~try~to~use~the~option~"\tl_use:N\l_keys_key_tl"~but~ + this~option~is~incompatible~or~redundant~with~the~option~" + \int_case:nn\l__wa_previous_pos_arrows_int + {0 {rr} + 1 {ll} + 2 {rl} + 3 {lr} + 4 {i} + 5 {group} + 6 {groups}}"~ + previously~set~in~the~same~ + \int_case:nn\l__wa_level_int + {0 {command~\string\WithArrowsOptions} + 1 {declaration~of~options~of~the~environment~\{WithArrows\}} + 2 {command~\string\Arrow}}.~ + If~you~go~on,~I~will~overwrite~the~first~option.} \msg_new:nnnn {witharrows} {All~lines~must~have~an~ampersand} {All~lines~of~an~environment~\{WithArrows\}~must~have~an~second~column~ @@ -432,6 +423,23 @@ you~will~have~an~pgf~error~for~an~undefined~shape.} {The~ampersand~can~be~implicit~ (e.g.~if~you~use~\string\MoveEqLeft\space~of~mathtools).} +\msg_new:nnn {witharrows} + {Option~incompatible~with~"group(s)"} + {You~try~to~use~the~option~"\tl_use:N\l_keys_key_tl"~while~ + you~are~using~the~option~" + \int_compare:nNnTF \l__wa_pos_arrows_int = 5 + {group} + {groups}".~ + It's~incompatible.~You~can~go~on~ignoring~this~option~ + "\tl_use:N\l_keys_key_tl"~but~you~should~correct~your~code.} +\msg_new:nnn {witharrows} + {Option~will~be~ignored} + {The~option~"\tl_use:N\l_keys_key_tl"~can't~be~used~here.~ + If~you~go~on,~it~will~be~ignored.} +\msg_new:nnn {witharrows} + {Option~unknown} + {The~option~"\tl_use:N\l_keys_key_tl"~is~unknown~or~meaningless~in~the~context.~ + If~you~go~on,~it~will~be~ignored.} \endinput %% %% End of file `witharrows.sty'. |