diff options
author | Karl Berry <karl@freefriends.org> | 2019-10-21 21:00:26 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-10-21 21:00:26 +0000 |
commit | d263e93a74555e6a866da2a9fab3d8db1180ba36 (patch) | |
tree | 2db6236fab4ffaf37721041ef8b307d7d307b87e /Master/texmf-dist/tex | |
parent | 42afaab1a60991af8eac73ed93c18ffa38b45cc4 (diff) |
witharrows (21oct19)
git-svn-id: svn://tug.org/texlive/trunk@52478 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/witharrows/witharrows.sty | 166 |
1 files changed, 123 insertions, 43 deletions
diff --git a/Master/texmf-dist/tex/generic/witharrows/witharrows.sty b/Master/texmf-dist/tex/generic/witharrows/witharrows.sty index 382e185d1cc..56207f14b25 100644 --- a/Master/texmf-dist/tex/generic/witharrows/witharrows.sty +++ b/Master/texmf-dist/tex/generic/witharrows/witharrows.sty @@ -18,8 +18,8 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -\def\myfileversion{2.0} -\def\myfiledate{2019/07/30} +\def\myfileversion{2.1} +\def\myfiledate{2019/10/21} \RequirePackage{tikz} \RequirePackage{expl3}[2019/02/15] \usetikzlibrary{arrows.meta,bending} @@ -37,7 +37,7 @@ \cs_new_protected:Npn \__wa_msg_redirect_name:nn { \msg_redirect_name:nnn { witharrows } } \cs_new_protected:Npn \__wa_error:n { \msg_error:nn { witharrows } } -\cs_new_protected:Npn \__wa_warning:n { \msg_error:nn { witharrows } } +\cs_new_protected:Npn \__wa_warning:n { \msg_warning:nn { witharrows } } \cs_new_protected:Npn \__wa_fatal:n { \msg_fatal:nn { witharrows } } \cs_new_protected:Npn \__wa_error:nn { \msg_error:nnn { witharrows } } \cs_generate_variant:Nn \__wa_error:nn { n x } @@ -126,7 +126,7 @@ } { \cs_new_protected:Npn \__wa_strcmp:nn #1 #2 - { \pdftex_strcmp:D { #1 } { #2 } } + { \tex_strcmp:D { #1 } { #2 } } } \cs_new_protected:Npn \__wa_sort_seq:N #1 { @@ -289,6 +289,9 @@ { \__wa_eval_if_allowed:n { \int_set:Nn \l__wa_pos_arrow_int { #1 } } } \keys_define:nn { WithArrows / Global } { + max-length-of-arrow .dim_set:N = \l__wa_max_length_of_arrow_dim , + max-length-of-arrow .value_required:n = true , + max-length-of-arrow .initial:n = 2 cm , ygap .dim_set:N = \l__wa_ygap_dim , ygap .value_required:n = true , ygap .initial:n = 0.4 ex , @@ -493,7 +496,7 @@ displaystyle, end-adjust, format, group, groups, i, interline, jot, ll, - lr, more-columns, name, + lr, max-length-of-arrow, more-columns, name, no-arrows, rl, rr, show-node-names, show-nodes, start-adjust, t, tikz, tikz-code, @@ -518,9 +521,9 @@ { code-after, code-before, command-name, tikz-code, adjust, displaystyle, end-adjust, fleqn, group, format, groups, i, interline, jot, - left-brace, ll, lr, mathindent, name, no-arrows, replace-left-brace-by, rl, - rr, show-node-names, show-nodes, start-adjust, tikz, wrap-lines, xoffset, - ygap, ystart, + left-brace, ll, lr, max-length-of-arrow, mathindent, name, no-arrows, + replace-left-brace-by, rl, rr, show-node-names, show-nodes, start-adjust, + tikz, wrap-lines, xoffset, ygap, ystart, allow-multiple-labels, tagged-lines, nonumber, notag } \keys_define:nn { WithArrows / WithArrowsOptions } @@ -537,8 +540,8 @@ { allow-duplicate-names, b, c, command-name, more-columns, tikz-code, adjust, displaystyle, end-adjust, fleqn, group, groups, i, interline, jot, ll, lr, - mathindent, no-arrows, rl, rr, show-node-names, show-nodes, start-adjust, t, - tikz, wrap-lines, xoffset, ygap, ystart, + mathindent, max-length-of-arrow, no-arrows, rl, rr, show-node-names, + show-nodes, start-adjust, t, tikz, wrap-lines, xoffset, ygap, ystart, allow-multiple-labels, nonumber, notag, standard-behaviour-with-items, tagged-lines } @@ -579,22 +582,19 @@ tikz-code .value_required:n = true , tikz .code:n = \prg_do_nothing: , tikz .value_required:n = true , - xoffset .code:n = - \int_compare:nNnT \l__wa_pos_arrow_int > 5 - { \__wa_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 , + xoffset .code:n = , unknown .code:n = \__wa_sort_seq:N \l__wa_options_Arrow_seq \seq_if_in:NVTF \l__wa_options_WithArrows_seq \l_keys_key_tl { \str_set:Nn \l_tmpa_str - { ~However,~this~key~can~be~used~in~the~options~of~\{WithArrows\}. } + { ~However,~this~key~can~be~used~in~the~options~of~{WithArrows}. } } { \str_clear:N \l_tmpa_str } \__wa_error:n { Unknown~option~in~Arrow } @@ -625,8 +625,17 @@ lr .code:n = \__wa_fix_pos_arrow:n 0 , i .code:n = \__wa_fix_pos_arrow:n 5 , xoffset .code:n = - \int_compare:nNnF \l__wa_pos_arrow_int > 5 + \bool_if:nTF + { + \int_compare_p:nNn \g__wa_arrow_int > 1 + && + \int_compare_p:nNn \l__wa_pos_arrow_int > 5 + && + ! \str_if_eq_p:Vn \l__wa_status_arrow_str { independent } + } + { \__wa_error:n { Option~xoffset~forbidden } } { \dim_set:Nn \l__wa_xoffset_dim { #1 } } , + xoffset .value_required:n = true , start-adjust .dim_set:N = \l__wa_start_adjust_dim, end-adjust .dim_set:N = \l__wa_end_adjust_dim, adjust .code:n = @@ -838,7 +847,15 @@ \cs_new_protected:Npn \__wa_post_halign: { \cs_set:Npn \WithArrowsRightX { \g__wa_right_x_dim } - \int_compare:nNnT \g__wa_arrow_int > 0 \__wa_scan_arrows: + \int_compare:nNnT \g__wa_arrow_int > 0 + { + \int_compare:nNnT \g__wa_arrow_int = 1 + { + \int_compare:nNnT \l__wa_pos_arrow_int > 5 + { \int_set:Nn \l__wa_pos_arrow_int 5 } + } + \__wa_scan_arrows: + } \group_begin: \tikzset { every~picture / .style = __wa_standard } \cs_set:Npn \WithArrowsNbLines { \int_use:N \g__wa_line_int } @@ -970,7 +987,13 @@ \cs_new_protected:Npn \__wa_analyze_end:Nn #1 #2 { \exp_args:NV \str_if_eq:nnT \l__wa_type_env_str { #2 } - { \__wa_warning:n { newline~at~the~end~of~env } } + { + \__wa_warning:n { newline~at~the~end~of~env } + \group_begin: + \globaldefs = 1 + \__wa_msg_redirect_name:nn { newline~at~the~end~of~env } { none } + \group_end: + } \end { #2 } } \bool_new:N \l__wa_in_label_or_minipage_bool @@ -1409,28 +1432,68 @@ \bool_set_true:N \l_tmpa_bool \bool_set_true:N \l_tmpb_bool } + \dim_gzero_new:N \g__wa_x_initial_dim + \dim_gzero_new:N \g__wa_x_final_dim + \dim_gzero_new:N \g__wa_y_initial_dim + \dim_gzero_new:N \g__wa_y_final_dim \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 } - } + \dim_gset:Nn \g__wa_x_initial_dim \pgf@x + \dim_gset:Nn \g__wa_y_initial_dim \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 } - } + \dim_gset:Nn \g__wa_x_final_dim \pgf@x + \dim_gset:Nn \g__wa_y_final_dim \pgf@y \end { tikzpicture } + \bool_if:nTF + { \dim_compare_p:nNn { \g__wa_y_initial_dim - \g__wa_y_final_dim } + > \l__wa_max_length_of_arrow_dim + && + \int_compare_p:nNn { \l__wa_final_int - \l__wa_initial_int } = 1 + } + { + \tl_gset:Nx \g_tmpa_tl + { + \int_compare:nNnTF \l__wa_pos_arrow_int < 5 + { \dim_use:N \g__wa_x_initial_dim } + { \dim_use:N \l__wa_x_dim } , + \dim_eval:n + { + ( \g__wa_y_initial_dim + \g__wa_y_final_dim ) / 2 + + ( \l__wa_max_length_of_arrow_dim / 2 ) + } + } + \tl_gset:Nx \g_tmpb_tl + { + \int_compare:nNnTF \l__wa_pos_arrow_int < 5 + { \dim_use:N \g__wa_x_final_dim } + { \dim_use:N \l__wa_x_dim } , + \dim_eval:n + { + ( \g__wa_y_initial_dim + \g__wa_y_final_dim ) / 2 + - ( \l__wa_max_length_of_arrow_dim / 2 ) + } + } + } + { + \tl_gset:Nx \g_tmpa_tl + { + \int_compare:nNnTF \l__wa_pos_arrow_int < 5 + { \dim_use:N \g__wa_x_initial_dim } + { \dim_use:N \l__wa_x_dim } , + \bool_if:NTF \l_tmpa_bool + { \dim_eval:n { \g__wa_y_initial_dim + \l__wa_start_adjust_dim } } + { \dim_use:N \g__wa_y_initial_dim } + } + \tl_gset:Nx \g_tmpb_tl + { + \int_compare:nNnTF \l__wa_pos_arrow_int < 5 + { \dim_use:N \g__wa_x_final_dim } + { \dim_use:N \l__wa_x_dim } , + \bool_if:NTF \l_tmpb_bool + { \dim_eval:n { \g__wa_y_final_dim - \l__wa_end_adjust_dim } } + { \dim_use:N \g__wa_y_final_dim } + } + } \__wa_draw_arrow:nno \g_tmpa_tl \g_tmpb_tl \l_tmpa_tl \group_end: } @@ -1576,11 +1639,20 @@ } \cs_new_protected:Npn \__wa_MultiArrow:nn #1 #2 { + \exp_args:Nnx + \regex_match:nnTF + { \A \d+ (\,\d+)* ( \, \.\.\. (\,\d+)+ )* \Z } + { #1 } + { \__wa_MultiArrow_i:nn { #1 } { #2 } } + { \__wa_error:nx { Invalid~specification~for~MultiArrow } { #1 } } + } +\cs_new_protected:Npn \__wa_MultiArrow_i:nn #1 #2 + { \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 } + { \__wa_error:nx { Wrong~line~specification~in~MultiArrow } \x } + { \clist_gput_right:Nx \g_tmpa_clist \x } } \int_compare:nTF { \clist_count:N \g_tmpa_clist < 2 } { \__wa_error:n { Too~small~specification~for~MultiArrow } } @@ -1674,8 +1746,8 @@ } \__wa_msg_new:nn { newline~at~the~end~of~env } { - Your~environment~\{\l__wa_type_env_str\}~should~not~end~with~ - a~\token_to_str:N \\.\\ + The~environments~of~witharrows~(\{WithArrows\}~and~ + \{DispWithArrows\})~should~not~end~by~\token_to_str:N \\.\\ This~warning~might~become~an~error~in~a~future~version. } \__wa_msg_new:nn { Invalid~option~format } @@ -1902,11 +1974,13 @@ \__wa_msg_new:nn { Option~xoffset~forbidden } { You~can't~use~the~option~'xoffset'~in~the~command~ - \l__wa_string_Arrow_for_msg_str\ - while~you~are~using~the~option~ + \l__wa_string_Arrow_for_msg_str\ in~the~row~\int_use:N \g__wa_line_int\ + of~your~environment~\{\l__wa_type_env_str\}~ + because~you~are~using~the~option~ ' \int_compare:nNnTF \l__wa_pos_arrow_int = 7 { group } - { groups } '. \\ + { groups } '.~It's~possible~for~an~independent~arrow~or~if~there~is~ + only~one~arrow. \\ \c__wa_option_ignored_str } \__wa_msg_new:nnn { Duplicate~name } @@ -2042,6 +2116,12 @@ ~in~the~preamble~of~your~document. \\ \c__wa_option_ignored_str } +\__wa_msg_new:nn { Invalid~specification~for~MultiArrow } + { + The~specification~of~rows~for~\token_to_str:N\MultiArrow\ + (i.e.~#1)~is~invalid. \\ + \c__wa_command_ignored_str + } \endinput %% %% End of file `witharrows.sty'. |