diff options
author | Karl Berry <karl@freefriends.org> | 2020-04-12 22:27:59 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-04-12 22:27:59 +0000 |
commit | f337ef24d0b836a2f13b8fc1648525ca3122632c (patch) | |
tree | 7f5dcac80cd5c4d99d95c370c7a733dee7586111 /Master/texmf-dist/tex/generic | |
parent | d8c63106e29c1e5d9d31f49233bfda0fa449b577 (diff) |
witharrows (31mar20)
git-svn-id: svn://tug.org/texlive/trunk@54707 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic')
-rw-r--r-- | Master/texmf-dist/tex/generic/witharrows/witharrows.sty | 296 |
1 files changed, 178 insertions, 118 deletions
diff --git a/Master/texmf-dist/tex/generic/witharrows/witharrows.sty b/Master/texmf-dist/tex/generic/witharrows/witharrows.sty index 80edc3d2ab6..2798b9ff33f 100644 --- a/Master/texmf-dist/tex/generic/witharrows/witharrows.sty +++ b/Master/texmf-dist/tex/generic/witharrows/witharrows.sty @@ -18,10 +18,10 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -\def\myfileversion{2.3} -\def\myfiledate{2019/12/27} +\def\myfileversion{2.4} +\def\myfiledate{2020/03/31} \RequirePackage{tikz} -\RequirePackage{expl3}[2019/07/01] +\RequirePackage{expl3}[2020/02/08] \usetikzlibrary{arrows.meta,bending} \RequirePackage{l3keys2e} \ProvidesExplPackage @@ -29,6 +29,14 @@ {\myfiledate} {\myfileversion} {Draws arrows for explanations on the right} +\msg_new:nnn { witharrows } { expl3~too~old } + { + Your~version~of~LaTeX~(especially~expl3)~is~too~old.~ + You~can~go~on~but~you~will~probably~have~other~errors~ + if~you~use~the~functionalities~of~witharrows. + } +\cs_if_exist:NF \l_keys_key_str + { \msg_error:nn { witharrows } { expl3~too~old } } \RequirePackage { xparse } [ 2019-01-01 ] \bool_new:N \g__witharrows_footnotehyper_bool \bool_new:N \g__witharrows_footnote_bool @@ -50,14 +58,14 @@ } \__witharrows_msg_new:nn { Option~unknown~for~package } { - You~can't~use~the~option~'\l_keys_key_tl'~when~loading~the~ + You~can't~use~the~option~'\l_keys_key_str'~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~ + The~option~'\l_keys_key_str'\ is~incompatible~ with~Beamer~because~Beamer~has~its~own~system~to~extract~footnotes. } \__witharrows_msg_new:nn { footnote~with~footnotehyper~package } @@ -286,7 +294,7 @@ { \str_if_empty:NTF \l__witharrows_previous_key_str { - \str_set_eq:NN \l__witharrows_previous_key_str \l_keys_key_tl + \str_set_eq:NN \l__witharrows_previous_key_str \l_keys_key_str #1 } { \__witharrows_error:n { Incompatible~options } } @@ -300,18 +308,21 @@ max-length-of-arrow .initial:n = 2 cm , ygap .dim_set:N = \l__witharrows_ygap_dim , ygap .initial:n = 0.4 ex , + ygap .value_required:n = true , 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 { Too~much~columns~in~WithArrows } { none } , + more-columns .value_forbidden:n = true , command-name .code:n = \str_set:Nn \l__witharrows_command_name_str { #1 } \str_set:Nx \l__witharrows_string_Arrow_for_msg_str { \c_backslash_str Arrow~alias~\c_backslash_str #1 } , + command-name .value_required:n = true , tikz-code .tl_set:N = \l__witharrows_tikz_code_tl, tikz-code .initial:n = \draw~(#1)~to~node{#3}~(#2)~; , - TikzCode .meta:n = { tikz-code = #1 } , + tikz-code .value_required:n = true , displaystyle .bool_set:N = \l__witharrows_displaystyle_bool , displaystyle .default:n = true , show-nodes .code:n = @@ -326,6 +337,7 @@ \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 { @@ -336,32 +348,49 @@ \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 .code:n = \__witharrows_fix_pos_option:n 3 , + rr .value_forbidden:n = true , ll .code:n = \__witharrows_fix_pos_option:n 1 , + ll .value_forbidden:n = true , rl .code:n = \__witharrows_fix_pos_option:n 2 , + rl .value_forbidden:n = true , lr .code:n = \__witharrows_fix_pos_option:n 0 , + lr .value_forbidden:n = true , i .code:n = \__witharrows_fix_pos_option:n 5 , + i .value_forbidden:n = true , xoffset .dim_set:N = \l__witharrows_xoffset_dim , + xoffset .value_required:n = true , xoffset .initial:n = 3 mm , jot .dim_set:N = \jot , + jot .value_required:n = true , interline .skip_set:N = \l__witharrows_interline_skip , start-adjust .dim_set:N = \l__witharrows_start_adjust_dim , start-adjust .initial:n = 0.4 ex , + start-adjust .value_required:n = true , end-adjust .dim_set:N = \l__witharrows_end_adjust_dim , end-adjust .initial:n = 0.4 ex , + end-adjust .value_required:n = true , adjust .meta:n = { start-adjust = #1 , end-adjust = #1 } , + adjust .value_required:n = true , up-and-down .code:n = \keys_set:nn { WithArrows / up-and-down } { #1 } , + up-and-down .value_required:n = true , no-arrows .code:n = \cs_set_eq:NN \__witharrows_draw_arrows:nn \use_none:nn \cs_set_eq:NN \__witharrows_draw_arrow:nnn \use_none:nnn , + no-arrows .value_forbidden:n = true } \keys_define:nn { WithArrows / WithArrowsSpecific } { t .code:n = \int_set:Nn \l__witharrows_pos_env_int O , + 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 } \clist_new:N \c__witharrows_extensible_delimiters_clist \clist_set:Nn \c__witharrows_extensible_delimiters_clist @@ -370,8 +399,9 @@ } \AtBeginDocument { - \bool_if:nT - { \c__witharrows_amsmath_loaded_bool || \use:c { c__witharrows_unicode-math_loaded_bool } } + \bool_lazy_or:nnT + \c__witharrows_amsmath_loaded_bool + { \use:c { c__witharrows_unicode-math_loaded_bool } } { \clist_put_right:Nn \c__witharrows_extensible_delimiters_clist { \lvert, \lVert } } @@ -382,6 +412,7 @@ fleqn .default:n = true , mathindent .dim_set:N = \l__witharrows_mathindent_dim , mathindent .initial:n = 25 pt , + mathindent .value_required:n = true , notag .code:n = \str_if_eq:nnTF { #1 } { true } { \clist_clear:N \l__witharrows_tags_clist } @@ -398,16 +429,19 @@ \group_end: } , subequations .default:n = true , + subequations .value_forbidden: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 , 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 + \clist_put_left:Nn \l__witharrows_tags_clist 1 } , + tagged-lines .value_required:n = true , wrap-lines .bool_set:N = \l__witharrows_wrap_lines_bool , wrap-lines .default:n = true , replace-left-brace-by .code:n = @@ -421,7 +455,7 @@ } , replace-left-brace-by .initial:n = \lbrace , standard-behaviour-with-items .bool_set:N = \l__witharrows_sbwi_bool , - standard-behaviour-with-items .default:n = true , + standard-behaviour-with-items .default:n = true } \keys_define:nn { WithArrows / Env } { @@ -431,9 +465,12 @@ { \__witharrows_error:n { Duplicate~name } } { \seq_gput_left:NV \g__witharrows_names_seq \l_tmpa_str } \str_set_eq:NN \l__witharrows_name_str \l_tmpa_str , + name .value_required:n = true , code-before .code:n = \tl_put_right:Nn \l__witharrows_code_before_tl { #1 } , + code-before .value_required:n = true, CodeBefore .meta:n = { code-before = #1 } , code-after .code:n = \tl_put_right:Nn \l__witharrows_code_after_tl { #1 } , + code-after .value_required:n = true , CodeAfter .meta:n = { code-after = #1 } , format .code:n = \tl_if_empty:nTF { #1 } @@ -443,10 +480,7 @@ { \tl_set:Nn \l__witharrows_format_str { #1 } } { \__witharrows_error:n { Invalid~option~format } } } , - code-before .value_required:n = true, - code-after .value_required:n = true , - name .value_required:n = true , - format .value_required:n = true , + format .value_required:n = true } \keys_define:nn { WithArrows } { @@ -539,7 +573,7 @@ { \str_if_empty:NTF \l__witharrows_previous_key_str { - \str_set_eq:NN \l__witharrows_previous_key_str \l_keys_key_tl + \str_set_eq:NN \l__witharrows_previous_key_str \l_keys_key_str \str_set:Nn \l__witharrows_status_arrow_str { independent } } { \__witharrows_error:n { Incompatible~options~in~Arrow } } @@ -579,7 +613,7 @@ xoffset .code:n = , unknown .code:n = \__witharrows_sort_seq:N \l__witharrows_options_Arrow_seq - \seq_if_in:NVTF \l__witharrows_options_WithArrows_seq \l_keys_key_tl + \seq_if_in:NVTF \l__witharrows_options_WithArrows_seq \l_keys_key_str { \str_set:Nn \l_tmpa_str { ~However,~this~key~can~be~used~in~the~options~of~{WithArrows}. } @@ -597,7 +631,7 @@ { \str_if_empty:NT \l__witharrows_previous_key_str { - \str_set_eq:NN \l__witharrows_previous_key_str \l_keys_key_tl + \str_set_eq:NN \l__witharrows_previous_key_str \l_keys_key_str \int_set:Nn \l__witharrows_pos_arrow_int { #1 } } } @@ -685,7 +719,7 @@ \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 + \int_set:Nn \l__witharrows_jump_int 1 \str_set:Nn \l__witharrows_format_str { rl } \seq_clear_new:N \l__witharrows_labels_seq \bool_set_false:N \l__witharrows_tag_next_line_bool @@ -704,7 +738,6 @@ \seq_set_split:NnV \l__witharrows_format_seq { } \l__witharrows_format_str \bool_if:NT \g__witharrows_footnote_bool { \begin { savenotes } } \l__witharrows_code_before_tl - \spread@equation \cs_set_eq:NN \notag \__witharrows_notag: \cs_set_eq:NN \nonumber \__witharrows_nonumber: \cs_set_eq:NN \tag \__witharrows_tag @@ -817,6 +850,7 @@ \fi: \int_case:nn \l__witharrows_pos_env_int { 0 \vtop 1 \vcenter 2 \vbox } \bgroup + \spread@equation \__witharrows_construct_halign: && \__witharrows_error:n { Too~much~columns~in~WithArrows } @@ -943,16 +977,24 @@ { \bool_if:NF \c__witharrows_leqno_bool { - \tikz [ __witharrows_standard ] - \coordinate ( \int_use:N \g__witharrows_line_int - v ) ; + \pgfpicture + \pgfrememberpicturepositiononpagetrue + \pgfcoordinate + { wa - \l__witharrows_prefix_str - \int_use:N \g__witharrows_line_int - v } + \pgfpointorigin + \endpgfpicture } \quad \@eqnnum } \bool_if:NT \c__witharrows_leqno_bool { - \tikz [ __witharrows_standard ] - \coordinate ( \int_use:N \g__witharrows_line_int - v ) ; + \pgfpicture + \pgfrememberpicturepositiononpagetrue + \pgfcoordinate + { wa - \l__witharrows_prefix_str - \int_use:N \g__witharrows_line_int - v } + \pgfpointorigin + \endpgfpicture } } { @@ -961,8 +1003,12 @@ \__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 ) ; + \pgfpicture + \pgfrememberpicturepositiononpagetrue + \pgfcoordinate + { wa - \l__witharrows_prefix_str - \int_use:N \g__witharrows_line_int - v } + \pgfpointorigin + \endpgfpicture } } \dim_compare:nNnT { #1 } < \c_zero_dim @@ -972,7 +1018,8 @@ \noalign { \dim_set:Nn \l_tmpa_dim { \dim_max:nn { #1 } \c_zero_dim } - \skip_vertical:n { \l_tmpa_dim + \l__witharrows_interline_skip } + \skip_vertical:N \l_tmpa_dim + \skip_vertical:N \l__witharrows_interline_skip \scan_stop: } } @@ -992,6 +1039,13 @@ \NewDocumentEnvironment { DispWithArrows } { ! d < > ! O { } } { \bool_set_true:N \l__witharrows_in_DispWithArrows_bool + \bool_if:NF \l__witharrows_sbwi_bool + { + \legacy_if:nT { @inlabel } + { \bool_set_true:N \l__witharrows_in_label_or_minipage_bool } + \legacy_if:nT { @minipage } + { \bool_set_true:N \l__witharrows_in_label_or_minipage_bool } + } \bool_if:nT \c__witharrows_mathtools_loaded_bool { \MH_if_boolean:nT { show_only_refs } @@ -1005,15 +1059,6 @@ \exp_args:No \tl_if_novalue:nF { #1 } { \tl_set:Nn \l__witharrows_left_brace_tl { #1 } } \__witharrows_pre_halign:n { #2 } \bool_if:NT \l__witharrows_subequations_bool { \begin { subequations } } - \bool_if:NF \l__witharrows_sbwi_bool - { - \if@inlabel - \bool_set_true:N \l__witharrows_in_label_or_minipage_bool - \fi - \if@minipage - \bool_set_true:N \l__witharrows_in_label_or_minipage_bool - \fi - } \tl_if_eq:NNF \l__witharrows_left_brace_tl \c_novalue_tl { \hbox_set:Nn \l_tmpa_box @@ -1065,6 +1110,7 @@ \bool_if:NTF \l__witharrows_fleqn_bool \c_zero_skip { 0 pt plus 1000 pt minus 1000 pt } + \spread@equation \__witharrows_construct_halign: \tabskip = 0 pt plus 1000 pt minus 1000 pt & @@ -1098,7 +1144,7 @@ \hbox_to_wd:nn \l__witharrows_linewidth_dim { \bool_if:NTF \l__witharrows_fleqn_bool - { \skip_horizontal:n \l__witharrows_mathindent_dim } + { \skip_horizontal:N \l__witharrows_mathindent_dim } \hfil \hbox_to_wd:nn \g__witharrows_alignment_dim { @@ -1120,25 +1166,25 @@ } \hfil } - \skip_horizontal:n { - \l__witharrows_linewidth_dim } + \skip_horizontal:N -\l__witharrows_linewidth_dim \vcenter { \box_use_drop:N \l__witharrows_halign_box } } \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 ] + \pgfpicture + \pgfrememberpicturepositiononpagetrue \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 } + { pgf @ sh @ ns @ wa - \l__witharrows_prefix_str - \l_tmpa_int - v } { \__witharrows_fatal: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__witharrows_right_x_dim - { \dim_gset:Nn \g__witharrows_right_x_dim \l_tmpa_dim } + \pgfpointanchor { wa - \l__witharrows_prefix_str - \l_tmpa_int - v } { center } + \dim_compare:nNnT \pgf@x < \g__witharrows_right_x_dim + { \dim_gset_eq:NN \g__witharrows_right_x_dim \pgf@x } } } - \end { tikzpicture } + \endpgfpicture \__witharrows_post_halign: \bool_if:nT \c__witharrows_mathtools_loaded_bool { \MH_if_boolean:nT { show_only_refs } \MT_showonlyrefs_true: } @@ -1255,7 +1301,7 @@ \seq_clear_new:N \l__witharrows_first_arrows_seq \seq_clear_new:N \l__witharrows_last_arrows_seq \bool_set_true:N \l__witharrows_new_group_bool - \int_set:Nn \l__witharrows_arrow_int \c_one_int + \int_set:Nn \l__witharrows_arrow_int 1 \int_until_do:nNnn \l__witharrows_arrow_int > \g__witharrows_arrow_int { \prop_get:cnN @@ -1280,26 +1326,26 @@ \__witharrows_code_for_possible_arrow: \int_incr:N \l__witharrows_arrow_int } - \bool_if:nT - { - \int_compare_p:n { \l__witharrows_pos_arrow_int != 7 } - && - \int_compare_p:nNn \l__witharrows_first_arrow_of_group_int > 0 - } + \bool_lazy_and:nnT + { \bool_not_p:n { \int_compare_p:nNn \l__witharrows_pos_arrow_int = 7 } } + { \int_compare_p:nNn \l__witharrows_first_arrow_of_group_int > 0 } { \__witharrows_draw_arrows:nn \l__witharrows_first_arrow_of_group_int \g__witharrows_arrow_int } } \cs_new_protected:Npn \__witharrows_code_for_possible_arrow: { - \bool_if:nT + \bool_lazy_and:nnT + { \int_compare_p:nNn \l__witharrows_arrow_int > 1 } { - \int_compare_p:nNn \l__witharrows_arrow_int > \c_one_int - && - ( \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 } - ) + \bool_lazy_or_p:nn + { + \bool_lazy_and_p:nn + { + \int_compare_p:nNn + \l__witharrows_initial_int > \l__witharrows_last_line_of_group_int + } + { \bool_not_p:n { \int_compare_p:nNn \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 = \c_zero_int @@ -1320,7 +1366,7 @@ \seq_put_left:NV \l__witharrows_first_arrows_seq \l__witharrows_arrow_int \seq_clear:N \l__witharrows_last_arrows_seq \seq_put_left:NV \l__witharrows_last_arrows_seq \l__witharrows_arrow_int - \int_compare:nT { \l__witharrows_pos_arrow_int != 8 } + \int_compare:nNnF \l__witharrows_pos_arrow_int = 8 { \dim_set:Nn \l__witharrows_x_dim { - \c_max_dim } } } { @@ -1344,7 +1390,7 @@ } \bool_if:nF { \str_if_eq_p:Vn \l__witharrows_status_arrow_str { independent } } { - \int_compare:nT { \l__witharrows_pos_arrow_int != 8 } + \int_compare:nNnF \l__witharrows_pos_arrow_int = 8 { \__witharrows_update_x:nn \l__witharrows_initial_int \l__witharrows_final_int } } } @@ -1401,12 +1447,9 @@ \__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 - } + { \int_use:N \l__witharrows_initial_int - \bool_if:NTF \l__witharrows_initial_r_bool rl } \tl_set:Nx \l__witharrows_final_tl - { \int_use:N \l__witharrows_final_int - \bool_if:NTF \l__witharrows_final_r_bool rl .north } + { \int_use:N \l__witharrows_final_int - \bool_if:NTF \l__witharrows_final_r_bool rl } \prop_get:cnN { g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop } { label } @@ -1428,20 +1471,21 @@ \dim_gzero_new:N \g__witharrows_x_final_dim \dim_gzero_new:N \g__witharrows_y_initial_dim \dim_gzero_new:N \g__witharrows_y_final_dim - \begin { tikzpicture } [ __witharrows_standard ] - \tikz@scan@one@point \pgfutil@firstofone ( \l__witharrows_initial_tl ) + \pgfpicture + \pgfrememberpicturepositiononpagetrue + \pgfpointanchor { wa - \l__witharrows_prefix_str - \l__witharrows_initial_tl } { south } \dim_gset:Nn \g__witharrows_x_initial_dim \pgf@x \dim_gset:Nn \g__witharrows_y_initial_dim \pgf@y - \tikz@scan@one@point \pgfutil@firstofone ( \l__witharrows_final_tl ) + \pgfpointanchor { wa - \l__witharrows_prefix_str - \l__witharrows_final_tl } { north } \dim_gset:Nn \g__witharrows_x_final_dim \pgf@x \dim_gset:Nn \g__witharrows_y_final_dim \pgf@y - \end { tikzpicture } - \bool_if:nTF - { \dim_compare_p:nNn { \g__witharrows_y_initial_dim - \g__witharrows_y_final_dim } + \endpgfpicture + \bool_lazy_and:nnTF + { + \dim_compare_p:nNn { \g__witharrows_y_initial_dim - \g__witharrows_y_final_dim } > \l__witharrows_max_length_of_arrow_dim - && - \int_compare_p:nNn { \l__witharrows_final_int - \l__witharrows_initial_int } = 1 } + { \int_compare_p:nNn { \l__witharrows_final_int - \l__witharrows_initial_int } = 1 } { \tl_gset:Nx \g_tmpa_tl { @@ -1451,7 +1495,7 @@ \dim_eval:n { ( \g__witharrows_y_initial_dim + \g__witharrows_y_final_dim ) / 2 - + ( \l__witharrows_max_length_of_arrow_dim / 2 ) + + 0.5 \l__witharrows_max_length_of_arrow_dim } } \tl_gset:Nx \g_tmpb_tl @@ -1462,7 +1506,7 @@ \dim_eval:n { ( \g__witharrows_y_initial_dim + \g__witharrows_y_final_dim ) / 2 - - ( \l__witharrows_max_length_of_arrow_dim / 2 ) + - 0.5 \l__witharrows_max_length_of_arrow_dim } } } @@ -1504,7 +1548,7 @@ } \cs_new_protected:Npn \__witharrows_draw_arrow:nnn #1 #2 #3 { - \bool_if:nT { \l__witharrows_wrap_lines_bool && \l__witharrows_in_DispWithArrows_bool } + \bool_lazy_and:nnT \l__witharrows_wrap_lines_bool \l__witharrows_in_DispWithArrows_bool { \tl_set_eq:NN \l__witharrows_tikz_code_tl \c__witharrows_tikz_code_wrap_lines_tl } \exp_args:NV \__witharrows_def_function_tmpa:n \l__witharrows_tikz_code_tl \__witharrows_tmpa:nnn { #1 } { #2 } { #3 } @@ -1513,7 +1557,7 @@ \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 ) + \pgfpointanchor { wa - \l__witharrows_prefix_str - __witharrows_label } { west } \dim_set:Nn \l_tmpa_dim { \g__witharrows_right_x_dim - \pgf@x - \pgfkeysvalueof { / pgf / inner~xsep } } \path \pgfextra { \tl_gset:Nx \g_tmpa_tl \tikz@text@width } ; @@ -1532,16 +1576,19 @@ } \cs_new_protected:Npn \__witharrows_update_x:nn #1 #2 { + \dim_gset_eq:NN \g_tmpa_dim \l__witharrows_x_dim + \pgfpicture + \pgfrememberpicturepositiononpagetrue \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 + \pgfpointanchor { wa - \l__witharrows_prefix_str - ##1 - l } { center } + \dim_gset:Nn \g_tmpa_dim { \dim_max:nn \g_tmpa_dim \pgf@x } } + \endpgfpicture + \dim_set_eq:NN \l__witharrows_x_dim \g_tmpa_dim } -\cs_new:Npn \WithArrowsLastEnv { \int_use:N \g__witharrows_last_env_int } +\NewExpandableDocumentCommand \WithArrowsLastEnv { } + { \int_use:N \g__witharrows_last_env_int } \keys_define:nn { WithArrows / Arrow / code-after } { tikz .code:n = @@ -1598,30 +1645,42 @@ { \int_compare:nNnTF \l__witharrows_pos_arrow_int = 4 { - \begin { tikzpicture } [ __witharrows_standard ] - \tikz@scan@one@point \pgfutil@firstofone (#2-l.south) + \pgfpicture + \pgfrememberpicturepositiononpagetrue + \pgfpointanchor { wa - \l__witharrows_prefix_str - #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) + \pgfpointanchor { wa - \l__witharrows_prefix_str - #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 } + \endpgfpicture } { - \begin { tikzpicture } [ __witharrows_standard ] - \tikz@scan@one@point \pgfutil@firstofone - ( #2-\bool_if:NTF\l__witharrows_initial_r_bool rl .south ) + \pgfpicture + \pgfrememberpicturepositiononpagetrue + \pgfpointanchor + { + wa - \l__witharrows_prefix_str - + #2 - \bool_if:NTF \l__witharrows_initial_r_bool r l + } + { 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__witharrows_final_r_bool rl .north ) + { \dim_use:N \pgf@x , \dim_use:N \pgf@y } + \pgfpointanchor + { + wa - \l__witharrows_prefix_str - + #3 - \bool_if:NTF \l__witharrows_final_r_bool r l + } + { north } \tl_gset:Nx \g_tmpb_tl - { \dim_use:N \pgf@x , \dim_use:N \pgf@y } - \end { tikzpicture } + { \dim_use:N \pgf@x , \dim_use:N \pgf@y } + \endpgfpicture } \__witharrows_draw_arrow:nnn \g_tmpa_tl \g_tmpb_tl { #4 } } @@ -1669,11 +1728,12 @@ -- 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) + + \pgfpointanchor { wa - \l__witharrows_prefix_str - __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_lazy_and:nnT \l__witharrows_wrap_lines_bool \l__witharrows_in_DispWithArrows_bool { \dim_set:Nn \l_tmpb_dim { \g__witharrows_right_x_dim - \pgf@x - 0.3333 em } @@ -1682,7 +1742,7 @@ } \path (__witharrows_label.west) node [ anchor = west, text~width = \dim_use:N \l_tmpa_dim ] { #2 } ; - \end{tikzpicture} + \end { tikzpicture } } } \cs_new_protected:Npn \__witharrows_MultiArrow_i:n #1 @@ -1705,14 +1765,14 @@ { If~you~go~on,~this~command~will~be~ignored. } \__witharrows_msg_new:nn { amsmath~not~loaded } { - You~can't~use~the~option~'\l_keys_key_tl'~because~the~ + You~can't~use~the~option~'\l_keys_key_str'~because~the~ package~'amsmath'~has~not~been~loaded.\\ If~you~go~on,~this~option~will~be~ignored~in~the~rest~ of~the~document. } \__witharrows_msg_new:nn { Bad~value~for~replace~brace~by } { - Bad~value~for~the~option~'\l_keys_key_tl'.~The~value~must~begin~ + Bad~value~for~the~option~'\l_keys_key_str'.~The~value~must~begin~ with~an~extensible~left~delimiter.~The~possible~values~are:~., \token_to_str:N \{,~(,~[,~\token_to_str:N \lbrace,~ \token_to_str:N \lbrack,~\token_to_str:N \lgroup,~ @@ -1751,12 +1811,12 @@ } \__witharrows_msg_new:nn { Value~for~a~key } { - The~key~'\l_keys_key_tl'~should~be~used~without~value. \\ + The~key~'\l_keys_key_str'~should~be~used~without~value. \\ However,~you~can~go~on~for~this~time. } \__witharrows_msg_new:nnn { Unknown~option~in~Arrow } { - The~key~'\l_keys_key_tl'~is~unknown~for~the~command~ + The~key~'\l_keys_key_str'~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\}. \l_tmpa_str \\ @@ -1769,7 +1829,7 @@ } \__witharrows_msg_new:nnn { Unknown~option~WithArrows } { - The~key~'\l_keys_key_tl'~is~unknown~in~\{\l__witharrows_type_env_str\}. \\ + The~key~'\l_keys_key_str'~is~unknown~in~\{\l__witharrows_type_env_str\}. \\ \c__witharrows_option_ignored_str \\ For~a~list~of~the~available~keys,~type~H~<return>. } @@ -1779,7 +1839,7 @@ } \__witharrows_msg_new:nnn { Unknown~option~DispWithArrows } { - The~key~'\l_keys_key_tl'~is~unknown~in~\{\l__witharrows_type_env_str\}. \\ + The~key~'\l_keys_key_str'~is~unknown~in~\{\l__witharrows_type_env_str\}. \\ \c__witharrows_option_ignored_str \\ For~a~list~of~the~available~keys,~type~H~<return>. } @@ -1789,7 +1849,7 @@ } \__witharrows_msg_new:nnn { Unknown~option~WithArrowsOptions } { - The~key~'\l_keys_key_tl'~is~unknown~in~ + The~key~'\l_keys_key_str'~is~unknown~in~ \token_to_str:N \WithArrowsOptions. \\ \c__witharrows_option_ignored_str \\ For~a~list~of~the~available~keys,~type~H~<return>. @@ -1800,7 +1860,7 @@ } \__witharrows_msg_new:nnn { Unknown~option~Arrow~in~code-after } { - The~key~'\l_keys_key_tl'~is~unknown~in~ + The~key~'\l_keys_key_str'~is~unknown~in~ \token_to_str:N \Arrow\ in~code-after. \\ \c__witharrows_option_ignored_str \\ For~a~list~of~the~available~keys,~type~H~<return>. @@ -1866,14 +1926,14 @@ } \__witharrows_msg_new:nn { Incompatible~options~in~Arrow } { - You~try~to~use~the~option~'\l_keys_key_tl'~but~ + You~try~to~use~the~option~'\l_keys_key_str'~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~ + { You~try~to~use~the~option~'\l_keys_key_str'~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_code_after_bool @@ -2013,7 +2073,7 @@ \group_begin: \msg_set:nnn { witharrows } { Unknown~option~WithArrowsOptions } { - The~key~'\l_keys_key_tl'~can't~be~set~in~the~ + The~key~'\l_keys_key_str'~can't~be~set~in~the~ definition~of~a~style.~You~can~go~on~for~this~time~ but~you~should~suppress~this~key. } @@ -2043,7 +2103,7 @@ } \__witharrows_msg_new:nn { Option~unknown~for~up-and-down } { - The~option~'\l_keys_key_tl'~is~unknown.~\c__witharrows_option_ignored_str + The~option~'\l_keys_key_str'~is~unknown.~\c__witharrows_option_ignored_str } \tl_const:Nn \c__witharrows_tikz_code_up_tl { @@ -2157,7 +2217,7 @@ \cs_if_exist:cTF { tikz@library@calc@loaded } { \keys_set:nV { WithArrows / up-and-down } \l_keys_value_tl - \int_set:Nn \l__witharrows_pos_arrow_int \c_one_int + \int_set:Nn \l__witharrows_pos_arrow_int 1 \bool_set_false:N \l__witharrows_wrap_lines_bool \tl_set_eq:NN \l__witharrows_tikz_code_tl \c__witharrows_tikz_code_up_tl } @@ -2174,7 +2234,7 @@ \cs_if_exist:cTF { tikz@library@calc@loaded } { \keys_set:nV { WithArrows / up-and-down } \l_keys_value_tl - \int_set:Nn \l__witharrows_pos_arrow_int \c_one_int + \int_set:Nn \l__witharrows_pos_arrow_int 1 \bool_set_false:N \l__witharrows_wrap_lines_bool \tl_set_eq:NN \l__witharrows_tikz_code_tl \c__witharrows_tikz_code_down_tl } @@ -2187,13 +2247,13 @@ \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~can't~use~the~option~'\l_keys_key_str'~because~ you~don't~have~loaded~the~package~'varwidth'. \\ \c__witharrows_option_ignored_str } \__witharrows_msg_new:nn { calc~not~loaded } { - You~can't~use~the~option~'\l_keys_key_tl'~because~you~don't~have~loaded~the~ + You~can't~use~the~option~'\l_keys_key_str'~because~you~don't~have~loaded~the~ Tikz~library~'calc'.You~should~add~'\token_to_str:N\usetikzlibrary{calc}'~ ~in~the~preamble~of~your~document. \\ \c__witharrows_option_ignored_str |