diff options
author | Karl Berry <karl@freefriends.org> | 2019-02-20 22:43:27 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-02-20 22:43:27 +0000 |
commit | 13e83447acffcbf8e5b5bdff88b9caefdf56174d (patch) | |
tree | ee201e1b29f8d93ba204ca7b3784b9f12a0acb47 /Master/texmf-dist/tex/latex | |
parent | a6ac60af0643541f56f02f41ce626a57c9c6965a (diff) |
witharrows (20feb19)
git-svn-id: svn://tug.org/texlive/trunk@50078 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/witharrows/witharrows.sty | 2940 |
1 files changed, 1719 insertions, 1221 deletions
diff --git a/Master/texmf-dist/tex/latex/witharrows/witharrows.sty b/Master/texmf-dist/tex/latex/witharrows/witharrows.sty index 98375f94bd6..fe205670990 100644 --- a/Master/texmf-dist/tex/latex/witharrows/witharrows.sty +++ b/Master/texmf-dist/tex/latex/witharrows/witharrows.sty @@ -18,1256 +18,1754 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -\def\myfileversion{1.14} -\def\myfiledate{2019/02/01} +\def\myfileversion{1.15} +\def\myfiledate{2019/02/20} \RequirePackage{tikz} \usetikzlibrary{arrows.meta,bending} -\RequirePackage{expl3}[2019/01/28] +\RequirePackage{expl3}[2019/02/15] \RequirePackage{l3keys2e} \ProvidesExplPackage {witharrows} {\myfiledate} {\myfileversion} {Draws arrows for explanations on the right} -\RequirePackage{xparse}[2018-10-17] -\bool_new:N \g__wa_footnotehyper_bool -\bool_new:N \g__wa_footnote_bool -\int_new:N \l__wa_level_int -\keys_define:nn {WithArrows/package} - {footnote .bool_gset:N = \g__wa_footnote_bool, - footnotehyper .bool_gset:N = \g__wa_footnotehyper_bool, - unknown .code:n = \msg_fatal:nn {witharrows} - {Option~unknown~for~package}} -\msg_new:nnn {witharrows} - {Option~unknown~for~package} - {You~can't~use~the~option~"\tl_use:N\l_keys_key_tl"~when~loading~the~ - package~witharrows.} -\ProcessKeysOptions {WithArrows/package} -\msg_new:nnn {witharrows} - {Option~incompatible~with~Beamer} - {The~option~"\tl_use:N \l_keys_key_tl"\ is~incompatible~ - with~Beamer~because~Beamer~has~its~own~system~to~extract~footnotes.} -\msg_new:nnn {witharrows} - {footnote~with~footnotehyper~package} - {You~can't~use~the~option~footnote~because~the~package~ - footnotehyper~has~already~been~loaded.~ - If~you~want,~you~can~use~the~option~"footnotehyper"~and~the~footnotes~ - within~the~environments~of~witharrows~will~be~extracted~with~the~tools~ - of~the~package~footnotehyper.} -\msg_new:nnn {witharrows} - {footnotehyper~with~footnote~package} - {You~can't~use~the~option~"footnotehyper"~because~the~package~ - footnote~has~already~been~loaded.~ - If~you~want,~you~can~use~the~option~"footnote"~and~the~footnotes~ - within~the~environments~of~withArrows~will~be~extracted~with~the~tools~ - of~the~package~footnote.} -\bool_if:NT \g__wa_footnote_bool - {\@ifclassloaded {beamer} - {\msg_fatal:nn {witharrows} - {Option~incompatible~with~Beamer}} - {} - \@ifpackageloaded{footnotehyper} - {\msg_fatal:nn {witharrows} - {footnote~with~footnotehyper~package}} - {} - \usepackage{footnote}} -\bool_if:NT \g__wa_footnotehyper_bool - {\@ifclassloaded {beamer} - {\msg_fatal:nn {witharrows} - {Option~incompatible~with~Beamer}} - {} - \@ifpackageloaded{footnote} - {\msg_fatal:nn {witharrows} - {footnotehyper~with~footnote~package}} - {} - \usepackage{footnotehyper} - \bool_gset_true:N \g__wa_footnote_bool} -\bool_new:N \c__wa_leqno_bool -\DeclareOption {leqno} {\bool_set_true:N \c__wa_leqno_bool} -\DeclareOption* {} +\RequirePackage { xparse } [ 2018-10-17 ] +\bool_new:N \g__witharrows_footnotehyper_bool +\bool_new:N \g__witharrows_footnote_bool +\cs_new_protected:Npn \__witharrows_msg_new:nn { \msg_new:nnn { witharrows } } +\cs_new_protected:Npn \__witharrows_msg_new:nnn { \msg_new:nnnn { witharrows } } +\cs_new_protected:Npn \__witharrows_msg_redirect_name:nn + { \msg_redirect_name:nnn { witharrows } } +\keys_define:nn { WithArrows / package } + { + footnote .bool_gset:N = \g__witharrows_footnote_bool , + footnotehyper .bool_gset:N = \g__witharrows_footnotehyper_bool , + unknown .code:n = + \msg_fatal:nn { witharrows } { Option~unknown~for~package } + } +\__witharrows_msg_new:nn { Option~unknown~for~package } + { + You~can't~use~the~option~'\l_keys_key_tl'~when~loading~the~ + package~witharrows.~Try~to~use~the~command~ + \token_to_str:N\WithArrowsOptions. + } +\ProcessKeysOptions { WithArrows / package } +\__witharrows_msg_new:nn { Option~incompatible~with~Beamer } + { + The~option~'\l_keys_key_tl'\ is~incompatible~ + with~Beamer~because~Beamer~has~its~own~system~to~extract~footnotes. + } +\__witharrows_msg_new:nn { footnote~with~footnotehyper~package } + { + You~can't~use~the~option~'footnote'~because~the~package~ + footnotehyper~has~already~been~loaded.~ + If~you~want,~you~can~use~the~option~'footnotehyper'~and~the~footnotes~ + within~the~environments~of~witharrows~will~be~extracted~with~the~tools~ + of~the~package~footnotehyper. + } +\__witharrows_msg_new:nn { footnotehyper~with~footnote~package } + { + You~can't~use~the~option~'footnotehyper'~because~the~package~ + footnote~has~already~been~loaded.~ + If~you~want,~you~can~use~the~option~'footnote'~and~the~footnotes~ + within~the~environments~of~witharrows~will~be~extracted~with~the~tools~ + of~the~package~footnote. + } +\bool_if:NT \g__witharrows_footnote_bool + { + \@ifclassloaded { beamer } + { \msg_fatal:nn { witharrows } { Option~incompatible~with~Beamer } } + { } + \@ifpackageloaded { footnotehyper } + { \msg_fatal:nn { witharrows } { footnote~with~footnotehyper~package } } + { } + \usepackage { footnote } + } +\bool_if:NT \g__witharrows_footnotehyper_bool + { + \@ifclassloaded { beamer } + { \msg_fatal:nn { witharrows } { Option~incompatible~with~Beamer } } + { } + \@ifpackageloaded { footnote } + { \msg_fatal:nn { witharrows } { footnotehyper~with~footnote~package } } + { } + \usepackage { footnotehyper } + \bool_gset_true:N \g__witharrows_footnote_bool + } +\bool_new:N \c__witharrows_leqno_bool +\DeclareOption { leqno } { \bool_set_true:N \c__witharrows_leqno_bool } +\DeclareOption* { } \ProcessOptions* -\cs_new_protected:Nn \__wa_error:n - {\msg_error:nn {witharrows} {#1}} -\cs_new_protected:Nn \__wa_error:nn - {\msg_error:nnn {witharrows} {#1} {#2}} -\cs_generate_variant:Nn \__wa_error:nn {nx} -\cs_new_protected:Nn \__wa_bool_new:N - {\bool_if_exist:NTF #1 - {\bool_set_false:N #1} - {\bool_new:N #1}} +\cs_new_protected:Npn \__witharrows_error:n { \msg_error:nn { witharrows } } +\cs_new_protected:Npn \__witharrows_error:nn { \msg_error:nnn { witharrows } } +\cs_generate_variant:Nn \__witharrows_error:nn { n x } +\cs_new_protected:Nn \__witharrows_bool_new:N + { + \bool_if_exist:NTF #1 + { \bool_set_false:N #1 } + { \bool_new:N #1 } + } \AtBeginDocument - {\clist_map_inline:nn - {amsmath,mathtools,autonum,cleveref,hyperref,typedref,showlabels, - amsthm,varwidth} - {\bool_new:c {c__wa_#1_loaded_bool} - \@ifpackageloaded {#1} - {\bool_set_true:c {c__wa_#1_loaded_bool}} - {}}} -\cs_generate_variant:Nn \seq_set_split:Nnn {Nxx} -\cs_new_protected:Nn \__wa_save:N - {\seq_set_split:Nxx \l_tmpa_seq {\char_generate:nn {`_} {12}} {\cs_to_str:N #1} + { + \clist_map_inline:nn + { + amsmath, amsthm, autonum, cleveref, hyperref, mathtools, showlabels, + typedref, varwidth + } + { + \bool_new:c { c__witharrows_#1_loaded_bool } + \@ifpackageloaded { #1 } + { \bool_set_true:c { c__witharrows_#1_loaded_bool } } + { } + } + } +\sys_if_engine_luatex:TF + { + \cs_new_protected:Nn \__witharrows_strcmp:nn + { \lua_now:e { l3kernel.strcmp('#1','#2') } } + } + { \cs_new_protected:Nn \__witharrows_strcmp:nn { \pdftex_strcmp:D { #1 } { #2 } } } +\cs_new_protected:Nn \__witharrows_sort_seq:N + { + \seq_sort:Nn #1 + { + \int_compare:nNnTF + { + \__witharrows_strcmp:nn + { \str_lower_case:n { ##1 } } + { \str_lower_case:n { ##2 } } + } + > 0 + \sort_return_swapped: + \sort_return_same: + } + } +\cs_generate_variant:Nn \seq_set_split:Nnn { N x x } +\cs_new_protected:Nn \__witharrows_save:N + { + \seq_set_split:Nxx \l_tmpa_seq + { \char_generate:nn { `_ } { 12 } } + { \cs_to_str:N #1 } \seq_pop_left:NN \l_tmpa_seq \l_tmpa_tl - \str_set:Nx \l_tmpa_str {\seq_item:Nn \l_tmpa_seq {-1}} - \use:c {\l_tmpa_str _if_exist:cF} - {g_\seq_use:Nnnn \l_tmpa_seq _ _ _ } - {\use:c {\l_tmpa_str _new:c} - {g_\seq_use:Nnnn \l_tmpa_seq _ _ _ } } - \use:c {\l_tmpa_str _gset_eq:cN} - {g_\seq_use:Nnnn \l_tmpa_seq _ _ _ } #1 } -\cs_new_protected:Nn \__wa_restore:N - {\seq_set_split:Nxx \l_tmpa_seq {\char_generate:nn {`_} {12}} {\cs_to_str:N #1} + \str_set:Nx \l_tmpa_str { \seq_item:Nn \l_tmpa_seq { -1 } } + \use:c { \l_tmpa_str _if_exist:cF } + { g _\seq_use:Nnnn \l_tmpa_seq _ _ _ } + { + \use:c { \l_tmpa_str _new:c } + { g _\seq_use:Nnnn \l_tmpa_seq _ _ _ } + } + \use:c { \l_tmpa_str _gset_eq:cN } + { g _\seq_use:Nnnn \l_tmpa_seq _ _ _ } #1 + } +\cs_new_protected:Nn \__witharrows_restore:N + { + \seq_set_split:Nxx \l_tmpa_seq + { \char_generate:nn { `_ } { 12 } } + { \cs_to_str:N #1 } \seq_pop_left:NN \l_tmpa_seq \l_tmpa_tl - \str_set:Nx \l_tmpa_str {\seq_item:Nn \l_tmpa_seq {-1}} - \use:c {\l_tmpa_str _set_eq:Nc} - #1 {g_\seq_use:Nnnn \l_tmpa_seq _ _ _ } } -\tikzset{__wa_node_style/.style= { - above = \l__wa_ystart_dim, - inner~sep = 0 pt, - minimum~width = 0pt, - minimum~height = \l__wa_ygap_dim}} -\tikzset{__wa_standard/.style= { remember~picture, - overlay, - name~prefix = wa-\l__wa_prefix_str-}} -\tikzset{WithArrows/arrow/tips/.style = { > = {Straight~Barb[scale=1.2,bend]} }} -\tikzset{WithArrows/arrow/.style = { align = left, - auto = left, - font = \small\itshape, - WithArrows/arrow/tips, - bend~left = 45, - -> }} + \str_set:Nx \l_tmpa_str { \seq_item:Nn \l_tmpa_seq { -1 } } + \use:c { \l_tmpa_str _set_eq:Nc } + #1 { g_\seq_use:Nnnn \l_tmpa_seq _ _ _ } + } +\tikzset + { + __witharrows_node_style / .style = + { + above = \l__witharrows_ystart_dim , + inner~sep = \c_zero_dim , + minimum~width = \c_zero_dim , + minimum~height = \l__witharrows_ygap_dim + } + } +\tikzset + { + __witharrows_standard / .style = + { + remember~picture , + overlay , + name~prefix = wa - \l__witharrows_prefix_str - + } + } +\tikzset + { + WithArrows / arrow / tips / .style = + { > = { Straight~Barb [ scale = 1.2 , bend ] } } + } +\tikzset + { WithArrows / arrow / .style = + { align = left , + auto = left , + font = \small \itshape , + WithArrows / arrow / tips , + bend~left = 45 , + -> + } + } \AtBeginDocument - {\bool_if:NF \c__wa_amsmath_loaded_bool - {\cs_set_protected:Npn \spread@equation - {\openup\jot - \cs_set_eq:NN \spread@equation \prg_do_nothing:}}} -\bool_new:N \l__wa_in_WithArrows_bool -\bool_new:N \l__wa_in_DispWithArrows_bool -\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 -\skip_new:N \l__wa_interline_skip -\int_new:N \l__wa_pos_env_int -\dim_new:N \l__wa_xoffset_dim -\dim_set:Nn \l__wa_xoffset_dim {3mm} -\int_new:N \l__wa_pos_arrow_int -\int_set:Nn \l__wa_pos_arrow_int 3 -\int_new:N \l__wa_previous_pos_arrow_int -\dim_new:N \l__wa_x_dim -\seq_new:N \g__wa_arrow_int_seq -\int_new:N \g__wa_arrow_int -\seq_new:N \g__wa_line_int_seq -\int_new:N \g__wa_line_int -\tl_new:N \l__wa_name_tl -\bool_new:N \l__wa_fleqn_bool -\dim_new:N \l__wa_mathindent_dim -\dim_set:Nn \l__wa_mathindent_dim {25pt} -\bool_new:N \l__wa_wrap_lines_bool -\clist_new:N \l__wa_tags_clist -\clist_set:Nn \l__wa_tags_clist {all} -\tl_new:N \l__wa_tag_tl -\bool_new:N \l__wa_tag_star_bool -\bool_new:N \l__wa_in_first_column_bool -\bool_new:N \l__wa_initial_r_bool -\bool_new:N \l__wa_initial_l_bool -\dim_new:N \l__wa_start_adjust_dim -\dim_set:Nn \l__wa_start_adjust_dim {0.4ex} -\dim_new:N \l__wa_end_adjust_dim -\dim_set:Nn \l__wa_end_adjust_dim {0.4ex} -\str_new:N \l__wa_CommandName_str -\str_set:Nn \l__wa_CommandName_str {Arrow} -\str_new:N \l__wa_string_Arrow_for_messages_str -\str_set:Nx \l__wa_string_Arrow_for_messages_str {\token_to_str:N \Arrow} -\int_set:Nn \l__wa_level_int 1 -\keys_define:nn {WithArrows/GlobalOrEnv} - { t .code:n = {\bool_if:NTF \l__wa_in_DispWithArrows_bool - {\__wa_error:n {Option~will~be~ignored} - {\int_set:Nn \l__wa_pos_env_int 0}}}, - t .value_forbidden:n = true, - c .code:n = {\bool_if:NTF \l__wa_in_DispWithArrows_bool - {\__wa_error:n {Option~will~be~ignored}} - {\int_set:Nn \l__wa_pos_env_int 1}}, - c .value_forbidden:n = true, - b .code:n = {\bool_if:NTF \l__wa_in_DispWithArrows_bool - {\__wa_error:n {Option~will~be~ignored}} - {\int_set:Nn \l__wa_pos_env_int 2}}, - b .value_forbidden:n = true, - ygap .dim_set:N = \l__wa_ygap_dim, - ygap .value_required:n = true, - ygap .initial:n = 0.4 ex, - ystart .dim_set:N = \l__wa_ystart_dim, - ystart .value_required:n = true, - ystart .initial:n = 0.4 ex, - MoreColumns .code:n = { \bool_if:NTF \l__wa_in_DispWithArrows_bool - {\__wa_error:n {Option~will~be~ignored}} - { \msg_redirect_name:nnn - {witharrows} - {Third~column~in~WithArrows} - {none} }}, - MoreColumns .value_forbidden:n = true, - AllowLineWithoutAmpersand .code:n = { \__wa_error:n - {AllowLineWithoutAmpersand}}, - AllowLineWithoutAmpersand .value_forbidden:n = true, - CommandName .code:n = - {\str_set:Nn \l__wa_CommandName_str {#1} - \str_set:Nx \l__wa_string_Arrow_for_messages_str - {\c_backslash_str Arrow~(renamed~here~in~\c_backslash_str #1)}}, - CommandName .value_required:n = true, - TikzCode .tl_set:N = \l__wa_tikz_code_tl, - TikzCode .initial:n = \draw~(#1)~to~node{#3}~(#2)~; , - TikzCode .value_required:n = true, - displaystyle .bool_set:N = \l__wa_displaystyle_bool, - displaystyle .initial:n = false, - shownodes .code:n = {\tikzset{__wa_node_style/.append~style = {draw,red}}}, - shownodes .value_forbidden:n = true, - shownodenames .bool_set:N = \l__wa_shownodenames_bool, - shownodenames .initial:n = false, - group .code:n = {\int_compare:nNnT \l__wa_previous_pos_arrow_int > {-1} - {\__wa_error:n {Incompatible~options}} - \int_set:Nn \l__wa_previous_pos_arrow_int 7 - \int_set:Nn \l__wa_pos_arrow_int 7} , - group .value_forbidden:n = true, - groups .code:n = {\int_compare:nNnT \l__wa_previous_pos_arrow_int > {-1} - {\__wa_error:n {Incompatible~options}} - \int_set:Nn \l__wa_previous_pos_arrow_int 6 - \int_set:Nn \l__wa_pos_arrow_int 6} , - groups .value_forbidden:n = true, - CodeBefore .code:n = {\int_compare:nNnTF \l__wa_level_int = 1 - {\__wa_error:n {Option~will~be~ignored}} - {\tl_put_right:Nn \l__wa_code_before_tl {#1}}} , - CodeBefore .value_required:n = true, - CodeAfter .code:n = {\int_compare:nNnTF \l__wa_level_int = 1 - {\__wa_error:n {Option~will~be~ignored}} - {\tl_put_right:Nn \l__wa_code_after_tl {#1}}} , - CodeAfter .value_required:n = true, - name .code:n = {\int_compare:nNnTF \l__wa_level_int = 1 - {\__wa_error:n {Option~will~be~ignored}} - {\tl_set:Nn \l__wa_name_tl {#1}}} , - name .value_required:n = true, - fleqn .code:n = {\bool_if:NTF \l__wa_in_WithArrows_bool - {\__wa_error:n {Option~will~be~ignored}} - {\str_if_eq:nnTF {#1} {true} - {\bool_set_true:N \l__wa_fleqn_bool} - {\bool_set_false:N \l__wa_fleqn_bool}}}, - fleqn .default:n = true, - mathindent .code:n = {\bool_if:NTF \l__wa_in_WithArrows_bool - {\__wa_error:n {Option~will~be~ignored}} - {\dim_set:Nn \l__wa_mathindent_dim {#1}}}, - mathindent .value_required:n = true, - notag .code:n = {\bool_if:NTF \l__wa_in_WithArrows_bool - {\__wa_error:n {Option~will~be~ignored}} - {\str_if_eq:nnTF {#1} {true} - {\clist_clear:N \l__wa_tags_clist} - {\clist_set:Nn \l__wa_tags_clist {all}}}}, - notag .default:n = true, - nonumber .meta:n = notag, - AllowMultipleLabels .code:n = {\bool_if:NTF \l__wa_in_WithArrows_bool - {\__wa_error:n {Option~will~be~ignored}} - {\msg_redirect_name:nnn {witharrows} - {Multiple~labels} - {none}}}, - AllowMultipleLabels .value_forbidden:n = true, - wrap-lines .code:n = {\bool_if:NTF \l__wa_in_WithArrows_bool - {\__wa_error:n {Option~will~be~ignored}} - {\str_if_eq:nnTF {#1} {true} - {\bool_set_true:N \l__wa_wrap_lines_bool} - {\bool_set_false:N \l__wa_wrap_lines_bool}}}, - wrap-lines .default:n = true, - tagged-lines .code:n = {\bool_if:NTF \l__wa_in_WithArrows_bool - {\__wa_error:n {Option~will~be~ignored}} - {\clist_set:Nn \l__wa_tags_clist {#1} - \clist_if_in:NnT \l__wa_tags_clist {first} - {\clist_remove_all:Nn \l__wa_tags_clist {first} - \clist_put_left:Nn \l__wa_tags_clist 1 }}}, - tagged-lines .value_required:n = true, - unknown .code:n = \__wa_error:n {Unknown~option} - } -\keys_define:nn {WithArrows/General} - {tikz .code:n = \tikzset {WithArrows/arrow/.append~style = {#1}}, - tikz .initial:n = {}, - tikz .value_required:n = true, - rr .value_forbidden:n = true, - rr .code:n = \__wa_analyze_option_position:n 3 , - ll .value_forbidden:n = true, - ll .code:n = \__wa_analyze_option_position:n 1 , - rl .value_forbidden:n = true, - rl .code:n = \__wa_analyze_option_position:n 2 , - lr .value_forbidden:n = true, - lr .code:n = \__wa_analyze_option_position:n 0 , - i .value_forbidden:n = true, - i .code:n = \__wa_analyze_option_position:n 5 , - xoffset .code:n = {\bool_if:nTF {\int_compare_p:nNn \l__wa_level_int = 3 && - \int_compare_p:nNn \l__wa_pos_arrow_int > 5} - {\__wa_error:n {Option~incompatible~with~group}} - {\dim_set:Nn \l__wa_xoffset_dim {#1}}} , - xoffset .value_required:n = true, - jot .code:n = {\int_compare:nNnTF \l__wa_level_int = 2 - {\dim_set:Nn \jot {#1}} - {\__wa_error:n {Option~will~be~ignored}}} , - jot .value_required:n = true, - interline .code:n = {\int_compare:nNnTF \l__wa_level_int = 2 - {\skip_set:Nn \l__wa_interline_skip {#1}} - {\__wa_error:n {Option~will~be~ignored}}} , - interline .value_required:n = true, - start-adjust .dim_set:N = \l__wa_start_adjust_dim, - start-adjust .value_required:n = true, - end-adjust .dim_set:N = \l__wa_end_adjust_dim, - end-adjust .value_required:n = true, - adjust .code:n = {\dim_set:Nn \l__wa_start_adjust_dim {#1} - \dim_set:Nn \l__wa_end_adjust_dim {#1} }, - adjust .value_required:n = true, - unknown .code:n = \__wa_error:n {Unknown~option} -} -\keys_define:nn {WithArrows/Arrow} - {jump .code:n = {\int_set:Nn \l__wa_jump_int {#1} - \int_compare:nNnF \l__wa_jump_int > 0 - {\__wa_error:n {Negative~value~for~jump}}} , - jump .value_required:n = true, - rr .value_forbidden:n = true, - rr .code:n = \__wa_analyze_option_position:n 3 , - ll .value_forbidden:n = true, - ll .code:n = \__wa_analyze_option_position:n 1 , - rl .value_forbidden:n = true, - rl .code:n = \__wa_analyze_option_position:n 2 , - lr .value_forbidden:n = true, - lr .code:n = \__wa_analyze_option_position:n 0 , - i .value_forbidden:n = true, - i .code:n = \__wa_analyze_option_position:n 5 } -\cs_new_protected:Nn \__wa_analyze_option_position:n - {\int_compare:nNnT \l__wa_previous_pos_arrow_int > {-1} - {\__wa_error:n {Incompatible~options}} - \int_set:Nn \l__wa_previous_pos_arrow_int {#1} - \int_set:Nn \l__wa_pos_arrow_int {#1}} -\NewDocumentCommand \WithArrowsOptions {m} - {\int_set:Nn \l__wa_previous_pos_arrow_int {-1} - \keys_set_known:nnN {WithArrows/General} {#1} \l_tmpa_tl - \keys_set:nV {WithArrows/GlobalOrEnv} \l_tmpa_tl} -\NewDocumentCommand \__wa_Arrow {O{} m !O{}} - { - \int_gincr:N \g__wa_arrow_int - \int_set:Nn \l__wa_previous_pos_arrow_int {-1} - \int_set:Nn \l__wa_pos_arrow_int {-1} - \int_set:Nn \l__wa_level_int 3 - \keys_set_known:nnN {WithArrows/Arrow} {#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:NnV \l_tmpa_prop {position} \l__wa_pos_arrow_int - \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_str _\int_use:N\g__wa_arrow_int _prop} - \prop_gset_eq:cN - {g__wa_arrow_\l__wa_prefix_str _\int_use:N\g__wa_arrow_int _prop} - \l_tmpa_prop - } -\cs_new_protected:Nn \__wa_Arrow_first_column: - {\__wa_error:n {Arrow~in~first~column} - \__wa_Arrow} -\cs_new_protected:Nn \__wa_pre_environment:n - { \tl_clear_new:N \l__wa_type_env_tl - \tl_set:NV \l__wa_type_env_tl \@currenvir - \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_line_int_seq \g__wa_line_int - \int_gzero:N \g__wa_line_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 - \seq_pop_right:NN \l_tmpa_seq \l_tmpa_tl - \str_clear_new:N \l__wa_prefix_str - \str_set:Nx \l__wa_prefix_str {\seq_use:Nnnn \l_tmpa_seq {-} {-} {-}} - \cs_set_eq:NN \\ \__wa_cr: - \dim_zero:N \mathsurround - \int_zero_new:N \l__wa_initial_int - \int_zero_new:N \l__wa_final_int - \int_zero_new:N \l__wa_arrow_int - \int_zero_new:N \l__wa_pos_of_arrow_int - \int_zero_new:N \l__wa_jump_int - \int_set:Nn \l__wa_jump_int 1 - \seq_clear_new:N \l__wa_labels_seq - \__wa_bool_new:N \l__wa_tag_next_line_bool - \skip_zero:N \l__wa_interline_skip - \tl_clear_new:N \l__wa_code_before_tl - \tl_clear_new:N \l__wa_code_after_tl - \int_set:Nn \l__wa_previous_pos_arrow_int {-1} - \int_set:Nn \l__wa_level_int 2 - \keys_set_known:nnN {WithArrows/General} {#1} \l_tmpa_tl - \keys_set:nV {WithArrows/GlobalOrEnv} \l_tmpa_tl - \bool_if:NT \g__wa_footnote_bool \savenotes - \l__wa_code_before_tl - \cs_set_eq:cN \l__wa_CommandName_str \__wa_Arrow} -\NewDocumentEnvironment {WithArrows} {!O{}} - { \bool_set_true:N \l__wa_in_WithArrows_bool - \bool_set_false:N \l__wa_in_DispWithArrows_bool - \__wa_pre_environment:n {#1} - \reverse_if:N \if_mode_math: - \__wa_error:n {WithArrows~outside~math~mode} - \fi: - \cs_set_eq:NN \notag \__wa_notag: - \cs_set_eq:NN \nonumber \__wa_notag: - \cs_set_eq:NN \tag \__wa_tag - \cs_set_eq:NN \label \__wa_label:n - \cs_set_eq:NN \tagnextline \__wa_tagnextline: - \int_case:nn \l__wa_pos_env_int - {0 \vtop - 1 \vcenter - 2 \vbox} - \bgroup - \spread@equation - \ialign\bgroup - \int_gincr:N \g__wa_line_int - \cs_set_eq:cN \l__wa_CommandName_str \__wa_Arrow_first_column: - \bool_set_true:N \l__wa_in_first_column_bool - \strut\hfil - $\bool_if:NT \l__wa_displaystyle_bool \displaystyle {##}$ - & - $\bool_if:NT \l__wa_displaystyle_bool \displaystyle {{}##}$ - \tikz [remember~picture,overlay] - \node [__wa_node_style, - name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-l, - alias = {\tl_if_empty:NF \l__wa_name_tl - {\l__wa_name_tl-\int_use:N\g__wa_line_int-l}} ] {} ; - \hfil - \tikz [remember~picture,overlay] - \node [__wa_node_style, - name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-r, - alias = {\tl_if_empty:NF \l__wa_name_tl - {\l__wa_name_tl-\int_use:N\g__wa_line_int-r}} ] {} ; - \bool_if:NT \l__wa_shownodenames_bool - {\hbox_overlap_right:n {\small wa-\l__wa_prefix_str - -\int_use:N\g__wa_line_int}} - && \__wa_error:n {Third~column~in~WithArrows} - $\bool_if:NT \l__wa_displaystyle_bool \displaystyle {##}$ - \cr + { + \bool_if:NF \c__witharrows_amsmath_loaded_bool + { + \cs_set_protected:Npn \spread@equation + { + \openup \jot + \cs_set_eq:NN \spread@equation \prg_do_nothing: } - {\\ - \egroup - \egroup - \__wa_post_environment: - \bool_if:NT \g__wa_footnote_bool \endsavenotes -} -\cs_new_protected:Nn \__wa_post_environment: - {\cs_set:Npn \WithArrowsRightX {\g__wa_right_x_dim} - \int_compare:nNnT \g__wa_arrow_int > 0 \__wa_scan_arrows: - \group_begin: - \tikzset{every~picture/.style = __wa_standard} - \cs_set:Npn \WithArrowsNbLines {\int_use:N \g__wa_line_int} - \cs_set_eq:NN \MultiArrow \__wa_MultiArrow:nn - \cs_set_eq:cN \l__wa_CommandName_str \__wa_Arrow_code_after - \l__wa_code_after_tl - \group_end: - \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_arrow_int_seq {\l_tmpa_tl} - \int_gset:Nn \g__wa_arrow_int {\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} - } -\cs_new_protected:Nn \__wa_cr: - {\scan_stop: - \bool_if:NT \l__wa_in_first_column_bool { & {} } - \group_align_safe_begin: - \peek_meaning_remove:NTF * \__wa_cr_i: \__wa_cr_i:} -\cs_new_protected:Nn \__wa_cr_i: - {\peek_meaning:NTF [ {\__wa_cr_ii:} {\__wa_cr_ii:[\c_zero_dim]} } -\cs_new_protected:Npn \__wa_cr_ii:[#1] - {\group_align_safe_end: - \bool_if:NT \l__wa_in_DispWithArrows_bool - {\clist_if_in:NnTF \l__wa_tags_clist {all} - { - \tl_if_empty:NT \l__wa_tag_tl - {\int_gincr:N \c@equation} - \cs_gset:Npx \g_tmpa_tl - {\tl_if_empty:NTF \l__wa_tag_tl - \theequation - \l__wa_tag_tl} - \seq_if_empty:NF \l__wa_labels_seq - { - \cs_set:Npx \@currentlabel {\p@equation \g_tmpa_tl} - \bool_if:NT \c__wa_hyperref_loaded_bool - {\cs_set:Npn \This@name {equation} - \hyper@refstepcounter{equation}} - \bool_if:NT \c__wa_cleveref_loaded_bool - {\cref@constructprefix{equation}{\cref@result} - \@ifundefined{cref@equation@alias} - {\def\@tempa{equation}} - {\def\@tempa{\csname cref@equation@alias\endcsname}} - \protected@edef\cref@currentlabel - {[\@tempa][\arabic{equation}][\cref@result] - \p@equation \g_tmpa_tl}} - \bool_if:NT \c__wa_typedref_loaded_bool - {\cs_set:Npn \sr@name {equation}} - \seq_map_function:NN \l__wa_labels_seq \__wa_old_label} - \__wa_save:N \l__wa_tag_star_bool - \__wa_save:N \l__wa_qedhere_bool - \bool_if:NT \l__wa_tag_next_line_bool - { \openup -\jot - \bool_set_false:N \l__wa_tag_next_line_bool - \notag \\ & } - & \__wa_restore:N \l__wa_tag_star_bool - \__wa_restore:N \l__wa_qedhere_bool - \bool_if:NT \l__wa_qedhere_bool - {\hbox_overlap_left:n \__wa_qedhere_i:} - \cs_set_eq:NN \theequation \g_tmpa_tl - \bool_if:NT \l__wa_tag_star_bool {\cs_set:Npn \tagform@ {}} - \hbox_overlap_left:n - {\bool_if:NF \c__wa_leqno_bool - {\tikz [__wa_standard] \coordinate (\int_use:N\g__wa_line_int-v) ;} - \quad - \@eqnnum } - \bool_if:NT \c__wa_leqno_bool - {\tikz [__wa_standard] \coordinate (\int_use:N \g__wa_line_int-v) ;}} - {\__wa_save:N \l__wa_qedhere_bool - & \__wa_restore:N \l__wa_qedhere_bool - \bool_if:NT \l__wa_qedhere_bool - {\hbox_overlap_left:n \__wa_qedhere_i:} - \tikz [__wa_standard] \coordinate (\int_use:N\g__wa_line_int-v) ; } - } - \cr\noalign{\skip_vertical:n {#1 + \l__wa_interline_skip} - \scan_stop:}} -\cs_new_protected:Nn \__wa_if_in_second_col_of_disp:nn - {\bool_if:NTF \l__wa_in_WithArrows_bool - {\__wa_error:nn {Command~not~allowed~in~WithArrows} - {#1}} - {\bool_if:NTF \l__wa_in_first_column_bool - {\__wa_error:nn {Command~not~allowed~in~DispWithArrows} - {#1}} - {#2}}} -\cs_new_protected:Nn \__wa_notag: - {\__wa_if_in_second_col_of_disp:nn {\notag} - {\clist_clear:N \l__wa_tags_clist}} -\NewDocumentCommand \__wa_tag {sm} - {\__wa_if_in_second_col_of_disp:nn {\tag} - {\tl_if_empty:NF \l__wa_tag_tl - {\__wa_error:nn {Multiple~tags} {#2}} - \clist_set:Nn \l__wa_tags_clist {all} - \bool_if:nT \c__wa_mathtools_loaded_bool - {\MH_if_boolean:nT {show_only_refs} - {\MH_if_boolean:nF {show_manual_tags} - {\clist_clear:N \l__wa_tags_clist}}} - \tl_set:Nn \l__wa_tag_tl {#2} - \bool_set:Nn \l__wa_tag_star_bool {#1} - \bool_if:nT {#1 && ! \bool_if_p:N \c__wa_amsmath_loaded_bool} - { \__wa_error:n {tag*~without~amsmath} }} - } -\cs_new_protected:Nn \__wa_label:n - {\__wa_if_in_second_col_of_disp:nn {\label} - {\seq_if_empty:NF \l__wa_labels_seq - {\bool_if:NTF \c__wa_cleveref_loaded_bool - {\__wa_error:n {Multiple~labels~with~cleveref}} - {\__wa_error:n {Multiple~labels}}} - \seq_put_right:Nn \l__wa_labels_seq {#1} - \bool_if:nT \c__wa_mathtools_loaded_bool - {\MH_if_boolean:nT {show_only_refs} - {\cs_if_exist:cTF {MT_r_#1} - {\clist_set:Nn \l__wa_tags_clist {all}} - {\clist_clear:N \l__wa_tags_clist}}} - \bool_if:nT \c__wa_autonum_loaded_bool - {\cs_if_exist:cTF {autonum@#1Referenced} - {\clist_set:Nn \l__wa_tags_clist {all}} - {\clist_clear:N \l__wa_tags_clist}}}} -\cs_new_protected:Nn \__wa_tagnextline: - {\__wa_if_in_second_col_of_disp:nn {\tagnextline} - {\bool_set_true:N \l__wa_tag_next_line_bool}} -\bool_new:N \l__wa_qedhere_bool -\cs_new_protected:Nn \__wa_qedhere: {\bool_set_true:N \l__wa_qedhere_bool} -\cs_new_protected:Nn \__wa_qedhere_i: {\group_begin: - \cs_set_eq:NN \qed \qedsymbol - \cs_set_eq:NN \qed@elt \setQED@elt - \QED@stack\relax\relax - \group_end: } -\NewDocumentEnvironment {DispWithArrows} {!O{}} - { - \bool_if:nT \c__wa_mathtools_loaded_bool - {\MH_if_boolean:nT {show_only_refs} - {\MT_showonlyrefs_false: - \MH_set_boolean_T:n {show_only_refs}}} - \bool_if:NT \c__wa_amsmath_loaded_bool \intertext@ - \bool_set_true:N \l__wa_in_DispWithArrows_bool - \__wa_pre_environment:n {#1} - \if_mode_math: - \__wa_error:n {DispWithArrows~in~math~mode} - \fi: - \if_mode_vertical: - \nointerlineskip - \makebox[.6\linewidth]{} - \fi: - $$ - \vcenter \bgroup - \spread@equation - \bool_if:NTF \l__wa_fleqn_bool - {\tabskip = \c_zero_skip} - {\tabskip = 0 pt plus 1000 pt minus 1000 pt} - \cs_set_eq:NN \__wa_old_label \label - \cs_set_eq:NN \notag \__wa_notag: - \cs_set_eq:NN \nonumber \__wa_notag: - \cs_set_eq:NN \tag \__wa_tag - \cs_set_eq:NN \label \__wa_label:n - \cs_set_eq:NN \tagnextline \__wa_tagnextline: - \halign to \displaywidth \bgroup - \int_gincr:N \g__wa_line_int - \cs_set_eq:cN \l__wa_CommandName_str \__wa_Arrow_first_column: - \bool_set_true:N \l__wa_in_first_column_bool - \strut - \bool_if:NT \l__wa_fleqn_bool - {\skip_horizontal:n \l__wa_mathindent_dim} - \hfil - $\bool_if:NT \l__wa_displaystyle_bool \displaystyle {##}$ - \tabskip = \c_zero_skip - & - \clist_if_in:NVT \l__wa_tags_clist \g__wa_line_int - {\clist_set:Nn \l__wa_tags_clist {all}} - \bool_if:NT \c__wa_amsthm_loaded_bool {\cs_set_eq:NN \qedhere \__wa_qedhere:} - $\bool_if:NT \l__wa_displaystyle_bool \displaystyle {{}##}$ - \tabskip = 0 pt plus 1000 pt minus 1000 pt - \tikz [remember~picture,overlay] - \node [__wa_node_style, - name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-l, - alias = {\tl_if_empty:NF \l__wa_name_tl - {\l__wa_name_tl-\int_use:N\g__wa_line_int-l}} ] {} ; - \hfil - \tikz [remember~picture,overlay] - \node [__wa_node_style, - name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-r, - alias = {\tl_if_empty:NF \l__wa_name_tl - {\l__wa_name_tl-\int_use:N\g__wa_line_int-r}} ] {} ; - \bool_if:NT \l__wa_shownodenames_bool - {\hbox_overlap_right:n {\small wa-\l__wa_prefix_str - -\int_use:N\g__wa_line_int}} - & ## - \tabskip = \c_zero_skip - && \__wa_error:n {Third~column~in~DispWithArrows} - \iffalse ## \fi - \cr} - {\clist_if_in:NnT \l__wa_tags_clist {last} - {\clist_set:Nn \l__wa_tags_clist {all}} - \\ - \egroup - \egroup - \bool_if:NT \l__wa_in_DispWithArrows_bool - {\dim_gzero_new:N \g__wa_right_x_dim - \dim_gset_eq:NN \g__wa_right_x_dim \c_max_dim - \begin{tikzpicture} [__wa_standard] - \int_step_variable:nNn \g__wa_line_int \l_tmpa_int - {\cs_if_free:cTF {pgf@sh@ns@wa-\l__wa_prefix_str-\l_tmpa_int-v} - {\__wa_error:n {Inexistent~v-node}} - {\tikz@parse@node\pgfutil@firstofone (\l_tmpa_int-v) - \dim_set:Nn \l_tmpa_dim \pgf@x - \dim_compare:nNnT \l_tmpa_dim < \g__wa_right_x_dim - {\dim_gset:Nn \g__wa_right_x_dim \l_tmpa_dim}} } - \end{tikzpicture}} - \__wa_post_environment: - \bool_if:nT \c__wa_mathtools_loaded_bool - {\MH_if_boolean:nT {show_only_refs} - \MT_showonlyrefs_true:} - $$ - \bool_if:NT \g__wa_footnote_bool \endsavenotes - \ignorespacesafterend - } -\NewDocumentEnvironment {DispWithArrows*} {} - {\WithArrowsOptions{notag} - \DispWithArrows} - {\endDispWithArrows} -\cs_new_protected:Nn \__wa_scan_arrows: - { \group_begin: - \int_compare:nNnT \l__wa_pos_arrow_int = 7 - { \__wa_scan_arrows_i: - \int_set:Nn \l__wa_pos_arrow_int 8 } - \__wa_scan_arrows_i: - \group_end:} -\cs_new_protected:Nn \__wa_scan_arrows_i: - { - \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 - \seq_clear_new:N \l__wa_first_arrows_of_group_seq - \seq_clear_new:N \l__wa_last_arrows_of_group_seq - \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 + } + } +\bool_new:N \l__witharrows_in_WithArrows_bool +\bool_new:N \l__witharrows_in_DispWithArrows_bool +\bool_new:N \l__witharrows_in_CodeAfter_bool +\seq_new:N \g__witharrows_position_in_the_tree_seq +\seq_gput_right:Nn \g__witharrows_position_in_the_tree_seq 1 +\int_new:N \g__witharrows_last_env_int +\skip_new:N \l__witharrows_interline_skip +\int_new:N \l__witharrows_pos_env_int +\dim_new:N \l__witharrows_xoffset_dim +\dim_set:Nn \l__witharrows_xoffset_dim { 3 mm } +\int_new:N \l__witharrows_pos_arrow_int +\int_set:Nn \l__witharrows_pos_arrow_int 3 +\str_new:N \l__witharrows_input_line_str +\dim_new:N \l__witharrows_x_dim +\seq_new:N \g__witharrows_arrow_int_seq +\int_new:N \g__witharrows_arrow_int +\seq_new:N \g__witharrows_line_int_seq +\int_new:N \g__witharrows_line_int +\bool_new:N \l__witharrows_fleqn_bool +\dim_new:N \l__witharrows_mathindent_dim +\dim_set:Nn \l__witharrows_mathindent_dim { 25 pt } +\bool_new:N \l__witharrows_wrap_lines_bool +\clist_new:N \l__witharrows_tags_clist +\clist_set:Nn \l__witharrows_tags_clist { all } +\tl_new:N \l__witharrows_tag_tl +\bool_new:N \l__witharrows_tag_star_bool +\bool_new:N \l__witharrows_in_first_column_bool +\bool_new:N \l__witharrows_initial_r_bool +\bool_new:N \l__witharrows_initial_l_bool +\dim_new:N \l__witharrows_start_adjust_dim +\dim_set:Nn \l__witharrows_start_adjust_dim { 0.4 ex } +\dim_new:N \l__witharrows_end_adjust_dim +\dim_set:Nn \l__witharrows_end_adjust_dim { 0.4 ex } +\str_new:N \l__witharrows_status_arrow_str +\str_set:Nn \l__witharrows_CommandName_str { Arrow } +\str_set:Nx \l__witharrows_string_Arrow_for_msg_str { \token_to_str:N \Arrow } +\bool_new:N \l__witharrows_displaystyle_bool +\bool_new:N \l__witharrows_show_node_names_bool +\cs_new_protected:Nn \__witharrows_eval_if_allowed:n + { + \str_if_empty:NTF \l__witharrows_previous_key_str + { + \str_set_eq:NN \l__witharrows_previous_key_str \l_keys_key_tl + #1 + } + { \__witharrows_error:n { Incompatible~options } } + } +\cs_new_protected:Nn \__witharrows_fix_pos_option:n + { \__witharrows_eval_if_allowed:n { \int_set:Nn \l__witharrows_pos_arrow_int { #1 } } } +\keys_define:nn { WithArrows / Global } + { + ygap .dim_set:N = \l__witharrows_ygap_dim , + ygap .value_required:n = true , + ygap .initial:n = 0.4 ex , + ystart .dim_set:N = \l__witharrows_ystart_dim , + ystart .value_required:n = true , + ystart .initial:n = 0.4 ex , + more-columns .code:n = + \__witharrows_msg_redirect_name:nn { Third~column~in~WithArrows } { none } , + more-columns .value_forbidden:n = true, + CommandName .code:n = + \str_set:Nn \l__witharrows_CommandName_str { #1 } + \str_set:Nx \l__witharrows_string_Arrow_for_msg_str + { \c_backslash_str Arrow~alias~\c_backslash_str #1 } , + CommandName .value_required:n = true , + TikzCode .tl_set:N = \l__witharrows_tikz_code_tl, + TikzCode .initial:n = \draw~(#1)~to~node{#3}~(#2)~; , + TikzCode .value_required:n = true , + displaystyle .bool_set:N = \l__witharrows_displaystyle_bool , + displaystyle .default:n = true , + show-nodes .code:n = + \tikzset { __witharrows_node_style / .append~style = { draw , red } } , + show-nodes .value_forbidden:n = true, + show-node-names .bool_set:N = \l__witharrows_show_node_names_bool , + show-node-names .default:n = true , + group .code:n = + \str_if_empty:NTF \l__witharrows_previous_key_str + { + \str_set:Nn \l__witharrows_previous_key_str { group } + \seq_remove_all:Nn \l__witharrows_options_Arrow_seq { xoffset } + \int_set:Nn \l__witharrows_pos_arrow_int 7 + } + { \__witharrows_error:n { Incompatible~options } } , + group .value_forbidden:n = true , + groups .code:n = + \str_if_empty:NTF \l__witharrows_previous_key_str + { + \str_set:Nn \l__witharrows_previous_key_str { groups } + \seq_if_in:NnF \l__witharrows_options_Arrow_seq { new-group } + { \seq_put_right:Nn \l__witharrows_options_Arrow_seq { new-group } } + \seq_remove_all:Nn \l__witharrows_options_Arrow_seq { xoffset } + \int_set:Nn \l__witharrows_pos_arrow_int 6 + } + { \__witharrows_error:n { Incompatible~options } } , + groups .value_forbidden:n = true , + tikz .code:n = \tikzset { WithArrows / arrow / .append~style = { #1 } } , + tikz .initial:n = \c_empty_tl , + tikz .value_required:n = true , + rr .value_forbidden:n = true , + rr .code:n = \__witharrows_fix_pos_option:n 3 , + ll .value_forbidden:n = true , + ll .code:n = \__witharrows_fix_pos_option:n 1 , + rl .value_forbidden:n = true , + rl .code:n = \__witharrows_fix_pos_option:n 2 , + lr .value_forbidden:n = true , + lr .code:n = \__witharrows_fix_pos_option:n 0 , + i .value_forbidden:n = true , + i .code:n = \__witharrows_fix_pos_option:n 5 , + xoffset .dim_set:N = \l__witharrows_xoffset_dim , + xoffset .value_required:n = true , + jot .dim_set:N = \jot , + jot .value_required:n = true , + interline .skip_set:N = \l__witharrows_interline_skip , + interline .value_required:n = true , + start-adjust .dim_set:N = \l__witharrows_start_adjust_dim , + start-adjust .value_required:n = true , + end-adjust .dim_set:N = \l__witharrows_end_adjust_dim , + end-adjust .value_required:n = true , + adjust .code:n = + \dim_set:Nn \l__witharrows_start_adjust_dim { #1 } + \dim_set:Nn \l__witharrows_end_adjust_dim { #1 } , + adjust .value_required:n = true + } +\keys_define:nn { WithArrows / WithArrowsSpecific } + { + t .code:n = \int_set:Nn \l__witharrows_pos_env_int 0 , + t .value_forbidden:n = true , + c .code:n = \int_set:Nn \l__witharrows_pos_env_int 1 , + c .value_forbidden:n = true , + b .code:n = \int_set:Nn \l__witharrows_pos_env_int 2 , + b .value_forbidden:n = true + } +\keys_define:nn { WithArrows / DispWithArrowsSpecific } + { + fleqn .bool_set:N = \l__witharrows_fleqn_bool , + fleqn .default:n = true , + mathindent .dim_set:N = \l__witharrows_mathindent_dim , + mathindent .value_required:n = true , + notag .code:n = + \str_if_eq:nnTF { #1 } { true } + { \clist_clear:N \l__witharrows_tags_clist } + { \clist_set:Nn \l__witharrows_tags_clist { all } } , + notag .default:n = true , + nonumber .meta:n = notag , + allow-multiple-labels .code:n = + \__witharrows_msg_redirect_name:nn { Multiple~labels } { none } , + allow-multiple-labels .value_forbidden:n = true , + wrap-lines .bool_set:N = \l__witharrows_wrap_lines_bool , + wrap-lines .default:n = true , + tagged-lines .code:n = + \clist_set:Nn \l__witharrows_tags_clist { #1 } + \clist_if_in:NnT \l__witharrows_tags_clist { first } + { + \clist_remove_all:Nn \l__witharrows_tags_clist { first } + \clist_put_left:Nn \l__witharrows_tags_clist \c_one_int + } , + tagged-lines .value_required:n = true + } +\keys_define:nn { WithArrows } + { + WithArrows .inherit:n = + { + WithArrows / Global , + WithArrows / WithArrowsSpecific + } + } +\keys_define:nn { WithArrows / WithArrows } + { + name .tl_set:N = \l__witharrows_name_str , + name .value_required:n = true , + CodeBefore .code:n = \tl_put_right:Nn \l__witharrows_code_before_tl { #1 } , + CodeBefore .value_required:n = true, + CodeAfter .code:n = \tl_put_right:Nn \l__witharrows_code_after_tl { #1 } , + CodeAfter .value_required:n = true , + unknown .code:n = + \__witharrows_sort_seq:N \l__witharrows_options_WithArrows_seq + \__witharrows_error:n { Unknown~option~WithArrows } + } +\seq_set_from_clist:Nn \l__witharrows_options_WithArrows_seq + { + adjust, b, c, CodeAfter, CodeBefore, CommandName, displaystyle, end-adjust, + group, groups, i, interline, jot, ll, lr, more-columns, name, rl, rr, + show-node-names, show-nodes, start-adjust, t, tikz, TikzCode, xoffset, ygap, + ystart + } +\keys_define:nn { WithArrows } + { + DispWithArrows .inherit:n = { - \prop_get:cnN {g__wa_arrow_\l__wa_prefix_str _\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_str _\int_use:N\l__wa_arrow_int _prop} - {final} \l_tmpa_tl - \int_set:Nn \l__wa_final_int \l_tmpa_tl - \prop_get:cnN {g__wa_arrow_\l__wa_prefix_str _\int_use:N\l__wa_arrow_int _prop} - {position} \l_tmpa_tl - \int_set:Nn \l__wa_pos_of_arrow_int \l_tmpa_tl - \int_compare:nNnTF \l__wa_final_int > \g__wa_line_int - {\__wa_error:n {Too~few~lines~for~an~arrow}} - {\bool_if:nT {\int_compare_p:nNn \l__wa_arrow_int > 1 - && - \int_compare_p:nNn - \l__wa_initial_int > \l__wa_last_line_of_group_int - && - \int_compare_p:n {\l__wa_pos_arrow_int != 7}} - {\__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_eq:NN \l__wa_first_arrow_of_group_int \l__wa_arrow_int - \int_set_eq:NN \l__wa_first_line_of_group_int \l__wa_initial_int - \int_set_eq:NN \l__wa_last_line_of_group_int \l__wa_final_int - \seq_clear:N \l__wa_first_arrows_of_group_seq - \seq_put_left:NV \l__wa_first_arrows_of_group_seq \l__wa_arrow_int - \seq_clear:N \l__wa_last_arrows_of_group_seq - \seq_put_left:NV \l__wa_last_arrows_of_group_seq \l__wa_arrow_int - \int_compare:nT {\l__wa_pos_arrow_int != 8} - {\dim_set:Nn \l__wa_x_dim {-\c_max_dim}} - } - {\int_compare:nNnT \l__wa_pos_of_arrow_int = {-1} - {\int_compare:nNnT \l__wa_initial_int = \l__wa_first_line_of_group_int - {\seq_put_left:NV \l__wa_first_arrows_of_group_seq \l__wa_arrow_int} - \int_compare:nNnTF \l__wa_final_int > \l__wa_last_line_of_group_int - {\int_set_eq:NN \l__wa_last_line_of_group_int \l__wa_final_int - \seq_clear:N \l__wa_last_arrows_of_group_seq - \seq_put_left:NV \l__wa_last_arrows_of_group_seq \l__wa_arrow_int} - {\int_compare:nNnT \l__wa_final_int = \l__wa_last_line_of_group_int - {\seq_put_left:NV \l__wa_last_arrows_of_group_seq \l__wa_arrow_int}}}} - \int_compare:nNnT \l__wa_pos_of_arrow_int = {-1} - { \int_compare:nT {\l__wa_pos_arrow_int != 8} - {\__wa_update_x_value:nn \l__wa_initial_int \l__wa_final_int}} } - \int_incr:N \l__wa_arrow_int + WithArrows / DispWithArrowsSpecific , + WithArrows / Global } - \int_compare:nT {\l__wa_pos_arrow_int != 7} - {\__wa_draw_arrows:nn \l__wa_first_arrow_of_group_int \g__wa_arrow_int} - } -\cs_generate_variant:Nn \keys_set:nn {no} -\cs_new_protected:Nn \__wa_keys_set: {\keys_set:no {WithArrows/General}} -\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 + } +\keys_define:nn { WithArrows / DispWithArrows } + { + name .tl_set:N = \l__witharrows_name_str , + name .value_required:n = true , + CodeBefore .code:n = \tl_put_right:Nn \l__witharrows_code_before_tl { #1 } , + CodeBefore .value_required:n = true , + CodeAfter .code:n = \tl_put_right:Nn \l__witharrows_code_after_tl { #1 } , + CodeAfter .value_required:n = true , + unknown .code:n = + \__witharrows_sort_seq:N \l__witharrows_options_DispWithArrows_seq + \__witharrows_error:n { Unknown~option~DispWithArrows } + } +\seq_set_from_clist:Nn \l__witharrows_options_DispWithArrows_seq + { + allow-multiple-labels, CodeAfter, CodeBefore, CommandName, TikzCode, adjust, + displaystyle, end-adjust, fleqn, group, groups, i, interline, jot, ll, lr, + mathindent, name, nonumber, notag, rl, rr, show-node-names, show-nodes, + start-adjust, tagged-lines, tikz, wrap-lines, xoffset, ygap, ystart + } +\keys_define:nn { WithArrows } + { + WithArrowsOptions .inherit:n = { - \prop_get:cnN {g__wa_arrow_\l__wa_prefix_str _\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_str _\int_use:N\l__wa_arrow_int _prop} - {final} \l_tmpa_tl - \int_set:Nn \l__wa_final_int {\l_tmpa_tl} - \int_compare:nNnT \l__wa_final_int < {\g__wa_line_int + 1} - \__wa_draw_arrows_i: - \int_incr:N \l__wa_arrow_int + WithArrows / Global , + WithArrows / WithArrowsSpecific , + WithArrows / DispWithArrowsSpecific } - \group_end: - } -\cs_new_protected:Nn \__wa_draw_arrows_i: - {\group_begin: - \int_set:Nn \l__wa_level_int 3 - \prop_get:cnN {g__wa_arrow_\l__wa_prefix_str - _\int_use:N\l__wa_arrow_int _prop} {options} \l_tmpa_tl - \exp_args:NNo \exp_args:No - \__wa_keys_set: {\l_tmpa_tl,tikz={xshift = \l__wa_xoffset_dim}} - \prop_get:cnN {g__wa_arrow_\l__wa_prefix_str _\int_use:N\l__wa_arrow_int _prop} - {position} \l_tmpa_tl - \int_set:Nn \l_tmpa_int \l_tmpa_tl - \int_compare:nNnF \l_tmpa_int = {-1} - {\int_set_eq:NN \l__wa_pos_arrow_int \l_tmpa_int} - \bool_set_false:N \l__wa_initial_r_bool - \bool_set_false:N \l__wa_final_r_bool - \int_case:nn \l__wa_pos_arrow_int - {0 {\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_initial_r_bool - \bool_set_true:N \l__wa_final_r_bool}} - \int_compare:nNnT \l__wa_pos_arrow_int = 5 - { \dim_set:Nn \l__wa_x_dim {-\c_max_dim} - \__wa_update_x_value:nn \l__wa_initial_int \l__wa_final_int } - \tl_set:Nx \l__wa_initial_tl - {\int_use:N\l__wa_initial_int-\bool_if:NTF\l__wa_initial_r_bool rl .south} - \tl_set:Nx \l__wa_final_tl - {\int_use:N\l__wa_final_int-\bool_if:NTF\l__wa_final_r_bool rl .north} - \prop_get:cnN {g__wa_arrow_\l__wa_prefix_str _\int_use:N\l__wa_arrow_int _prop} - {label} - \l_tmpa_tl - \seq_if_in:NxTF \l__wa_first_arrows_of_group_seq {\int_use:N \l__wa_arrow_int} - {\bool_set_true:N \l_tmpa_bool} - {\bool_set_false:N \l_tmpa_bool} - \seq_if_in:NxTF \l__wa_last_arrows_of_group_seq {\int_use:N \l__wa_arrow_int} - {\bool_set_true:N \l_tmpb_bool} - {\bool_set_false:N \l_tmpb_bool} - \int_compare:nNnT \l__wa_pos_arrow_int = 5 - {\bool_set_true:N \l_tmpa_bool - \bool_set_true:N \l_tmpb_bool} - \begin{tikzpicture} [__wa_standard] - \tikz@scan@one@point\pgfutil@firstofone (\l__wa_initial_tl) - \tl_gset:Nx \g_tmpa_tl - {\int_compare:nNnTF \l__wa_pos_arrow_int < 5 - { \dim_use:N \pgf@x } - { \dim_use:N \l__wa_x_dim } , - \bool_if:NTF \l_tmpa_bool - { \dim_eval:n {\pgf@y + \l__wa_start_adjust_dim }} - { \dim_use:N \pgf@y } } - \tikz@scan@one@point\pgfutil@firstofone (\l__wa_final_tl) - \tl_gset:Nx \g_tmpb_tl - {\int_compare:nNnTF \l__wa_pos_arrow_int < 5 - { \dim_use:N \pgf@x } - { \dim_use:N \l__wa_x_dim } , - \bool_if:NTF \l_tmpb_bool - { \dim_eval:n {\pgf@y - \l__wa_end_adjust_dim }} - { \dim_use:N \pgf@y }} - \end{tikzpicture} - \__wa_draw_arrow:nno \g_tmpa_tl \g_tmpb_tl \l_tmpa_tl - \group_end: } -\cs_new_protected:Nn \__wa_def_function_tmpa:n - {\cs_set:Nn \__wa_tmpa:nnn - {\begin{tikzpicture}[__wa_standard,every~path/.style = {WithArrows/arrow}] - #1 - \end{tikzpicture}}} -\cs_new_protected:Nn \__wa_draw_arrow:nnn + } +\keys_define:nn { WithArrows / WithArrowsOptions } + { + unknown .code:n = + \__witharrows_sort_seq:N \l__witharrows_options_WithArrowsOptions_seq + \__witharrows_error:n { Unknown~option~WithArrowsOptions } + } +\seq_set_from_clist:Nn \l__witharrows_options_WithArrowsOptions_seq + { + allow-multiple-labels, b, c, CommandName, more-columns, TikzCode, adjust, + displaystyle, end-adjust, fleqn, group, groups, i, interline, jot, ll, lr, + mathindent, nonumber, notag, rl, rr, show-node-names, show-nodes, + start-adjust, t, tagged-lines, tikz, wrap-lines, xoffset, ygap, ystart + } +\cs_new_protected:Nn \__witharrows_set_independent: + { + \str_if_empty:NTF \l__witharrows_previous_key_str + { + \str_set_eq:NN \l__witharrows_previous_key_str \l_keys_key_tl + \str_set:Nn \l__witharrows_status_arrow_str { independent } + \str_if_eq:VnF \l_keys_value_tl { NoValue } + { \__witharrows_error:n { Value~for~a~key } } + } + { \__witharrows_error:n { Incompatible~options~in~Arrow } } + } +\keys_define:nn { WithArrows / Arrow / FirstPass } + { + jump .code:n = + \int_compare:nTF { #1 > 0 } + { \int_set:Nn \l__witharrows_jump_int { #1 } } + { \__witharrows_error:n { Negative~jump } } , + jump .value_required:n = true, + rr .code:n = \__witharrows_set_independent: , + ll .code:n = \__witharrows_set_independent: , + rl .code:n = \__witharrows_set_independent: , + lr .code:n = \__witharrows_set_independent: , + i .code:n = \__witharrows_set_independent: , + rr .default:n = NoValue , + ll .default:n = NoValue , + rl .default:n = NoValue , + lr .default:n = NoValue , + i .default:n = NoValue , + 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 } } , + TikzCode .code:n = \prg_do_nothing: , + TikzCode .value_required:n = true , + tikz .code:n = \prg_do_nothing: , + tikz .value_required:n = true , + xoffset .code:n = + \int_compare:nNnT \l__witharrows_pos_arrow_int > 5 + { \__witharrows_error:n { Option~xoffset~forbidden } } , + xoffset .value_required:n = true , + start-adjust .code:n = \prg_do_nothing: , + start-adjust .value_required:n = true , + end-adjust .code:n = \prg_do_nothing: , + end-adjust .value_required:n = true , + adjust .code:n = \prg_do_nothing: , + adjust .value_required:n = true , + unknown .code:n = + \__witharrows_sort_seq:N \l__witharrows_options_Arrow_seq + \__witharrows_error:n { Unknown~option~in~Arrow } + } +\seq_set_from_clist:Nn \l__witharrows_options_Arrow_seq + { + adjust, end-adjust, i, jump, ll, lr, rl, rr, start-adjust, tikz, TikzCode, + xoffset + } +\cs_new_protected:Nn \__witharrows_fix_pos_arrow:n + { + \str_if_empty:NT \l__witharrows_previous_key_str + { + \str_set_eq:NN \l__witharrows_previous_key_str \l_keys_key_tl + \int_set:Nn \l__witharrows_pos_arrow_int { #1 } + } + } +\keys_define:nn {WithArrows / Arrow / SecondPass } + { + TikzCode .tl_set:N = \l__witharrows_tikz_code_tl , + TikzCode .initial:n = \draw~(#1)~to~node{#3}~(#2)~; , + tikz .code:n = \tikzset { WithArrows / arrow / .append~style = { #1 } } , + tikz .initial:n = \c_empty_tl , + rr .code:n = \__witharrows_fix_pos_arrow:n 3 , + ll .code:n = \__witharrows_fix_pos_arrow:n 1 , + 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 , + xoffset .code:n = + \int_compare:nNnF \l__witharrows_pos_arrow_int > 5 + { \dim_set:Nn \l__witharrows_xoffset_dim { #1 } } , + start-adjust .dim_set:N = \l__witharrows_start_adjust_dim, + end-adjust .dim_set:N = \l__witharrows_end_adjust_dim, + adjust .code:n = + \dim_set:Nn \l__witharrows_start_adjust_dim { #1 } + \dim_set:Nn \l__witharrows_end_adjust_dim { #1 } , + } +\NewDocumentCommand \WithArrowsOptions { m } + { + \str_clear_new:N \l__witharrows_previous_key_str + \keys_set:nn { WithArrows / WithArrowsOptions } { #1 } + } +\NewDocumentCommand \__witharrows_Arrow { O { } m ! O { } } + { + \int_gincr:N \g__witharrows_arrow_int + \str_clear_new:N \l__witharrows_previous_key_str + \keys_set:nn { WithArrows / Arrow / FirstPass } { #1 , #3 } + \prop_put:NnV \l_tmpa_prop { initial } \g__witharrows_line_int + \int_set:Nn \l_tmpa_int { \g__witharrows_line_int + \l__witharrows_jump_int } + \prop_put:NnV \l_tmpa_prop { final } \l_tmpa_int + \prop_put:NnV \l_tmpa_prop { status } \l__witharrows_status_arrow_str + \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_gclear_new:c + { g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \g__witharrows_arrow_int _ prop } + \prop_gset_eq:cN + { g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \g__witharrows_arrow_int _ prop } + \l_tmpa_prop + } +\cs_new_protected:Nn \__witharrows_Arrow_first_column: + { \__witharrows_error:n { Arrow~in~first~column } \__witharrows_Arrow } +\cs_new_protected:Nn \__witharrows_pre_environment:n + { + \str_clear_new:N \l__witharrows_type_env_str + \str_set:NV \l__witharrows_type_env_str \@currenvir + \cs_if_exist:NT \tikz@library@external@loaded + { \tikzset { external / export = false } } + \str_clear_new:N \l__witharrows_name_str + \seq_gput_right:NV \g__witharrows_arrow_int_seq \g__witharrows_arrow_int + \int_gzero:N \g__witharrows_arrow_int + \seq_gput_right:NV \g__witharrows_line_int_seq \g__witharrows_line_int + \int_gzero:N \g__witharrows_line_int + \seq_gput_right:Nn \g__witharrows_position_in_the_tree_seq 1 + \seq_set_eq:NN \l_tmpa_seq \g__witharrows_position_in_the_tree_seq + \seq_pop_right:NN \l_tmpa_seq \l_tmpa_tl + \str_clear_new:N \l__witharrows_prefix_str + \str_set:Nx \l__witharrows_prefix_str { \seq_use:Nnnn \l_tmpa_seq - - - } + \cs_set_eq:NN \\ \__witharrows_cr: + \dim_zero:N \mathsurround + \int_zero_new:N \l__witharrows_initial_int + \int_zero_new:N \l__witharrows_final_int + \int_zero_new:N \l__witharrows_arrow_int + \int_zero_new:N \l__witharrows_pos_of_arrow_int + \int_zero_new:N \l__witharrows_jump_int + \int_set:Nn \l__witharrows_jump_int \c_one_int + \seq_clear_new:N \l__witharrows_labels_seq + \__witharrows_bool_new:N \l__witharrows_tag_next_line_bool + \skip_zero:N \l__witharrows_interline_skip + \tl_clear_new:N \l__witharrows_code_before_tl + \tl_clear_new:N \l__witharrows_code_after_tl + \str_clear_new:N \l__witharrows_previous_key_str + \bool_if:NT \l__witharrows_in_WithArrows_bool + { \keys_set:nn { WithArrows / WithArrows } { #1 } } + \bool_if:NT \l__witharrows_in_DispWithArrows_bool + { \keys_set:nn { WithArrows / DispWithArrows } { #1 } } + \bool_if:NT \g__witharrows_footnote_bool { \begin { savenotes } } + \l__witharrows_code_before_tl + \cs_set_eq:cN \l__witharrows_CommandName_str \__witharrows_Arrow + } +\NewDocumentEnvironment { WithArrows } { ! O { } } + { + \bool_set_true:N \l__witharrows_in_WithArrows_bool + \bool_set_false:N \l__witharrows_in_DispWithArrows_bool + \__witharrows_pre_environment:n { #1 } + \if_mode_math: \else: + \__witharrows_error:n { WithArrows~outside~math~mode } + \fi: + \cs_set_eq:NN \notag \__witharrows_notag: + \cs_set_eq:NN \nonumber \__witharrows_notag: + \cs_set_eq:NN \tag \__witharrows_tag + \cs_set_eq:NN \label \__witharrows_label:n + \cs_set_eq:NN \tagnextline \__witharrows_tagnextline: + \int_case:nn \l__witharrows_pos_env_int { 0 \vtop 1 \vcenter 2 \vbox } + \bgroup + \spread@equation + \ialign \bgroup + \int_gincr:N \g__witharrows_line_int + \cs_set_eq:cN \l__witharrows_CommandName_str \__witharrows_Arrow_first_column: + \bool_set_true:N \l__witharrows_in_first_column_bool + \strut \hfil + $ + \bool_if:NT \l__witharrows_displaystyle_bool \displaystyle + { ## } + $ + & + $ + \bool_if:NT \l__witharrows_displaystyle_bool \displaystyle + { { } ## } + $ + \tikz [ remember~picture , overlay ] + \node + [ + node~contents = { } , + __witharrows_node_style , + name = wa - \l__witharrows_prefix_str - \int_use:N \g__witharrows_line_int - l , + alias = + { + \str_if_empty:NF \l__witharrows_name_str + { \l__witharrows_name_str - \int_use:N \g__witharrows_line_int - l } + } + ] + ; + \hfil + \tikz [ remember~picture , overlay ] + \node + [ + node~contents = { } , + __witharrows_node_style , + name = wa - \l__witharrows_prefix_str - \int_use:N \g__witharrows_line_int - r , + alias = + { + \str_if_empty:NF \l__witharrows_name_str + { \l__witharrows_name_str - \int_use:N \g__witharrows_line_int - r } + } + ] + ; + \bool_if:NT \l__witharrows_show_node_names_bool + { + \hbox_overlap_right:n + { \small wa - \l__witharrows_prefix_str - \int_use:N \g__witharrows_line_int } + } + && + \__witharrows_error:n { Third~column~in~WithArrows } + $ + \bool_if:NT \l__witharrows_displaystyle_bool \displaystyle + { ## } + $ + \cr + } + { + \\ + \egroup + \egroup + \__witharrows_post_environment: + \bool_if:NT \g__witharrows_footnote_bool { \end { savenotes } } + } +\cs_new_protected:Nn \__witharrows_post_environment: + { + \cs_set:Npn \WithArrowsRightX { \g__witharrows_right_x_dim } + \int_compare:nNnT \g__witharrows_arrow_int > 0 \__witharrows_scan_arrows: + \group_begin: + \tikzset { every~picture / .style = __witharrows_standard } + \cs_set:Npn \WithArrowsNbLines { \int_use:N \g__witharrows_line_int } + \cs_set_eq:NN \MultiArrow \__witharrows_MultiArrow:nn + \cs_set_eq:cN \l__witharrows_CommandName_str \__witharrows_Arrow_code_after + \bool_set_true:N \l__witharrows_in_CodeAfter_bool + \l__witharrows_code_after_tl + \group_end: + \seq_gpop_right:NN \g__witharrows_position_in_the_tree_seq \l_tmpa_tl + \seq_gpop_right:NN \g__witharrows_position_in_the_tree_seq \l_tmpa_tl + \seq_gput_right:Nx \g__witharrows_position_in_the_tree_seq + { \int_eval:n { \l_tmpa_tl + 1 } } + \int_compare:nNnT { \seq_count:N \g__witharrows_position_in_the_tree_seq } = 1 + { \int_gincr:N \g__witharrows_last_env_int } + \seq_gpop_right:NN \g__witharrows_arrow_int_seq \l_tmpa_tl + \int_gset:Nn \g__witharrows_arrow_int \l_tmpa_tl + \seq_gpop_right:NN \g__witharrows_line_int_seq \l_tmpa_tl + \int_gset:Nn \g__witharrows_line_int \l_tmpa_tl + } +\cs_new_protected:Nn \__witharrows_cr: + { + \scan_stop: + \bool_if:NT \l__witharrows_in_first_column_bool { & { } } + \group_align_safe_begin: + \peek_meaning_remove:NTF * \__witharrows_cr_i: \__witharrows_cr_i: + } +\cs_new_protected:Nn \__witharrows_cr_i: + { \peek_meaning:NTF [ \__witharrows_cr_ii: { \__witharrows_cr_ii: [ \c_zero_dim ] } } +\cs_new_protected:Npn \__witharrows_cr_ii: [ #1 ] + { + \group_align_safe_end: + \bool_if:NT \l__witharrows_in_DispWithArrows_bool + { + \clist_if_in:NnTF \l__witharrows_tags_clist { all } + { + \tl_if_empty:NT \l__witharrows_tag_tl { \int_gincr:N \c@equation } + \cs_gset:Npx \g_tmpa_tl + { \tl_if_empty:NTF \l__witharrows_tag_tl \theequation \l__witharrows_tag_tl } + \seq_if_empty:NF \l__witharrows_labels_seq + { + \cs_set:Npx \@currentlabel { \p@equation \g_tmpa_tl } + \bool_if:NT \c__witharrows_hyperref_loaded_bool + { + \cs_set:Npn \This@name { equation } + \hyper@refstepcounter { equation } + } + \bool_if:NT \c__witharrows_cleveref_loaded_bool + { + \cref@constructprefix { equation } { \cref@result } + \protected@edef \cref@currentlabel + { + [ + \cs_if_exist:NTF \cref@equation@alias + \cref@equation@alias + { equation } + ] + [ \arabic { equation } ] [ \cref@result ] + \p@equation \g_tmpa_tl + } + } + \bool_if:NT \c__witharrows_typedref_loaded_bool + { \cs_set:Npn \sr@name { equation } } + \seq_map_function:NN \l__witharrows_labels_seq \__witharrows_old_label + } + \__witharrows_save:N \l__witharrows_tag_star_bool + \__witharrows_save:N \l__witharrows_qedhere_bool + \bool_if:NT \l__witharrows_tag_next_line_bool + { + \openup -\jot + \bool_set_false:N \l__witharrows_tag_next_line_bool + \notag \\ & + } + & + \__witharrows_restore:N \l__witharrows_tag_star_bool + \__witharrows_restore:N \l__witharrows_qedhere_bool + \bool_if:NT \l__witharrows_qedhere_bool + { \hbox_overlap_left:n \__witharrows_qedhere_i: } + \cs_set_eq:NN \theequation \g_tmpa_tl + \bool_if:NT \l__witharrows_tag_star_bool + { \cs_set_eq:NN \tagform@ \prg_do_nothing: } + \hbox_overlap_left:n + { + \bool_if:NF \c__witharrows_leqno_bool + { + \tikz [ __witharrows_standard ] + \coordinate ( \int_use:N \g__witharrows_line_int - v ) ; + } + \quad + \@eqnnum + } + \bool_if:NT \c__witharrows_leqno_bool + { + \tikz [ __witharrows_standard ] + \coordinate ( \int_use:N \g__witharrows_line_int - v ) ; + } + } + { + \__witharrows_save:N \l__witharrows_qedhere_bool + & + \__witharrows_restore:N \l__witharrows_qedhere_bool + \bool_if:NT \l__witharrows_qedhere_bool + { \hbox_overlap_left:n \__witharrows_qedhere_i: } + \tikz [ __witharrows_standard ] + \coordinate ( \int_use:N \g__witharrows_line_int - v ) ; + } + } + \cr \noalign { \skip_vertical:n { #1 + \l__witharrows_interline_skip } \scan_stop: } + } +\cs_new_protected:Nn \__witharrows_if_in_second_col_of_disp:Nn + { + \bool_if:NTF \l__witharrows_in_WithArrows_bool + { \__witharrows_error:nn { Not~allowed~in~WithArrows } { #1 } } + { + \bool_if:NTF \l__witharrows_in_first_column_bool + { \__witharrows_error:nn { Not~allowed~in~DispWithArrows } { #1 } } + { #2 } + } + } +\cs_new_protected:Nn \__witharrows_notag: + { \__witharrows_if_in_second_col_of_disp:Nn \notag { \clist_clear:N \l__witharrows_tags_clist } } +\NewDocumentCommand \__witharrows_tag { s m } + { + \__witharrows_if_in_second_col_of_disp:Nn \tag + { + \tl_if_empty:NF \l__witharrows_tag_tl + { \__witharrows_error:nn { Multiple~tags } { #2 } } + \clist_set:Nn \l__witharrows_tags_clist { all } + \bool_if:nT \c__witharrows_mathtools_loaded_bool + { + \MH_if_boolean:nT { show_only_refs } + { + \MH_if_boolean:nF { show_manual_tags } + { \clist_clear:N \l__witharrows_tags_clist } + } + } + \tl_set:Nn \l__witharrows_tag_tl { #2 } + \bool_set:Nn \l__witharrows_tag_star_bool { #1 } + \bool_if:nT { #1 && ! \bool_if_p:N \c__witharrows_amsmath_loaded_bool } + { \__witharrows_error:n { tag*~without~amsmath } } + } + } +\cs_new_protected:Nn \__witharrows_label:n + { + \__witharrows_if_in_second_col_of_disp:Nn \label + { + \seq_if_empty:NF \l__witharrows_labels_seq + { + \bool_if:NTF \c__witharrows_cleveref_loaded_bool + { \__witharrows_error:n { Multiple~labels~with~cleveref } } + { \__witharrows_error:n { Multiple~labels } } + } + \seq_put_right:Nn \l__witharrows_labels_seq { #1 } + \bool_if:nT \c__witharrows_mathtools_loaded_bool { - \bool_if:nT {\l__wa_wrap_lines_bool && \l__wa_in_DispWithArrows_bool} - { \tl_set_eq:NN \l__wa_tikz_code_tl \c__wa_tikz_code_wrap_lines_tl } - \exp_args:No \__wa_def_function_tmpa:n \l__wa_tikz_code_tl - \__wa_tmpa:nnn {#1} {#2} {#3} } -\cs_generate_variant:Nn \__wa_draw_arrow:nnn {nno} -\tl_set:Nn \c__wa_tikz_code_wrap_lines_tl + \MH_if_boolean:nT { show_only_refs } + { + \cs_if_exist:cTF { MT_r_#1 } + { \clist_set:Nn \l__witharrows_tags_clist { all } } + { \clist_clear:N \l__witharrows_tags_clist } + } + } + \bool_if:nT \c__witharrows_autonum_loaded_bool + { + \cs_if_exist:cTF { autonum@#1Referenced } + { \clist_set:Nn \l__witharrows_tags_clist { all } } + { \clist_clear:N \l__witharrows_tags_clist } + } + } + } +\cs_new_protected:Nn \__witharrows_tagnextline: + { + \__witharrows_if_in_second_col_of_disp:Nn \tagnextline + { \bool_set_true:N \l__witharrows_tag_next_line_bool } + } +\bool_new:N \l__witharrows_qedhere_bool +\cs_new_protected:Nn \__witharrows_qedhere: { \bool_set_true:N \l__witharrows_qedhere_bool } +\cs_new_protected:Nn \__witharrows_qedhere_i: + { + \group_begin: + \cs_set_eq:NN \qed \qedsymbol + \cs_set_eq:NN \qed@elt \setQED@elt + \QED@stack \relax \relax + \group_end: + } +\NewDocumentEnvironment { DispWithArrows } { ! O { } } + { + \bool_if:nT \c__witharrows_mathtools_loaded_bool + { + \MH_if_boolean:nT { show_only_refs } + { + \MT_showonlyrefs_false: + \MH_set_boolean_T:n { show_only_refs } + } + } + \bool_if:NT \c__witharrows_amsmath_loaded_bool \intertext@ + \bool_set_true:N \l__witharrows_in_DispWithArrows_bool + \__witharrows_pre_environment:n { #1 } + \if_mode_math: + \__witharrows_error:n { DispWithArrows~in~math~mode } + \fi: + \if_mode_vertical: + \nointerlineskip + \makebox [ .6 \linewidth ] { } + \fi: + $$ + \vcenter \bgroup + \spread@equation + \bool_if:NTF \l__witharrows_fleqn_bool + { \tabskip = \c_zero_skip } + { \tabskip = 0 pt plus 1000 pt minus 1000 pt } + \cs_set_eq:NN \__witharrows_old_label \label + \cs_set_eq:NN \notag \__witharrows_notag: + \cs_set_eq:NN \nonumber \__witharrows_notag: + \cs_set_eq:NN \tag \__witharrows_tag + \cs_set_eq:NN \label \__witharrows_label:n + \cs_set_eq:NN \tagnextline \__witharrows_tagnextline: + \halign to \displaywidth + \bgroup + \int_gincr:N \g__witharrows_line_int + \cs_set_eq:cN \l__witharrows_CommandName_str \__witharrows_Arrow_first_column: + \bool_set_true:N \l__witharrows_in_first_column_bool + \strut + \bool_if:NT \l__witharrows_fleqn_bool { \skip_horizontal:n \l__witharrows_mathindent_dim } + \hfil + $ + \bool_if:NT \l__witharrows_displaystyle_bool \displaystyle + { ## } + $ + \tabskip = \c_zero_skip + & + \clist_if_in:NVT \l__witharrows_tags_clist \g__witharrows_line_int + { \clist_set:Nn \l__witharrows_tags_clist { all } } + \bool_if:NT \c__witharrows_amsthm_loaded_bool + { \cs_set_eq:NN \qedhere \__witharrows_qedhere: } + $ + \bool_if:NT \l__witharrows_displaystyle_bool \displaystyle + { { } ## } + $ + \tabskip = 0 pt plus 1000 pt minus 1000 pt + \tikz [ remember~picture , overlay ] + \node + [ + node~contents = { } , + __witharrows_node_style , + name = wa - \l__witharrows_prefix_str - \int_use:N \g__witharrows_line_int - l , + alias = + { + \str_if_empty:NF \l__witharrows_name_str + { \l__witharrows_name_str - \int_use:N \g__witharrows_line_int - l } + } + ] + ; + \hfil + \tikz [ remember~picture , overlay ] + \node + [ + node~contents = { } , + __witharrows_node_style , + name = wa - \l__witharrows_prefix_str - \int_use:N \g__witharrows_line_int - r , + alias = + { + \str_if_empty:NF \l__witharrows_name_str + { \l__witharrows_name_str - \int_use:N \g__witharrows_line_int - r } + } + ] + ; + \bool_if:NT \l__witharrows_show_node_names_bool + { + \hbox_overlap_right:n + { \small wa - \l__witharrows_prefix_str - \int_use:N \g__witharrows_line_int } + } + & + ## + \tabskip = \c_zero_skip + && + \__witharrows_error:n { Third~column~in~DispWithArrows } + \iffalse ## \fi + \cr + } + { + \clist_if_in:NnT \l__witharrows_tags_clist { last } + { \clist_set:Nn \l__witharrows_tags_clist { all } } + \\ + \egroup + \egroup + \bool_if:NT \l__witharrows_in_DispWithArrows_bool + { + \dim_gzero_new:N \g__witharrows_right_x_dim + \dim_gset_eq:NN \g__witharrows_right_x_dim \c_max_dim + \begin { tikzpicture } [ __witharrows_standard ] + \int_step_variable:nNn \g__witharrows_line_int \l_tmpa_int + { + \cs_if_free:cTF + { pgf@sh@ns@wa - \l__witharrows_prefix_str - \l_tmpa_int - v } + { \__witharrows_error:n { Inexistent~v-node } } { - \draw (#1) to node (__wa_label) {} (#2) ; - \tikz@parse@node \pgfutil@firstofone (__wa_label.west) - \dim_set:Nn \l_tmpa_dim {\g__wa_right_x_dim - \pgf@x - 0.3333 em} - \path \pgfextra {\tl_gset:Nx \g_tmpa_tl \tikz@text@width} ; - \tl_if_empty:NF \g_tmpa_tl - {\dim_set:Nn \l_tmpb_dim \g_tmpa_tl - \dim_compare:nNnT \l_tmpb_dim < \l_tmpa_dim - {\dim_set_eq:NN \l_tmpa_dim \l_tmpb_dim}} - \dim_compare:nNnT \l_tmpa_dim > \c_zero_dim - {\path (__wa_label.west) - node [anchor = west, text~width = \dim_use:N \l_tmpa_dim] - {#3} ; } } -\cs_new_protected:Nn \__wa_update_x_value:nn - {\int_step_inline:nnn {#1} {#2} - {\begin{tikzpicture} [__wa_standard] - \tikz@scan@one@point\pgfutil@firstofone (##1-l) - \dim_gset:Nn \g_tmpa_dim {\dim_max:nn \l__wa_x_dim \pgf@x } - \end{tikzpicture} - \dim_set_eq:NN \l__wa_x_dim \g_tmpa_dim } } -\cs_new:Npn \WithArrowsLastEnv {\int_use:N \g__wa_last_env_int} -\keys_define:nn {WithArrows/CodeAfter} - {tikz .code:n = \tikzset {WithArrows/arrow/.append~style = {#1}} , - tikz .value_required:n = true, - rr .value_forbidden:n = true, - rr .code:n = \__wa_analyze_option_position:n 0 , - ll .value_forbidden:n = true, - ll .code:n = \__wa_analyze_option_position:n 1 , - rl .value_forbidden:n = true, - rl .code:n = \__wa_analyze_option_position:n 2 , - lr .value_forbidden:n = true, - lr .code:n = \__wa_analyze_option_position:n 3 , - v .value_forbidden:n = true, - v .code:n = \__wa_analyze_option_position:n 4 , - TikzCode .tl_set:N = \l__wa_tikz_code_tl, - TikzCode .value_required:n = true, - xoffset .dim_set:N = \l__wa_xoffset_dim, - xoffset .value_required:n = true} -\NewDocumentCommand \__wa_Arrow_code_after {O{} mmm !O{}} - {\int_set:Nn \l__wa_pos_arrow_int 1 - \int_set:Nn \l__wa_previous_pos_arrow_int {-1} - \group_begin: - \int_set:Nn \l__wa_level_int 3 - \keys_set:nn {WithArrows/CodeAfter} - {#1,#5,tikz={xshift = \l__wa_xoffset_dim}} - \bool_set_false:N \l__wa_initial_r_bool - \bool_set_false:N \l__wa_final_r_bool - \int_case:nn \l__wa_pos_arrow_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}} - \cs_if_free:cTF {pgf@sh@ns@wa-\l__wa_prefix_str-#2-l} - {\__wa_error:nx {Wrong~line~in~Arrow} {#2}} - {\cs_if_free:cTF {pgf@sh@ns@wa-\l__wa_prefix_str-#3-l} - {\__wa_error:nx {Wrong~line~in~Arrow} {#3}} - {\int_compare:nNnTF \l__wa_pos_arrow_int = 4 - {\begin{tikzpicture} [__wa_standard] - \tikz@scan@one@point\pgfutil@firstofone(#2-l.south) + \tikz@parse@node\pgfutil@firstofone ( \l_tmpa_int - v ) + \dim_set:Nn \l_tmpa_dim \pgf@x + \dim_compare:nNnT \l_tmpa_dim < \g__witharrows_right_x_dim + { \dim_gset:Nn \g__witharrows_right_x_dim \l_tmpa_dim } + } + } + \end { tikzpicture } + } + \__witharrows_post_environment: + \bool_if:nT \c__witharrows_mathtools_loaded_bool + { \MH_if_boolean:nT { show_only_refs } \MT_showonlyrefs_true: } + $$ + \bool_if:NT \g__witharrows_footnote_bool { \end {savenotes } } + \ignorespacesafterend + } +\NewDocumentEnvironment { DispWithArrows* } {} + { + \WithArrowsOptions { notag } + \DispWithArrows + } + { \endDispWithArrows } +\cs_new_protected:Nn \__witharrows_scan_arrows: + { + \group_begin: + \int_compare:nNnT \l__witharrows_pos_arrow_int = 7 + { + \__witharrows_scan_arrows_i: + \int_set:Nn \l__witharrows_pos_arrow_int 8 + } + \__witharrows_scan_arrows_i: + \group_end: + } +\cs_new_protected:Nn \__witharrows_scan_arrows_i: + { + \int_zero_new:N \l__witharrows_first_arrow_of_group_int + \int_zero_new:N \l__witharrows_first_line_of_group_int + \int_zero_new:N \l__witharrows_last_line_of_group_int + \seq_clear_new:N \l__witharrows_first_arrows_of_group_seq + \seq_clear_new:N \l__witharrows_last_arrows_of_group_seq + \bool_set_true:N \l__witharrows_new_group_bool + \int_set:Nn \l__witharrows_arrow_int \c_one_int + \int_until_do:nNnn \l__witharrows_arrow_int > \g__witharrows_arrow_int + { + \prop_get:cnN + { g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ 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 _ \int_use:N \l__witharrows_arrow_int _ 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 _ \int_use:N \l__witharrows_arrow_int _ prop } + { status } \l__witharrows_status_arrow_str + \prop_get:cnN + { g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop } + { input-line } \l__witharrows_input_line_str + \int_compare:nNnTF \l__witharrows_final_int > \g__witharrows_line_int + { \__witharrows_error:n { Too~few~lines~for~an~arrow } } + { + \bool_if:nT + { + \int_compare_p:nNn \l__witharrows_arrow_int > 1 + && + ( \int_compare_p:n + { \l__witharrows_initial_int > \l__witharrows_last_line_of_group_int } + && + \int_compare_p:n { \l__witharrows_pos_arrow_int != 7 } + || + \str_if_eq_p:Vn \l__witharrows_status_arrow_str { new-group } + ) + } + { + \int_compare:nNnF \l__witharrows_first_arrow_of_group_int = 0 + { + \__witharrows_draw_arrows:nn + \l__witharrows_first_arrow_of_group_int + { \l__witharrows_arrow_int - 1 } + } + \bool_set_true:N \l__witharrows_new_group_bool + } + \bool_if:nTF \l__witharrows_new_group_bool + { + \bool_set_false:N \l__witharrows_new_group_bool + \int_set_eq:NN \l__witharrows_first_arrow_of_group_int \l__witharrows_arrow_int + \int_set_eq:NN \l__witharrows_first_line_of_group_int \l__witharrows_initial_int + \int_set_eq:NN \l__witharrows_last_line_of_group_int \l__witharrows_final_int + \seq_clear:N \l__witharrows_first_arrows_of_group_seq + \seq_put_left:NV \l__witharrows_first_arrows_of_group_seq + \l__witharrows_arrow_int + \seq_clear:N \l__witharrows_last_arrows_of_group_seq + \seq_put_left:NV \l__witharrows_last_arrows_of_group_seq + \l__witharrows_arrow_int + \int_compare:nT { \l__witharrows_pos_arrow_int != 8 } + { \dim_set:Nn \l__witharrows_x_dim { - \c_max_dim } } + } + { + \bool_if:nF + { \str_if_eq_p:Vn \l__witharrows_status_arrow_str { independent } } + { + \int_compare:nT + { \l__witharrows_initial_int = \l__witharrows_first_line_of_group_int } + { + \seq_put_left:NV \l__witharrows_first_arrows_of_group_seq + \l__witharrows_arrow_int + } + \int_compare:nTF + { \l__witharrows_final_int > \l__witharrows_last_line_of_group_int } + { + \int_set_eq:NN \l__witharrows_last_line_of_group_int + \l__witharrows_final_int + \seq_clear:N \l__witharrows_last_arrows_of_group_seq + \seq_put_left:NV \l__witharrows_last_arrows_of_group_seq + \l__witharrows_arrow_int + } + { + \int_compare:nNnT + \l__witharrows_final_int = \l__witharrows_last_line_of_group_int + { + \seq_put_left:NV \l__witharrows_last_arrows_of_group_seq + \l__witharrows_arrow_int + } + } + } + } + \bool_if:nF + { \str_if_eq_p:Vn \l__witharrows_status_arrow_str { independent } } + { + \int_compare:nT { \l__witharrows_pos_arrow_int != 8 } + { \__witharrows_update_x:nn \l__witharrows_initial_int \l__witharrows_final_int } + } + } + \int_incr:N \l__witharrows_arrow_int + } + \int_compare:nT { \l__witharrows_pos_arrow_int != 7 } + { \__witharrows_draw_arrows:nn \l__witharrows_first_arrow_of_group_int \g__witharrows_arrow_int } + } +\cs_generate_variant:Nn \keys_set:nn { n o } +\cs_new_protected:Nn \__witharrows_keys_set: + { \keys_set_known:no { WithArrows / Arrow / SecondPass } } +\cs_new_protected:Nn \__witharrows_draw_arrows:nn + { + \group_begin: + \int_zero_new:N \l__witharrows_first_arrow_int + \int_set:Nn \l__witharrows_first_arrow_int { #1 } + \int_zero_new:N \l__witharrows_last_arrow_int + \int_set:Nn \l__witharrows_last_arrow_int { #2 } + \int_set:Nn \l__witharrows_arrow_int \l__witharrows_first_arrow_int + \int_until_do:nNnn \l__witharrows_arrow_int > \l__witharrows_last_arrow_int + { + \prop_get:cnN + { g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ 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 _ \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: + \int_incr:N \l__witharrows_arrow_int + } + \group_end: + } +\cs_new_protected:Nn \__witharrows_draw_arrows_i: + { + \group_begin: + \prop_get:cnN + { g__witharrows_arrow _\l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop } + { options } \l_tmpa_tl + \str_clear_new:N \l__witharrows_previous_key_str + \exp_args:NNo \exp_args:No + \__witharrows_keys_set: { \l_tmpa_tl , tikz = { xshift = \l__witharrows_xoffset_dim } } + \bool_set_false:N \l__witharrows_initial_r_bool + \bool_set_false:N \l__witharrows_final_r_bool + \int_case:nn \l__witharrows_pos_arrow_int + { + 0 { \bool_set_true:N \l__witharrows_final_r_bool } + 2 { \bool_set_true:N \l__witharrows_initial_r_bool } + 3 { + \bool_set_true:N \l__witharrows_initial_r_bool + \bool_set_true:N \l__witharrows_final_r_bool + } + } + \int_compare:nNnT \l__witharrows_pos_arrow_int = 5 + { + \dim_set:Nn \l__witharrows_x_dim { - \c_max_dim } + \__witharrows_update_x:nn \l__witharrows_initial_int \l__witharrows_final_int + } + \tl_set:Nx \l__witharrows_initial_tl + { \int_use:N \l__witharrows_initial_int - \bool_if:NTF \l__witharrows_initial_r_bool rl .south } + \tl_set:Nx \l__witharrows_final_tl + { \int_use:N \l__witharrows_final_int - \bool_if:NTF \l__witharrows_final_r_bool rl .north } + \prop_get:cnN + { g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop } + { label } + \l_tmpa_tl + \seq_if_in:NxTF \l__witharrows_first_arrows_of_group_seq + { \int_use:N \l__witharrows_arrow_int } + { \bool_set_true:N \l_tmpa_bool } + { \bool_set_false:N \l_tmpa_bool } + \seq_if_in:NxTF \l__witharrows_last_arrows_of_group_seq + { \int_use:N \l__witharrows_arrow_int } + { \bool_set_true:N \l_tmpb_bool } + { \bool_set_false:N \l_tmpb_bool } + \int_compare:nNnT \l__witharrows_pos_arrow_int = 5 + { + \bool_set_true:N \l_tmpa_bool + \bool_set_true:N \l_tmpb_bool + } + \begin { tikzpicture } [ __witharrows_standard ] + \tikz@scan@one@point \pgfutil@firstofone ( \l__witharrows_initial_tl ) + \tl_gset:Nx \g_tmpa_tl + { + \int_compare:nNnTF \l__witharrows_pos_arrow_int < 5 + { \dim_use:N \pgf@x } + { \dim_use:N \l__witharrows_x_dim } , + \bool_if:NTF \l_tmpa_bool + { \dim_eval:n { \pgf@y + \l__witharrows_start_adjust_dim } } + { \dim_use:N \pgf@y } + } + \tikz@scan@one@point \pgfutil@firstofone ( \l__witharrows_final_tl ) + \tl_gset:Nx \g_tmpb_tl + { + \int_compare:nNnTF \l__witharrows_pos_arrow_int < 5 + { \dim_use:N \pgf@x } + { \dim_use:N \l__witharrows_x_dim } , + \bool_if:NTF \l_tmpb_bool + { \dim_eval:n { \pgf@y - \l__witharrows_end_adjust_dim } } + { \dim_use:N \pgf@y } + } + \end { tikzpicture } + \__witharrows_draw_arrow:nno \g_tmpa_tl \g_tmpb_tl \l_tmpa_tl + \group_end: + } +\cs_new_protected:Nn \__witharrows_def_function_tmpa:n + { + \cs_set:Npn \__witharrows_tmpa:nnn ##1 ##2 ##3 + { + \begin{tikzpicture} + [ + __witharrows_standard , + every~path / .style = WithArrows / arrow + ] + #1 + \end{tikzpicture} + } + } +\cs_new_protected:Nn \__witharrows_draw_arrow:nnn + { + \bool_if:nT { \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 } + \exp_args:NV \__witharrows_def_function_tmpa:n \l__witharrows_tikz_code_tl + \__witharrows_tmpa:nnn { #1 } { #2 } { #3 } + } +\cs_generate_variant:Nn \__witharrows_draw_arrow:nnn { n n o } +\tl_const:Nn \c__witharrows_tikz_code_wrap_lines_tl + { + \draw ( #1 ) to node ( __witharrows_label ) { } ( #2 ) ; + \tikz@parse@node \pgfutil@firstofone ( __witharrows_label.west ) + \dim_set:Nn \l_tmpa_dim { \g__witharrows_right_x_dim - \pgf@x - 0.3333 em } + \path \pgfextra { \tl_gset:Nx \g_tmpa_tl \tikz@text@width } ; + \tl_if_empty:NF \g_tmpa_tl + { + \dim_set:Nn \l_tmpb_dim \g_tmpa_tl + \dim_compare:nNnT \l_tmpb_dim < \l_tmpa_dim + { \dim_set_eq:NN \l_tmpa_dim \l_tmpb_dim } + } + \dim_compare:nNnT \l_tmpa_dim > \c_zero_dim + { + \path ( __witharrows_label.west ) + node [ anchor = west , text~width = \dim_use:N \l_tmpa_dim ] + { #3 } ; + } + } +\cs_new_protected:Nn \__witharrows_update_x:nn + { + \int_step_inline:nnn { #1 } { #2 } + { + \begin { tikzpicture } [ __witharrows_standard ] + \tikz@scan@one@point \pgfutil@firstofone ( ##1 - l ) + \dim_gset:Nn \g_tmpa_dim { \dim_max:nn \l__witharrows_x_dim \pgf@x } + \end { tikzpicture } + \dim_set_eq:NN \l__witharrows_x_dim \g_tmpa_dim + } + } +\cs_new:Npn \WithArrowsLastEnv { \int_use:N \g__witharrows_last_env_int } +\keys_define:nn { WithArrows / Arrow / CodeAfter } + { + tikz .code:n = + \tikzset { WithArrows / arrow / .append~style = { #1 } } , + tikz .value_required:n = true , + rr .value_forbidden:n = true , + rr .code:n = \__witharrows_fix_pos_option:n 0 , + ll .value_forbidden:n = true, + ll .code:n = \__witharrows_fix_pos_option:n 1 , + rl .value_forbidden:n = true , + rl .code:n = \__witharrows_fix_pos_option:n 2 , + lr .value_forbidden:n = true , + lr .code:n = \__witharrows_fix_pos_option:n 3 , + v .value_forbidden:n = true , + v .code:n = \__witharrows_fix_pos_option:n 4 , + TikzCode .tl_set:N = \l__witharrows_tikz_code_tl , + TikzCode .value_required:n = true , + xoffset .dim_set:N = \l__witharrows_xoffset_dim , + xoffset .value_required:n = true , + unknown .code:n = + \__witharrows_sort_seq:N \l__witharrows_options_Arrow_CodeAfter_seq + \__witharrows_error:n { Unknown~option~Arrow~in~CodeAfter } + } +\seq_set_from_clist:Nn \l__witharrows_options_Arrow_CodeAfter_seq + { ll, lr, rl, rr, tikz, TikzCode, v, x, offset } +\NewDocumentCommand \__witharrows_Arrow_code_after { O { } m m m ! O { } } + { + \int_set:Nn \l__witharrows_pos_arrow_int 1 + \str_clear_new:N \l__witharrows_previous_key_str + \group_begin: + \keys_set:nn { WithArrows / Arrow / CodeAfter } + { #1, #5, tikz = { xshift = \l__witharrows_xoffset_dim } } + \bool_set_false:N \l__witharrows_initial_r_bool + \bool_set_false:N \l__witharrows_final_r_bool + \int_case:nn \l__witharrows_pos_arrow_int + { 0 + { + \bool_set_true:N \l__witharrows_initial_r_bool + \bool_set_true:N \l__witharrows_final_r_bool + } + 2 { \bool_set_true:N \l__witharrows_initial_r_bool } + 3 { \bool_set_true:N \l__witharrows_final_r_bool } + } + \tl_if_eq:nnTF { #2 } { #3 } + { \__witharrows_error:nn { Both~lines~are~equal } { #2 } } + { + \cs_if_free:cTF { pgf@sh@ns@wa - \l__witharrows_prefix_str - #2 - l } + { \__witharrows_error:nx { Wrong~line~in~Arrow } { #2 } } + { + \cs_if_free:cTF { pgf@sh@ns@wa - \l__witharrows_prefix_str - #3 - l } + { \__witharrows_error:nx { Wrong~line~in~Arrow } { #3 } } + { + \int_compare:nNnTF \l__witharrows_pos_arrow_int = 4 + { + \begin { tikzpicture } [ __witharrows_standard ] + \tikz@scan@one@point \pgfutil@firstofone (#2-l.south) \dim_set_eq:NN \l_tmpa_dim \pgf@x \dim_set_eq:NN \l_tmpb_dim \pgf@y - \tikz@scan@one@point\pgfutil@firstofone(#3-l.north) - \dim_set:Nn \l_tmpa_dim {\dim_max:nn \l_tmpa_dim \pgf@x} + \tikz@scan@one@point \pgfutil@firstofone (#3-l.north) + \dim_set:Nn \l_tmpa_dim + { \dim_max:nn \l_tmpa_dim \pgf@x } + \tl_gset:Nx \g_tmpa_tl + { \dim_use:N \l_tmpa_dim , \dim_use:N \l_tmpb_dim } + \tl_gset:Nx \g_tmpb_tl + { \dim_use:N \l_tmpa_dim , \dim_use:N \pgf@y } + \end { tikzpicture } + } + { + \begin { tikzpicture } [ __witharrows_standard ] + \tikz@scan@one@point \pgfutil@firstofone + ( #2-\bool_if:NTF\l__witharrows_initial_r_bool rl .south ) \tl_gset:Nx \g_tmpa_tl - {\dim_use:N \l_tmpa_dim , \dim_use:N \l_tmpb_dim} + { \dim_use:N \pgf@x , \dim_use:N \pgf@y } + \tikz@scan@one@point \pgfutil@firstofone + ( #3-\bool_if:NTF\l__witharrows_final_r_bool rl .north ) \tl_gset:Nx \g_tmpb_tl - {\dim_use:N \l_tmpa_dim , \dim_use:N \pgf@y} - \end{tikzpicture} } - {\begin{tikzpicture} [__wa_standard] - \tikz@scan@one@point\pgfutil@firstofone - (#2-\bool_if:NTF\l__wa_initial_r_bool rl .south) - \tl_gset:Nx \g_tmpa_tl {\dim_use:N \pgf@x , \dim_use:N \pgf@y} - \tikz@scan@one@point\pgfutil@firstofone - (#3-\bool_if:NTF\l__wa_final_r_bool rl .north) - \tl_gset:Nx \g_tmpb_tl {\dim_use:N \pgf@x , \dim_use:N \pgf@y} - \end{tikzpicture}} - \__wa_draw_arrow:nnn \g_tmpa_tl \g_tmpb_tl {#4} }} - \group_end: + { \dim_use:N \pgf@x , \dim_use:N \pgf@y } + \end { tikzpicture } + } + \__witharrows_draw_arrow:nnn \g_tmpa_tl \g_tmpb_tl { #4 } + } + } + } + \group_end: + } +\cs_new_protected:Nn \__witharrows_MultiArrow:nn + { + \foreach \x in { #1 } + { + \cs_if_free:cTF { pgf@sh@ns@wa - \l__witharrows_prefix_str - \x - l } + { \__witharrows_error:nx { Wrong~line~specification~in~MultiArrow } \x } + { \clist_gput_right:Nx \g_tmpa_clist \x } } -\cs_new_protected:Nn \__wa_MultiArrow:nn - { - \foreach \x in {#1} {\cs_if_free:cTF {pgf@sh@ns@wa-\l__wa_prefix_str-\x-l} - {\__wa_error:nx {Wrong~line~specification~in~MultiArrow} \x } - {\clist_gput_right:Nx \g_tmpa_clist \x}} - \int_compare:nNnTF {\clist_count:N \g_tmpa_clist} < 2 - {\__wa_error:n {Too~small~specification~for~MultiArrow}} - {\clist_sort:Nn \g_tmpa_clist - {\int_compare:nNnTF {##1} > {##2} - {\sort_return_swapped:} - {\sort_return_same:}} - \clist_pop:NN \g_tmpa_clist \l_tmpa_tl - \clist_reverse:N \g_tmpa_clist - \clist_pop:NN \g_tmpa_clist \l_tmpb_tl - \exp_args:Nx \__wa_MultiArrow_i:n {\g_tmpa_clist} - \begin{tikzpicture}[__wa_standard,every~path/.style={WithArrows/arrow}] - \draw [<->] ([xshift = \l__wa_xoffset_dim]\l_tmpa_tl-r.south) + \int_compare:nTF { \clist_count:N \g_tmpa_clist < 2 } + { \__witharrows_error:n { Too~small~specification~for~MultiArrow } } + { + \clist_sort:Nn \g_tmpa_clist + { + \int_compare:nTF { ##1 > ##2 } + \sort_return_swapped: + \sort_return_same: + } + \clist_pop:NN \g_tmpa_clist \l_tmpa_tl + \clist_reverse:N \g_tmpa_clist + \clist_pop:NN \g_tmpa_clist \l_tmpb_tl + \exp_args:NV \__witharrows_MultiArrow_i:n \g_tmpa_clist + \begin { tikzpicture } + [ + __witharrows_standard , + every~path /.style = { WithArrows / arrow } + ] + \draw [<->] ([xshift = \l__witharrows_xoffset_dim]\l_tmpa_tl-r.south) -- ++(5mm,0) - -- node (__wa_label) {} - ([xshift = \l__wa_xoffset_dim+5mm]\l_tmpb_tl-r.south) - -- ([xshift = \l__wa_xoffset_dim]\l_tmpb_tl-r.south) ; - \tikz@parse@node \pgfutil@firstofone (__wa_label.west) - \dim_set:Nn \l_tmpa_dim {20 cm} - \path \pgfextra {\tl_gset:Nx \g_tmpa_tl \tikz@text@width} ; - \tl_if_empty:NF \g_tmpa_tl {\dim_set:Nn \l_tmpa_dim \g_tmpa_tl} - \bool_if:nT {\l__wa_wrap_lines_bool && \l__wa_in_DispWithArrows_bool} - {\dim_set:Nn \l_tmpb_dim {\g__wa_right_x_dim - \pgf@x - 0.3333 em} - \dim_compare:nNnT \l_tmpb_dim < \l_tmpa_dim - {\dim_set_eq:NN \l_tmpa_dim \l_tmpb_dim}} - \path (__wa_label.west) - node [anchor = west, text~width = \dim_use:N \l_tmpa_dim] {#2} ; - \end{tikzpicture} } } - -\cs_new_protected:Nn \__wa_MultiArrow_i:n - {\begin{tikzpicture}[__wa_standard,every~path/.style={WithArrows/arrow}] - \foreach \k in {#1} - {\draw[<-] ([xshift = \l__wa_xoffset_dim]\k-r.south) -- ++(5mm,0) ;} ; - \end{tikzpicture}} -\msg_new:nnn {witharrows} - {AllowLineWithoutAmpersand} - {The~option~"AllowLineWithoutAmpersand"~is~deprecated~because~lines~ - without~ampersands~are~now~always~allowed.~The~option~ - "AllowLineWithoutAmpersand"~will~probably~be~deleted~in~a~future~version.~ - However,~you~can~go~on~for~this~time.} -\msg_new:nnn {witharrows} - {Unknown~option} - {The~option~"\tl_use:N\l_keys_key_tl"~is~unknown~or~ - meaningless~in~the~context.~If~you~go~on,~it~will~be~ignored.} -\msg_new:nnn {witharrows} - {Third~column~in~WithArrows} - {By~default,~an~environment~\{\l__wa_type_env_tl\}~can~only~have~ - two~columns.~Maybe~you~have~forgotten~a~ - \c_backslash_str\c_backslash_str.~If~you~really~want~more~than~ - two~columns,~you~should~use~the~option~"MoreColumns"~at~a~global~ - level~or~for~ an~environment.~However,~you~can~go~one~for~ - this~time.} -\msg_new:nnn {witharrows} - {Third~column~in~DispWithArrows} - {An~environment~\{\l__wa_type_env_tl\}~can~only~have~two~columns.~ - Maybe~you~have~forgotten~a~\c_backslash_str\c_backslash_str\ at~the~end~ - of~row~\int_use:N\g__wa_line_int.~If~you~go~on,~you~may~have~other~errors.} -\msg_new:nnn {witharrows} - {Negative~value~for~jump} - {You~can't~use~a~strictly~negative~value~for~the~option~"jump"~of~command~ - \l__wa_string_Arrow_for_messages_str.~ - You~can~create~an~arrow~going~backwards~with~ the~option~"<-"~of~Tikz.} -\msg_new:nnn {witharrows} - {Too~few~lines~for~an~arrow} - {An~arrow~specified~in~line~\int_use:N \l__wa_initial_int\ can't~be~drawn~ - because~it~arrives~after~the~last~line~of~the~environment~(remind~that~ - the~command~\l__wa_string_Arrow_for_messages_str.~ - must~be~in~the~*start*~line~of~the~arrow).~ - If~you~go~on,~this~arrow~will~be~ignored.} -\msg_new:nnn {witharrows} - {WithArrows~outside~math~mode} - {The~environment~\{\l__wa_type_env_tl\}~should~be~used~only~in~math~mode.~ - Nevertheless,~you~can~go~on.} -\msg_new:nnn {witharrows} - {DispWithArrows~in~math~mode} - {The~environment~\{\l__wa_type_env_tl\}~should~be~used~only~ - outside~math~mode.~If~you~go~on,~you~will~have~other~errors.} -\msg_new:nnn {witharrows} - {Incompatible~options} - {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_arrow_int - {0 {lr} - 1 {ll} - 2 {rl} - 3 {rr} - 4 {v} - 5 {i} - 6 {groups} - 7 {group}}"~ - set~in~the~same~ - \int_case:nn\l__wa_level_int - {1 {command~\token_to_str:N\WithArrowsOptions} - 2 {declaration~of~options~of~the~environment~ - \{\l__wa_type_env_tl\}} - 3 {command~\l__wa_string_Arrow_for_messages_str}}.~ - If~you~go~on,~I~will~use~the~option~"\tl_use:N\l_keys_key_tl".} -\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} - {Arrow~in~first~column} - {You~should~not~use~the~command~\l__wa_string_Arrow_for_messages_str\ - in~the~first~column~but~only~in~the~second~column.\\ - However~you~can~go~on~for~this~time.} -\msg_new:nnn {witharrows} - {Wrong~line~in~Arrow} - {The~specification~of~line~"#1"~you~use~in~\token_to_str:N\Arrow\ - ~doesn't~exist.\\ - If~you~go~on,~the~arrow~will~be~ignored.} -\msg_new:nnn {witharrows} - {Wrong~line~specification~in~MultiArrow} - {The~specification~of~line~"#1"~doesn't~exist.\\ - If~you~go~on,~it~will~be~ignored~for~\token_to_str:N \MultiArrow.} -\msg_new:nnn {witharrows} - {Too~small~specification~for~MultiArrow} - {The~specification~of~lines~you~gave~to~\token_to_str:N \MultiArrow\ - is~too~small:~we~need~at~least~two~lines.~If~you~go~on,~the~ - command~\token_to_str:N\MultiArrow\ ~will~be~ignored.} -\msg_new:nnn {witharrows} - {tag*~without~amsmath} - {We~can't~use~\token_to_str:N\tag*~because~you~haven't~loaded~amsmath~ - (or~mathtools).~If~you~go~on,~the~command~\token_to_str:N\tag\ - will~be~used~instead.} -\msg_new:nnn {witharrows} - {Command~not~allowed~in~DispWithArrows} - {The~command~\token_to_str:N #1 - is~not~allowed~in~the~first~column~of~\{\l__wa_type_env_tl\}~but~ - only~in~the~second~column.~If~you~go~on,~this~command~will~be~ignored.} -\msg_new:nnn {witharrows} - {Command~not~allowed~in~WithArrows} - {The~command~\token_to_str:N #1 is~not~allowed~in~\{\l__wa_type_env_tl\}~ - (it's~allowed~in~the~second~column~of~\{DispWithArrows\}).~If~you~go~on, - ~this~command~will~be~ignored.} -\msg_new:nnn {witharrows} - {Multiple~tags} - {You~can't~use~twice~the~command~\token_to_str:N\tag\ - in~a~line~of~the~environment~\{\l__wa_type_env_tl\}.~If~you~go~on,~the~tag~ - '#1'~will~be~used.} -\msg_new:nnn {witharrows} - {Multiple~labels} - {Normally,~we~can't~use~the~command~\token_to_str:N\label\ - twice~in~a~line~of~the~environment~\{\l__wa_type_env_tl\}.~ - However,~you~can~go~on.~ - \bool_if:NT \c__wa_showlabels_loaded_bool - {However,~only~the~last~label~will~be~shown~by~showlabels.~} - If~you~don't~want~to~see~this~message~again,~you~can~use~the~option~ - "AllowMultipleLabels"~at~the~global~or~environment~level.} -\msg_new:nnn {witharrows} - {Multiple~labels~with~cleveref} - {Since~you~use~cleveref,~you~can't~use~the~command~\token_to_str:N\label\ - twice~in~a~line~of~the~environment~\{\l__wa_type_env_tl\}.~ - If~you~go~on,~you~may~have~undefined~references.} -\msg_new:nnn {witharrows} - {Inexistent~v-node} - {There~is~a~problem.~Maybe~you~have~put~a~command~\token_to_str:N\cr\ - instead~of~a~command~\token_to_str:N\\~at~the~end~of~ - the~row~\l_tmpa_int.~If~you~go~on,~you~may~have~an~incorrect~output.} -\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~" - \int_compare:nNnTF \l__wa_pos_arrow_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.} -\coffin_new:N \l__wa_halign_coffin -\NewDocumentEnvironment {CasesWithArrows} {m !O{}} - {\hbox_set:Nn \l_tmpa_box {$\left\{\vcenter to 1cm {} \right.$} - \dim_zero_new:N \l__wa_delim_wd_dim - \dim_set:Nn \l__wa_delim_wd_dim {\box_wd:N \l_tmpa_box} - \box_clear_new:N \l__wa_left_part_box - \hbox_set:Nn \l__wa_left_part_box - {$\bool_if:NT \l__wa_displaystyle_bool \displaystyle #1 {}$} - \bool_if:nT \c__wa_mathtools_loaded_bool - {\MH_if_boolean:nT {show_only_refs} - {\MT_showonlyrefs_false: - \MH_set_boolean_T:n {show_only_refs} - \clist_set:Nn \l__wa_tags_clist {all}}} - \bool_if:NT \c__wa_amsmath_loaded_bool \intertext@ - \if_mode_math: - \__wa_error:n {DispWithArrows~in~math~mode} - \fi: - \bool_set_true:N \l__wa_in_DispWithArrows_bool - % - \__wa_pre_environment:n {#2} - \nointerlineskip - \hbox_to_wd:nn {0.6\linewidth} {} - $$ - \spread@equation - \vcoffin_set:Nnw \l__wa_halign_coffin \displaywidth - \bool_if:NTF \l__wa_fleqn_bool - {\tabskip = \c_zero_skip} - {\tabskip = 0 pt plus 1000 pt minus 1000 pt} - \bool_if:NTF \c__wa_amsmath_loaded_bool - {\cs_set_eq:NN \__wa_old_label \ltx@label} - {\cs_set_eq:NN \__wa_old_label \label} - \halign to \displaywidth \bgroup - \int_gincr:N \g__wa_line_int - \cs_set_eq:cN \l__wa_CommandName_str \__wa_Arrow_first_column: - \bool_set_true:N \l__wa_in_first_column_bool - \bool_if:NT \l__wa_fleqn_bool - {\skip_horizontal:n \l__wa_mathindent_dim} - \hfil - \skip_horizontal:n {\box_wd:N \l__wa_left_part_box + \l__wa_delim_wd_dim} - $\bool_if:NT \l__wa_displaystyle_bool \displaystyle {##}$ - \tabskip = \c_zero_skip - & - \clist_if_in:NVT \l__wa_tags_clist \g__wa_line_int - {\clist_set:Nn \l__wa_tags_clist {all}} - \cs_set:Npn \notag {\clist_clear:N \l__wa_tags_clist} - $\bool_if:NT \l__wa_displaystyle_bool \displaystyle {{}##}$ - \tabskip = 0 pt plus 1000 pt minus 1000 pt - \tikz [remember~picture,overlay] - \node [__wa_node_style, - name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-l, - alias = {\tl_if_empty:NF \l__wa_name_tl - {\l__wa_name_tl-\int_use:N\g__wa_line_int-l}} ] {} ; - \hfil - \tikz [remember~picture,overlay] - \node [__wa_node_style, - name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-r, - alias = {\tl_if_empty:NF \l__wa_name_tl - {\l__wa_name_tl-\int_use:N\g__wa_line_int-r}} ] {} ; - \bool_if:NT \l__wa_shownodenames_bool - {\hbox_overlap_right:n {\small wa-\l__wa_prefix_str - -\int_use:N\g__wa_line_int}} - & ## - \tabskip = \c_zero_skip - && \__wa_error:n {Third~column~in~DispWithArrows} - \if_false: ## \fi: - \cr} - {\clist_if_in:NnT \l__wa_tags_clist {last} - {\clist_set:Nn \l__wa_tags_clist {all}} - \\ - \egroup - \unskip\unpenalty\unskip\unpenalty - \box_set_to_last:N \l_tmpa_box - \nointerlineskip - \box_use:N \l_tmpa_box - \dim_gzero_new:N \g__wa_alignment_dim - \dim_gset:Nn \g__wa_alignment_dim {\box_wd:N \l_tmpa_box} - \box_clear_new:N \l__wa_new_box - \hbox_set:Nn \l__wa_new_box {\hbox_unpack_clear:N \l_tmpa_box} - \dim_compare:nNnT {\box_wd:N \l__wa_new_box} < \g__wa_alignment_dim - {\dim_gset:Nn \g__wa_alignment_dim {\box_wd:N \l__wa_new_box}} - \vcoffin_set_end: - \hbox_to_wd:nn \displaywidth + -- node (__witharrows_label) {} + ([xshift = \l__witharrows_xoffset_dim+5mm]\l_tmpb_tl-r.south) + -- ([xshift = \l__witharrows_xoffset_dim]\l_tmpb_tl-r.south) ; + \tikz@parse@node \pgfutil@firstofone (__witharrows_label.west) + \dim_set:Nn \l_tmpa_dim { 20 cm } + \path \pgfextra { \tl_gset:Nx \g_tmpa_tl \tikz@text@width } ; + \tl_if_empty:NF \g_tmpa_tl { \dim_set:Nn \l_tmpa_dim \g_tmpa_tl } + \bool_if:nT { \l__witharrows_wrap_lines_bool && \l__witharrows_in_DispWithArrows_bool } { - \bool_if:NTF \l__wa_fleqn_bool - {\skip_horizontal:n \l__wa_mathindent_dim} - {\hfil} - \hbox_to_wd:nn \g__wa_alignment_dim - { \box_use_drop:N \l__wa_left_part_box - \dim_set:Nn \l_tmpa_dim { \box_ht:N \l__wa_halign_coffin - + \box_dp:N \l__wa_halign_coffin} - $\left\{ \vcenter to \l_tmpa_dim {\vfil} \right.$} - \hfil} - \coffin_typeset:Nnnnn - \l__wa_halign_coffin {l} {vc} {-\displaywidth} \c_zero_dim - $$ - \__wa_post_environment: - \bool_if:nT \c__wa_mathtools_loaded_bool - {\MH_if_boolean:nT {show_only_refs} - \MT_showonlyrefs_true:} - \bool_if:NT \g__wa_footnote_bool \endsavenotes - \ignorespacesafterend + \dim_set:Nn \l_tmpb_dim + { \g__witharrows_right_x_dim - \pgf@x - 0.3333 em } + \dim_compare:nNnT \l_tmpb_dim < \l_tmpa_dim + { \dim_set_eq:NN \l_tmpa_dim \l_tmpb_dim } + } + \path (__witharrows_label.west) + node [ anchor = west, text~width = \dim_use:N \l_tmpa_dim ] { #2 } ; + \end{tikzpicture} + } + } +\cs_new_protected:Nn \__witharrows_MultiArrow_i:n + { + \begin {tikzpicture } + [ + __witharrows_standard , + every~path / .style = { WithArrows / arrow } + ] + \foreach \k in { #1 } + { + \draw [ <- ] + ( [xshift = \l__witharrows_xoffset_dim]\k-r.south ) -- ++(5mm,0) ; + } ; + \end { tikzpicture } + } +\str_const:Nn \c__witharrows_option_ignored_str + { If~you~go~on,~this~option~will~be~ignored. } +\__witharrows_msg_new:nn { Value~for~a~key } + { + The~key~'\l_keys_key_tl'~should~be~used~without~value. \\ + However,~you~can~go~on~for~this~time. + } +\__witharrows_msg_new:nnn { Unknown~option~in~Arrow } + { + The~option~'\l_keys_key_tl'~ + is~unknown~for~the~command~\l__witharrows_string_Arrow_for_msg_str\ + in~the~row~\int_use:N \g__witharrows_line_int\ + of~your~environment~\{\l__witharrows_type_env_str\}. \\ + \c__witharrows_option_ignored_str \\ + For~a~list~of~the~available~keys,~type~H~<return>. + } + { + The~available~keys~are~(in~alphabetic~order):~ + \seq_use:Nnnn \l__witharrows_options_Arrow_seq {~and~} {,~} {~and~}. + } +\__witharrows_msg_new:nnn { Unknown~option~WithArrows } + { + The~option~'\l_keys_key_tl'~is~unknown~in~\{\l__witharrows_type_env_str\}. \\ + \c__witharrows_option_ignored_str \\ + For~a~list~of~the~available~keys,~type~H~<return>. + } + { + The~available~keys~are~(in~alphabetic~order):~ + \seq_use:Nnnn \l__witharrows_options_WithArrows_seq {~and~} {,~} {~and~}. + } +\__witharrows_msg_new:nnn { Unknown~option~DispWithArrows } + { + The~option~'\l_keys_key_tl'~is~unknown~in~\{\l__witharrows_type_env_str\}. \\ + \c__witharrows_option_ignored_str \\ + For~a~list~of~the~available~keys,~type~H~<return>. + } + { + The~available~keys~are~(in~alphabetic~order):~ + \seq_use:Nnnn \l__witharrows_options_DispWithArrows_seq {~and~} {,~} {~and~}. + } +\__witharrows_msg_new:nnn { Unknown~option~WithArrowsOptions } + { + The~option~'\l_keys_key_tl'~is~unknown~in~ + \token_to_str:N \WithArrowsOptions. \\ + \c__witharrows_option_ignored_str \\ + For~a~list~of~the~available~keys,~type~H~<return>. + } + { + The~available~keys~are~(in~alphabetic~order):~ + \seq_use:Nnnn \l__witharrows_options_WithArrowsOptions_seq {~and~} {,~} {~and~}. + } +\__witharrows_msg_new:nnn { Unknown~option~Arrow~in~CodeAfter } + { + The~option~'\l_keys_key_tl'~is~unknown~in~ + \token_to_str:N \Arrow\ + in~\token_to_str:N \CodeAfter. \\ + \c__witharrows_option_ignored_str \\ + For~a~list~of~the~available~keys,~type~H~<return>. + } + { + The~available~keys~are~(in~alphabetic~order):~ + \seq_use:Nnnn \l__witharrows_options_Arrow_CodeAfter_seq {~and~} {,~} {~and~}. + } +\__witharrows_msg_new:nn { Third~column~in~WithArrows } + { + By~default,~an~environment~\{\l__witharrows_type_env_str\}~can~only~have~ + two~columns.~Maybe~you~have~forgotten~a~ + \c_backslash_str\c_backslash_str.~If~you~really~want~more~than~ + two~columns,~you~should~use~the~option~'more-columns'~at~a~global~ + level~or~for~an~environment. \\ + However,~you~can~go~one~for~this~time. + } +\__witharrows_msg_new:nn { Third~column~in~DispWithArrows } + { + An~environment~\{\l__witharrows_type_env_str\}~can~only~have~two~columns.~ + Maybe~you~have~forgotten~a~\c_backslash_str\c_backslash_str\ + at~the~end~of~row~\int_use:N \g__witharrows_line_int. \\ + If~you~go~on,~you~may~have~other~errors. + } +\__witharrows_msg_new:nn { Negative~jump } + { + You~can't~use~a~negative~value~for~the~option~'jump'~of~command~ + \l__witharrows_string_Arrow_for_msg_str\ + in~the~row~\int_use:N \g__witharrows_line_int\ + of~your~environment~\{\l__witharrows_type_env_str\}.~ + You~can~create~an~arrow~going~backwards~with~the~option~'<-'~of~Tikz. \\ + \c__witharrows_option_ignored_str + } +\__witharrows_msg_new:nn { new-group~without~groups } + { + You~can't~use~the~option~'new-group'~for~the~command~ + \l__witharrows_string_Arrow_for_msg_str\ + because~you~are~not~in~'groups'~mode.~Try~to~use~the~option~ + 'groups'~in~your~environment~\{\l__witharrows_type_env_str\}. \\ + \c__witharrows_option_ignored_str + } +\__witharrows_msg_new:nn + { 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\ + 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 { WithArrows~outside~math~mode } + { + The~environment~\{\l__witharrows_type_env_str\}~should~be~used~only~in~math~mode. \\ + Nevertheless,~you~can~go~on. + } +\__witharrows_msg_new:nn { DispWithArrows~in~math~mode } + { + The~environment~\{\l__witharrows_type_env_str\}~should~be~used~only~ + outside~math~mode. \\ + If~you~go~on,~you~will~have~other~errors. + } +\__witharrows_msg_new:nn { Incompatible~options~in~Arrow } + { + You~try~to~use~the~option~'\l_keys_key_tl'~but~ + this~option~is~incompatible~or~redundant~with~the~option~ + '\l__witharrows_previous_key_str'~set~in~the~same~command~ + \l__witharrows_string_Arrow_for_msg_str. \\ + \c__witharrows_option_ignored_str + } +\__witharrows_msg_new:nn { Incompatible~options } + { You~try~to~use~the~option~'\l_keys_key_tl'~but~ + this~option~is~incompatible~or~redundant~with~the~option~ + '\l__witharrows_previous_key_str'~set~in~the~same~command~ + \bool_if:NT \l__witharrows_in_CodeAfter_bool + { + \l__witharrows_string_Arrow_for_msg_str\ + in~the~CodeAfter~of~your~environment~\{\l__witharrows_type_env_str\} + }. \\ + \c__witharrows_option_ignored_str + } +\__witharrows_msg_new:nn { Arrow~in~first~column } + { + You~should~not~use~the~command~\l__witharrows_string_Arrow_for_msg_str\ + in~the~first~column~of~your~environment~\{\l__witharrows_type_env_str\}~ + but~only~in~the~second~column. \\ + However~you~can~go~on~for~this~time. + } +\__witharrows_msg_new:nn { Wrong~line~in~Arrow } + { + The~specification~of~line~'#1'~you~use~in~the~command~ + \l__witharrows_string_Arrow_for_msg_str\ + in~the~'CodeAfter'~of~\{\l__witharrows_type_env_str\}~doesn't~exist. \\ + If~you~go~on,~this~command~will~be~ignored. + } +\__witharrows_msg_new:nn { Both~lines~are~equal } + { + In~the~'CodeAfter'~of~\{\l__witharrows_type_env_str\}~you~try~to~ + draw~an~arrow~going~to~it~self~from~the~line~'#1'.~This~is~not~possible. \\ + If~you~go~on,~this~command~will~be~ignored. + } +\__witharrows_msg_new:nn { Wrong~line~specification~in~MultiArrow } + { + The~specification~of~line~'#1'~doesn't~exist. \\ + If~you~go~on,~it~will~be~ignored~for~\token_to_str:N \MultiArrow. + } +\__witharrows_msg_new:nn { Too~small~specification~for~MultiArrow } + { + The~specification~of~lines~you~gave~to~\token_to_str:N \MultiArrow\ + is~too~small:~you~need~at~least~two~lines. \\ + If~you~go~on,~this~command~will~be~ignored. + } +\__witharrows_msg_new:nn { tag*~without~amsmath } + { + We~can't~use~\token_to_str:N\tag*~because~you~haven't~loaded~amsmath~ + (or~mathtools). \\ + If~you~go~on,~the~command~\token_to_str:N\tag\ + will~be~used~instead. + } +\__witharrows_msg_new:nn { Not~allowed~in~DispWithArrows } + { + The~command~\token_to_str:N #1 + is~not~allowed~in~the~first~column~of~\{\l__witharrows_type_env_str\}~but~ + only~in~the~second~column. \\ + If~you~go~on,~this~command~will~be~ignored. + } +\__witharrows_msg_new:nn { Not~allowed~in~WithArrows } + { + The~command~\token_to_str:N #1 is~not~allowed~in~\{\l__witharrows_type_env_str\}~ + (it's~allowed~in~the~second~column~of~\{DispWithArrows\}). \\ + If~you~go~on,~this~command~will~be~ignored. + } +\__witharrows_msg_new:nn { Multiple~tags } + { + You~can't~use~twice~the~command~\token_to_str:N\tag\ + in~a~line~of~the~environment~\{\l__witharrows_type_env_str\}. \\ + If~you~go~on,~the~tag~'#1'~will~be~used. + } +\__witharrows_msg_new:nn { Multiple~labels } + { + Normally,~we~can't~use~the~command~\token_to_str:N\label\ + twice~in~a~line~of~the~environment~\{\l__witharrows_type_env_str\}. \\ + However,~you~can~go~on.~ + \bool_if:NT \c__witharrows_showlabels_loaded_bool + { However,~only~the~last~label~will~be~shown~by~showlabels.~ } + If~you~don't~want~to~see~this~message~again,~you~can~use~the~option~ + 'allow-multiple-labels'~at~the~global~or~environment~level. + } +\__witharrows_msg_new:nn { Multiple~labels~with~cleveref } + { + Since~you~use~cleveref,~you~can't~use~the~command~\token_to_str:N\label\ + twice~in~a~line~of~the~environment~\{\l__witharrows_type_env_str\}. \\ + If~you~go~on,~you~may~have~undefined~references. + } +\__witharrows_msg_new:nn { Inexistent~v-node } + { + There~is~a~problem.~Maybe~you~have~put~a~command~\token_to_str:N\cr\ + instead~of~a~command~\token_to_str:N\\~at~the~end~of~ + the~row~\int_use:N \l_tmpa_int\ + of~your~environment~\{\l__witharrows_type_env_str\}. \\ + If~you~go~on,~you~may~have~an~incorrect~output. + } +\__witharrows_msg_new:nn { Option~xoffset~forbidden } + { You~can't~use~the~option~'xoffset'~in~the~command~ + \l__witharrows_string_Arrow_for_msg_str\ + while~you~are~using~the~option~ + ' \int_compare:nNnTF \l__witharrows_pos_arrow_int = 7 + { group } + { groups } '. \\ + \c__witharrows_option_ignored_str + } +\NewDocumentCommand \WithArrowsNewStyle { m m } + { + \keys_if_exist:nnTF { WithArrows / WithArrows } { #1 } + { \__witharrows_error:nn { Key~already~defined } { #1 } } + { + \keys_define:nn { WithArrows / WithArrows } + { + #1 .code:n = + { + \keys_define:nn { WithArrows / WithArrows } + { unknown .code:n = \prg_do_nothing: } + \keys_set:nn { WithArrows / WithArrows } { #2 } + \keys_define:nn { WithArrows / WithArrows } + { unknown .code:n = + \__witharrows_error:n { Unknown~option~WithArrows }} + } } -\NewDocumentCommand \WithArrowsNewStyle {mm} - { \keys_if_exist:nnTF {WithArrows/General} {#1} - {\__wa_error:nn {Key~already~defined} {#1}} - {\keys_define:nn {WithArrows/General} - {#1 .code:n = {\int_compare:nNnTF \l__wa_level_int < 3 - {\bool_set_eq:NN \l_tmpa_bool \l__wa_in_WithArrows_bool - \bool_set_eq:NN \l_tmpb_bool \l__wa_in_DispWithArrows_bool - \bool_set_false:N \l__wa_in_WithArrows_bool - \bool_set_false:N \l__wa_in_DispWithArrows_bool - \keys_set_known:nnN {WithArrows/General} {#2} \l_tmpa_tl - \keys_set_known:nVN {WithArrows/GlobalOrEnv} - \l_tmpa_tl \l_tmpb_tl - \bool_set_eq:NN \l__wa_in_WithArrows_bool \l_tmpa_bool - \bool_set_eq:NN \l__wa_in_DispWithArrows_bool \l_tmpb_bool} - {\__wa_error:n {Unknown~option}}}} - \group_begin: - \msg_set:nnn {witharrows} - {Option~will~be~ignored} - {The~option~"\tl_use:N\l_keys_key_tl"~is~unknown~or~can't~be~ - used~in~\token_to_str:N\WithArrowsNewStyle.~If~you~go~on,~ - this~option~will~be~ignored~in~the~definition~of~style~'#1'.} - \msg_set:nnn {witharrows} - {Unknown~option} - {The~option~"\tl_use:N\l_keys_key_tl"~is~unknown.~If~you~go~on,~ - this~option~will~be~ignored~in~the~definition~of~style~'#1'.} - \WithArrowsOptions{#2} - \group_end:} } -\msg_new:nnn {witharrows} - {Key~already~defined} - {The~key~'#1'~is~already~defined.~If~you~go~on,~ - your~instruction~\token_to_str:N\WithArrowsNewStyle\ will~be~ignored.} -\tl_set:Nn \c__wa_tikz_code_up_tl - {\draw[rounded~corners] - let \p1 = (#1), - \p2 = (#2) - in (\p1) -- node {\dim_set:Nn \l_tmpa_dim {\x2-\x1} - \begin{varwidth}\l_tmpa_dim - \raggedright - #3 - \end{varwidth}} - (\x2,\y1) -- (\p2) ;} -\tl_set:Nn \c__wa_tikz_code_down_tl - {\draw[rounded~corners] - let \p1 = (#1), - \p2 = (#2) - in (\p1) -- (\x1,\y2) -- - node {\dim_set:Nn \l_tmpa_dim {\x1-\x2} - \begin{varwidth}\l_tmpa_dim + \seq_put_right:Nn \l__witharrows_options_WithArrows_seq {#1} + \keys_define:nn { WithArrows / DispWithArrows } + { + #1 .code:n = + { + \keys_define:nn { WithArrows / DispWithArrows } + { unknown .code:n = \prg_do_nothing: } + \keys_set:nn { WithArrows / DispWithArrows } { #2 } + \keys_define:nn {WithArrows / DispWithArrows } + { unknown .code:n = + \__witharrows_error:n { Unknown~option~DispWithArrows }} + } + } + \seq_put_right:Nn \l__witharrows_options_DispWithArrows_seq { #1 } + \keys_define:nn { WithArrows / WithArrowsOptions } + { + #1 .code:n = + { \keys_set:nn { WithArrows / WithArrowsOptions } { #2 } } + } + \seq_put_right:Nn \l__witharrows_options_WithArrowsOptions_seq { #1 } + \group_begin: + \msg_set:nnn { witharrows } { Unknown~option~WithArrowsOptions } + { + The~option~'\l_keys_key_tl'~can't~be~set~in~the~ + definition~of~a~style. \\ + If~you~go~on,~this~key~will~not~be~written~in~the~style~'#1'. + } + \WithArrowsOptions { #2 } + \group_end: + } + } +\__witharrows_msg_new:nn { Key~already~defined } + { + The~key~'#1'~is~already~defined. \\ + If~you~go~on,~your~instruction~\token_to_str:N\WithArrowsNewStyle\ + will~be~ignored. + } +\tl_const:Nn \c__witharrows_tikz_code_up_tl + { + \draw [ rounded~corners ] + let \p1 = (#1) , + \p2 = (#2) + in (\p1) -- node { + \dim_set:Nn \l_tmpa_dim { \x2 - \x1 } + \begin { varwidth } \l_tmpa_dim \raggedright - #3 - \end{varwidth}} - (\p2) ;} -\keys_define:nn {WithArrows/General} - {up .value_forbidden:n = true, - up .code:n = {\int_compare:nNnTF \l__wa_level_int = 3 - {\bool_if:NTF \c__wa_varwidth_loaded_bool - {\cs_if_exist:cTF {tikz@library@calc@loaded} - {\int_set:Nn \l__wa_pos_arrow_int 1 - \bool_set_false:N \l__wa_wrap_lines_bool - \tl_set_eq:NN \l__wa_tikz_code_tl \c__wa_tikz_code_up_tl} - {\__wa_error:n {calc~not~loaded}}} - {\__wa_error:n {varwidth~not~loaded}}} - {\__wa_error:n {Unknown~option}}}, - down .value_forbidden:n = true, - down .code:n = {\int_compare:nNnTF \l__wa_level_int = 3 - {\bool_if:NTF \c__wa_varwidth_loaded_bool - {\cs_if_exist:cTF {tikz@library@calc@loaded} - {\int_set:Nn \l__wa_pos_arrow_int 1 - \bool_set_false:N \l__wa_wrap_lines_bool - \tl_set_eq:NN \l__wa_tikz_code_tl \c__wa_tikz_code_down_tl} - {\__wa_error:n {calc~not~loaded}}} - {\__wa_error:n {varwidth~not~loaded}}} - {\__wa_error:n {Unknown~option}}}} -\msg_new:nnn {witharrows} - {varwidth~not~loaded} - {You~can't~use~the~option~"\l_keys_key_tl"~because~ - you~don't~have~loaded~the~package~ - varwidth.~If~you~go~on,~this~option~will~be~forgotten.} -\msg_new:nnn {witharrows} - {calc~not~loaded} - {You~can't~use~the~option~"\l_keys_key_tl"~because~you~don't~have~loaded~the~ - Tikz~library~calc.You~should~add~"\token_to_str:N\usetikzlibrary{calc}" - ~in~your~preamble.~ - ~If~you~go~on,~this~option~will~be~forgotten.} + #3 + \end { varwidth } + } + (\x2,\y1) -- (\p2) ; + } +\tl_const:Nn \c__witharrows_tikz_code_down_tl + { + \draw [ rounded~corners ] + let \p1 = (#1) , + \p2 = (#2) + in (\p1) -- (\x1,\y2) -- + node { + \dim_set:Nn \l_tmpa_dim { \x1 - \x2 } + \begin { varwidth } \l_tmpa_dim + \raggedright + #3 + \end { varwidth } + } + (\p2) ; + } +\keys_define:nn { WithArrows / Arrow / FirstPass } + { + up .code:n = \__witharrows_set_independent: , + down .code:n = \__witharrows_set_independent: , + up .default:n = NoValue , + down .default:n = NoValue + } +\keys_define:nn { WithArrows / Arrow / SecondPass } + { + up .code:n = \str_if_empty:NT \l__witharrows_previous_key_str + { + \str_set:Nn \l__witharrows_previous_key_str { up } + \bool_if:NTF \c__witharrows_varwidth_loaded_bool + { + \cs_if_exist:cTF { tikz@library@calc@loaded } + { + \int_set:Nn \l__witharrows_pos_arrow_int \c_one_int + \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 } } + } + { \__witharrows_error:n { varwidth~not~loaded } } + } , + down .code:n = \str_if_empty:NT \l__witharrows_previous_key_str + { + \str_set:Nn \l__witharrows_previous_key_str { down } + \bool_if:NTF \c__witharrows_varwidth_loaded_bool + { + \cs_if_exist:cTF { tikz@library@calc@loaded } + { + \int_set:Nn \l__witharrows_pos_arrow_int \c_one_int + \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 } } + } + { \__witharrows_error:n { varwidth~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_tl'~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_tl'~because~you~don't~have~loaded~the~ + Tikz~library~'calc'.You~should~add~'\token_to_str:N\usetikzlibrary{calc}' + ~in~your~preamble. \\ + \c__witharrows_option_ignored_str + } \endinput %% %% End of file `witharrows.sty'. |