| 1 |
%% |
| 2 |
%% This is file `witharrows.sty', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% witharrows.dtx (with options: `LaTeX') |
| 8 |
%% |
| 9 |
%% Copyright (C) 2017-2024 by F. Pantigny |
| 10 |
%% |
| 11 |
%% This file may be distributed and/or modified under the |
| 12 |
%% conditions of the LaTeX Project Public License, either |
| 13 |
%% version 1.3 of this license or (at your option) any later |
| 14 |
%% version. The latest version of this license is in: |
| 15 |
%% |
| 16 |
%% http://www.latex-project.org/lppl.txt |
| 17 |
%% |
| 18 |
%% and version 1.3 or later is part of all distributions of |
| 19 |
%% LaTeX version 2005/12/01 or later. |
| 20 |
%% |
| 21 |
\def\myfileversion{2.9a} |
| 22 |
\def\myfiledate{2024/10/19} |
| 23 |
|
| 24 |
\RequirePackage{tikz} |
| 25 |
\usetikzlibrary{arrows.meta} |
| 26 |
\usepgfmodule{bending} % https://texnique.fr/osqa/questions/12199 |
| 27 |
\RequirePackage{l3keys2e} |
| 28 |
\ProvidesExplPackage |
| 29 |
{witharrows} |
| 30 |
{\myfiledate} |
| 31 |
{\myfileversion} |
| 32 |
{Draws arrows for explanations on the right} |
| 33 |
\RequirePackage { varwidth } |
| 34 |
\ProvideDocumentCommand{\IfPackageLoadedT}{mm} |
| 35 |
{\IfPackageLoadedTF{#1}{#2}{}} |
| 36 |
\ProvideDocumentCommand{\IfPackageLoadedF}{mm} |
| 37 |
{\IfPackageLoadedTF{#1}{}{#2}} |
| 38 |
\bool_new:N \c__witharrows_footnotehyper_bool |
| 39 |
\bool_new:N \c__witharrows_footnote_bool |
| 40 |
\cs_new_protected:Npn \__witharrows_msg_new:nn { \msg_new:nnn { witharrows } } |
| 41 |
\cs_new_protected:Npn \__witharrows_msg_new:nnn #1 #2 #3 |
| 42 |
{ |
| 43 |
\bool_if:NTF \c__witharrows_messages_for_Overleaf_bool |
| 44 |
{ \msg_new:nnn { witharrows } { #1 } { #2 \\ #3 } } |
| 45 |
{ \msg_new:nnnn { witharrows } { #1 } { #2 } { #3 } } |
| 46 |
} |
| 47 |
\cs_new_protected:Npn \__witharrows_msg_redirect_name:nn |
| 48 |
{ \msg_redirect_name:nnn { witharrows } } |
| 49 |
\cs_new_protected:Npn \__witharrows_error:n { \msg_error:nn { witharrows } } |
| 50 |
\cs_new_protected:Npn \__witharrows_warning:n { \msg_warning:nn { witharrows } } |
| 51 |
\cs_new_protected:Npn \__witharrows_fatal:n { \msg_fatal:nn { witharrows } } |
| 52 |
\cs_new_protected:Npn \__witharrows_error:nn { \msg_error:nnn { witharrows } } |
| 53 |
\cs_generate_variant:Nn \__witharrows_error:nn { n e } |
| 54 |
\cs_new_protected:Npn \__witharrows_error_or_warning:n |
| 55 |
{ \bool_if:NTF \c__witharrows_messages_for_Overleaf_bool \__witharrows_warning:n \__witharrows_error:n } |
| 56 |
\bool_set:Nn \c__witharrows_messages_for_Overleaf_bool |
| 57 |
{ |
| 58 |
\str_if_eq_p:on \c_sys_jobname_str { _region_ } % for Emacs |
| 59 |
|| \str_if_eq_p:on \c_sys_jobname_str { output } % for Overleaf |
| 60 |
} |
| 61 |
\bool_new:N \g__witharrows_beamer_bool |
| 62 |
\keys_define:nn { WithArrows / package } |
| 63 |
{ |
| 64 |
footnote .bool_set:N = \c__witharrows_footnote_bool , |
| 65 |
footnotehyper .bool_set:N = \c__witharrows_footnotehyper_bool , |
| 66 |
footnote .usage:n = load , |
| 67 |
footnotehyper .usage:n = load , |
| 68 |
beamer .bool_gset:N = \g__witharrows_beamer_bool , |
| 69 |
beamer .default:n = true , |
| 70 |
beamer .usage:n = load , |
| 71 |
unknown .code:n = \__witharrows_fatal:n { Option~unknown~for~package } |
| 72 |
} |
| 73 |
\__witharrows_msg_new:nn { Option~unknown~for~package } |
| 74 |
{ |
| 75 |
You~can't~use~the~option~'\l_keys_key_str'~when~loading~the~ |
| 76 |
package~witharrows.~Try~to~use~the~command~ |
| 77 |
\token_to_str:N\WithArrowsOptions. |
| 78 |
} |
| 79 |
\ProcessKeysOptions { WithArrows / package } |
| 80 |
\IfClassLoadedT { beamer } { \bool_gset_true:N \g__witharrows_beamer_bool } |
| 81 |
\IfPackageLoadedT { beamerarticle } { \bool_gset_true:N \g__witharrows_beamer_bool } |
| 82 |
\__witharrows_msg_new:nn { footnote~with~footnotehyper~package } |
| 83 |
{ |
| 84 |
Footnote~forbidden.\\ |
| 85 |
You~can't~use~the~option~'footnote'~because~the~package~ |
| 86 |
footnotehyper~has~already~been~loaded.~ |
| 87 |
If~you~want,~you~can~use~the~option~'footnotehyper'~and~the~footnotes~ |
| 88 |
within~the~environments~of~witharrows~will~be~extracted~with~the~tools~ |
| 89 |
of~the~package~footnotehyper.\\ |
| 90 |
If~you~go~on,~the~package~footnote~won't~be~loaded. |
| 91 |
} |
| 92 |
\__witharrows_msg_new:nn { footnotehyper~with~footnote~package } |
| 93 |
{ |
| 94 |
You~can't~use~the~option~'footnotehyper'~because~the~package~ |
| 95 |
footnote~has~already~been~loaded.~ |
| 96 |
If~you~want,~you~can~use~the~option~'footnote'~and~the~footnotes~ |
| 97 |
within~the~environments~of~witharrows~will~be~extracted~with~the~tools~ |
| 98 |
of~the~package~footnote.\\ |
| 99 |
If~you~go~on,~the~package~footnotehyper~won't~be~loaded. |
| 100 |
} |
| 101 |
\bool_if:NT \c__witharrows_footnote_bool |
| 102 |
{ |
| 103 |
\@ifclassloaded { beamer } |
| 104 |
{ \bool_set_false:N \c__witharrows_footnote_bool } |
| 105 |
{ |
| 106 |
\@ifpackageloaded { footnotehyper } |
| 107 |
{ \__witharrows_error:n { footnote~with~footnotehyper~package } } |
| 108 |
{ \usepackage { footnote } } |
| 109 |
} |
| 110 |
} |
| 111 |
\bool_if:NT \c__witharrows_footnotehyper_bool |
| 112 |
{ |
| 113 |
\@ifclassloaded { beamer } |
| 114 |
{ \bool_set_false:N \c__witharrows_footnote_bool } |
| 115 |
{ |
| 116 |
\@ifpackageloaded { footnote } |
| 117 |
{ \__witharrows_error:n { footnotehyper~with~footnote~package } } |
| 118 |
{ \usepackage { footnotehyper } } |
| 119 |
\bool_set_true:N \c__witharrows_footnote_bool |
| 120 |
} |
| 121 |
} |
| 122 |
\bool_new:N \c__witharrows_leqno_bool |
| 123 |
\DeclareOption { leqno } { \bool_set_true:N \c__witharrows_leqno_bool } |
| 124 |
\DeclareOption* { } |
| 125 |
\ProcessOptions* |
| 126 |
\cs_new_protected:Npn \__witharrows_collect_options:n #1 |
| 127 |
{ |
| 128 |
\peek_meaning:NTF [ |
| 129 |
{ \__witharrows_collect_options:nw { #1 } } |
| 130 |
{ #1 { } } |
| 131 |
} |
| 132 |
\NewDocumentCommand \__witharrows_collect_options:nw { m r[] } |
| 133 |
{ \__witharrows_collect_options:nn { #1 } { #2 } } |
| 134 |
|
| 135 |
\cs_new_protected:Npn \__witharrows_collect_options:nn #1 #2 |
| 136 |
{ |
| 137 |
\peek_meaning:NTF [ |
| 138 |
{ \__witharrows_collect_options:nnw { #1 } { #2 } } |
| 139 |
{ #1 { #2 } } |
| 140 |
} |
| 141 |
|
| 142 |
\cs_new_protected:Npn \__witharrows_collect_options:nnw #1#2[#3] |
| 143 |
{ \__witharrows_collect_options:nn { #1 } { #2 , #3 } } |
| 144 |
\cs_generate_variant:Nn \seq_set_split:Nnn { N e e } |
| 145 |
\cs_generate_variant:Nn \keys_precompile:nnN { n n c } |
| 146 |
\prg_generate_conditional_variant:Nnn \tl_if_novalue:n { o } { F } |
| 147 |
\exp_args_generate:n { N N N n o } |
| 148 |
\cs_new_protected:Npn \__witharrows_sort_seq:N #1 |
| 149 |
{ |
| 150 |
\seq_sort:Nn #1 |
| 151 |
{ |
| 152 |
\str_compare:eNeTF |
| 153 |
{ \str_lowercase:n { ##1 } } < { \str_lowercase:n { ##2 } } |
| 154 |
\sort_return_same: |
| 155 |
\sort_return_swapped: |
| 156 |
} |
| 157 |
} |
| 158 |
\cs_new_protected:Npn \__witharrows_set_seq_of_str_from_clist:Nn #1 #2 |
| 159 |
{ |
| 160 |
\seq_set_from_clist:Nn #1 { #2 } |
| 161 |
\seq_set_map_e:NNn #1 #1 { \tl_to_str:n { ##1 } } |
| 162 |
} |
| 163 |
\cs_new_protected:Npn \__witharrows_save:N #1 |
| 164 |
{ |
| 165 |
\seq_set_split:Nee \l_tmpa_seq |
| 166 |
{ \char_generate:nn { `_ } { 12 } } |
| 167 |
{ \cs_to_str:N #1 } |
| 168 |
\seq_pop_left:NN \l_tmpa_seq \l_tmpa_tl |
| 169 |
\str_set:Ne \l_tmpa_str { \seq_item:Nn \l_tmpa_seq { -1 } } |
| 170 |
\use:c { \l_tmpa_str _if_exist:cF } |
| 171 |
{ g _\seq_use:Nnnn \l_tmpa_seq _ _ _ } |
| 172 |
{ |
| 173 |
\use:c { \l_tmpa_str _new:c } |
| 174 |
{ g _\seq_use:Nnnn \l_tmpa_seq _ _ _ } |
| 175 |
} |
| 176 |
\use:c { \l_tmpa_str _gset_eq:cN } |
| 177 |
{ g _\seq_use:Nnnn \l_tmpa_seq _ _ _ } #1 |
| 178 |
} |
| 179 |
\cs_new_protected:Npn \__witharrows_restore:N #1 |
| 180 |
{ |
| 181 |
\seq_set_split:Nee \l_tmpa_seq |
| 182 |
{ \char_generate:nn { `_ } { 12 } } |
| 183 |
{ \cs_to_str:N #1 } |
| 184 |
\seq_pop_left:NN \l_tmpa_seq \l_tmpa_tl |
| 185 |
\str_set:Ne \l_tmpa_str { \seq_item:Nn \l_tmpa_seq { -1 } } |
| 186 |
\use:c { \l_tmpa_str _set_eq:Nc } |
| 187 |
#1 { g_\seq_use:Nnnn \l_tmpa_seq _ _ _ } |
| 188 |
} |
| 189 |
\tikzset |
| 190 |
{ |
| 191 |
__witharrows_node_style / .style = |
| 192 |
{ |
| 193 |
above = \l__witharrows_ystart_dim , |
| 194 |
inner~sep = \c_zero_dim , |
| 195 |
minimum~width = \c_zero_dim , |
| 196 |
minimum~height = \l__witharrows_ygap_dim |
| 197 |
} |
| 198 |
} |
| 199 |
\tikzset |
| 200 |
{ |
| 201 |
__witharrows_standard / .style = |
| 202 |
{ |
| 203 |
remember~picture , |
| 204 |
overlay , |
| 205 |
name~prefix = wa - \l__witharrows_prefix_str - |
| 206 |
} , |
| 207 |
__witharrows_standard_arrow / .style = |
| 208 |
{ |
| 209 |
__witharrows_standard , |
| 210 |
every~path / .style = WithArrows / arrow |
| 211 |
} |
| 212 |
} |
| 213 |
\sys_if_engine_xetex:T |
| 214 |
{ |
| 215 |
\tikzset |
| 216 |
{ |
| 217 |
__witharrows_standard_arrow / .append~style = |
| 218 |
{ every~node / .append~style = { text = . } } |
| 219 |
} |
| 220 |
} |
| 221 |
\tikzset |
| 222 |
{ |
| 223 |
WithArrows / arrow / tips / .style = |
| 224 |
{ > = { Straight~Barb [ scale = 1.2 , bend ] } } |
| 225 |
} |
| 226 |
\tikzset |
| 227 |
{ |
| 228 |
WithArrows / arrow / .style = |
| 229 |
{ |
| 230 |
align = flush~left , |
| 231 |
auto = left , |
| 232 |
font = \small \itshape , |
| 233 |
WithArrows / arrow / tips , |
| 234 |
bend~left = 45 , |
| 235 |
-> |
| 236 |
} |
| 237 |
} |
| 238 |
\AtBeginDocument |
| 239 |
{ |
| 240 |
\IfPackageLoadedTF { amsmath } |
| 241 |
{ |
| 242 |
\seq_put_right:Nn \l__witharrows_options_WithArrowsOptions_seq { subequations } |
| 243 |
\seq_put_right:Nn \l__witharrows_options_DispWithArrows_seq { subequations } |
| 244 |
} |
| 245 |
{ |
| 246 |
\cs_new_protected:Npn \spread@equation |
| 247 |
{ |
| 248 |
\openup \jot |
| 249 |
\cs_set_eq:NN \spread@equation \prg_do_nothing: |
| 250 |
} |
| 251 |
} |
| 252 |
} |
| 253 |
\tl_new:N \l__witharrows_left_brace_tl |
| 254 |
\tl_set_eq:NN \l__witharrows_left_brace_tl \c_novalue_tl |
| 255 |
\bool_new:N \l__witharrows_in_WithArrows_bool |
| 256 |
\bool_new:N \l__witharrows_in_DispWithArrows_bool |
| 257 |
\bool_new:N \l__witharrows_in_code_after_bool |
| 258 |
\seq_new:N \g__witharrows_position_in_the_tree_seq |
| 259 |
\seq_gput_right:Nn \g__witharrows_position_in_the_tree_seq 1 |
| 260 |
\int_new:N \g__witharrows_last_env_int |
| 261 |
\int_new:N \l__witharrows_pos_env_int |
| 262 |
\int_new:N \l__witharrows_pos_arrow_int |
| 263 |
\int_set:Nn \l__witharrows_pos_arrow_int 3 |
| 264 |
\seq_new:N \g__witharrows_arrow_int_seq |
| 265 |
\int_new:N \g__witharrows_arrow_int |
| 266 |
\seq_new:N \g__witharrows_line_int_seq |
| 267 |
\int_new:N \g__witharrows_line_int |
| 268 |
\seq_new:N \g__witharrows_col_int_seq |
| 269 |
\int_new:N \g__witharrows_col_int |
| 270 |
\seq_new:N \g__witharrows_static_col_int_seq |
| 271 |
\int_new:N \g__witharrows_static_col_int |
| 272 |
\clist_new:N \l__witharrows_tags_clist |
| 273 |
\clist_set:Nn \l__witharrows_tags_clist { all } |
| 274 |
\cs_new_protected:Npn \__witharrows_test_if_to_tag: |
| 275 |
{ |
| 276 |
\clist_if_in:NoT \l__witharrows_tags_clist \g__witharrows_line_int |
| 277 |
{ \clist_set:Nn \l__witharrows_tags_clist { all } } |
| 278 |
} |
| 279 |
\str_new:N \l__witharrows_command_name_str |
| 280 |
\str_set:Nn \l__witharrows_command_name_str { Arrow } |
| 281 |
\str_new:N \l__witharrows_string_Arrow_for_msg_str |
| 282 |
\str_set:Ne \l__witharrows_string_Arrow_for_msg_str { \token_to_str:N \Arrow } |
| 283 |
\seq_new:N \g__witharrows_names_seq |
| 284 |
\bool_new:N \l__witharrows_sbwi_bool |
| 285 |
\bool_new:N \l__witharrows_tag_star_bool |
| 286 |
\bool_new:N \l__witharrows_tag_next_line_bool |
| 287 |
\bool_new:N \l__witharrows_qedhere_bool |
| 288 |
\bool_new:N \l__witharrows_in_first_columns_bool |
| 289 |
\bool_new:N \l__witharrows_new_group_bool |
| 290 |
\bool_new:N \l__witharrows_initial_r_bool |
| 291 |
\bool_new:N \l__witharrows_final_r_bool |
| 292 |
\tl_new:N \l__witharrows_initial_tl |
| 293 |
\tl_new:N \l__witharrows_final_tl |
| 294 |
\int_new:N \l__witharrows_nb_cols_int |
| 295 |
\str_new:N \l__witharrows_format_str |
| 296 |
\bool_new:N \l__witharrows_subequations_bool |
| 297 |
\dim_new:N \l__witharrows_arrow_width_dim |
| 298 |
\dim_set_eq:NN \l__witharrows_arrow_width_dim \c_max_dim |
| 299 |
\dim_new:N \l__witharrows_up_and_down_radius_dim |
| 300 |
\dim_set:Nn \l__witharrows_up_and_down_radius_dim { 4 pt } |
| 301 |
\seq_new:N \l__witharrows_o_arrows_seq |
| 302 |
\dim_new:N \l__witharrows_xoffset_for_o_arrows_dim |
| 303 |
\dim_set:Nn \l__witharrows_xoffset_for_o_arrows_dim { 2 mm } |
| 304 |
\bool_new:N \l__witharrows_right_overlap_bool |
| 305 |
\bool_set_true:N \l__witharrows_right_overlap_bool |
| 306 |
\cs_new_protected:Npn \__witharrows_eval_if_allowed:n #1 |
| 307 |
{ |
| 308 |
\str_if_empty:NTF \l__witharrows_previous_key_str |
| 309 |
{ |
| 310 |
\str_set_eq:NN \l__witharrows_previous_key_str \l_keys_key_str |
| 311 |
#1 |
| 312 |
} |
| 313 |
{ \__witharrows_error:n { Incompatible~options } } |
| 314 |
} |
| 315 |
\cs_new_protected:Npn \__witharrows_fix_pos_option:n #1 |
| 316 |
{ \__witharrows_eval_if_allowed:n { \int_set:Nn \l__witharrows_pos_arrow_int { #1 } } } |
| 317 |
\keys_define:nn { WithArrows / Global } |
| 318 |
{ |
| 319 |
max-length-of-arrow .dim_set:N = \l__witharrows_max_length_of_arrow_dim , |
| 320 |
max-length-of-arrow .value_required:n = true , |
| 321 |
max-length-of-arrow .initial:n = 2 cm , |
| 322 |
ygap .dim_set:N = \l__witharrows_ygap_dim , |
| 323 |
ygap .initial:n = 0.4 ex , |
| 324 |
ygap .value_required:n = true , |
| 325 |
ystart .dim_set:N = \l__witharrows_ystart_dim , |
| 326 |
ystart .value_required:n = true , |
| 327 |
ystart .initial:n = 0.4 ex , |
| 328 |
more-columns .code:n = |
| 329 |
\__witharrows_msg_redirect_name:nn { Too~much~columns~in~WithArrows } { none } , |
| 330 |
more-columns .value_forbidden:n = true , |
| 331 |
command-name .code:n = |
| 332 |
\str_set:Nn \l__witharrows_command_name_str { #1 } |
| 333 |
\str_set:Ne \l__witharrows_string_Arrow_for_msg_str |
| 334 |
{ \c_backslash_str Arrow~alias~\c_backslash_str #1 } , |
| 335 |
command-name .value_required:n = true , |
| 336 |
tikz-code .tl_set:N = \l__witharrows_tikz_code_tl , |
| 337 |
tikz-code .initial:n = \draw~(#1)~to~node{#3}~(#2)~; , |
| 338 |
tikz-code .value_required:n = true , |
| 339 |
displaystyle .bool_set:N = \l__witharrows_displaystyle_bool , |
| 340 |
displaystyle .default:n = true , |
| 341 |
show-nodes .code:n = |
| 342 |
\tikzset { __witharrows_node_style / .append~style = { draw , red } } , |
| 343 |
show-node-names .bool_set:N = \l__witharrows_show_node_names_bool , |
| 344 |
show-node-names .default:n = true , |
| 345 |
group .code:n = |
| 346 |
\str_if_empty:NTF \l__witharrows_previous_key_str |
| 347 |
{ |
| 348 |
\str_set:Nn \l__witharrows_previous_key_str { group } |
| 349 |
\seq_remove_all:Nn \l__witharrows_options_Arrow_seq { xoffset } |
| 350 |
\int_set:Nn \l__witharrows_pos_arrow_int 7 |
| 351 |
} |
| 352 |
{ \__witharrows_error:n { Incompatible~options } } , |
| 353 |
group .value_forbidden:n = true , |
| 354 |
groups .code:n = |
| 355 |
\str_if_empty:NTF \l__witharrows_previous_key_str |
| 356 |
{ |
| 357 |
\str_set:Nn \l__witharrows_previous_key_str { groups } |
| 358 |
\seq_if_in:NnF \l__witharrows_options_Arrow_seq { new-group } |
| 359 |
{ \seq_put_right:Nn \l__witharrows_options_Arrow_seq { new-group } } |
| 360 |
\seq_remove_all:Nn \l__witharrows_options_Arrow_seq { xoffset } |
| 361 |
\int_set:Nn \l__witharrows_pos_arrow_int 6 |
| 362 |
} |
| 363 |
{ \__witharrows_error:n { Incompatible~options } } , |
| 364 |
groups .value_forbidden:n = true , |
| 365 |
tikz .code:n = \tikzset { WithArrows / arrow / .append~style = { #1 } } , |
| 366 |
tikz .value_required:n = true , |
| 367 |
rr .code:n = \__witharrows_fix_pos_option:n 3 , |
| 368 |
rr .value_forbidden:n = true , |
| 369 |
ll .code:n = \__witharrows_fix_pos_option:n 1 , |
| 370 |
ll .value_forbidden:n = true , |
| 371 |
rl .code:n = \__witharrows_fix_pos_option:n 2 , |
| 372 |
rl .value_forbidden:n = true , |
| 373 |
lr .code:n = \__witharrows_fix_pos_option:n 0 , |
| 374 |
lr .value_forbidden:n = true , |
| 375 |
i .code:n = \__witharrows_fix_pos_option:n 5 , |
| 376 |
i .value_forbidden:n = true , |
| 377 |
xoffset .dim_set:N = \l__witharrows_xoffset_dim , |
| 378 |
xoffset .value_required:n = true , |
| 379 |
xoffset .initial:n = 3 mm , |
| 380 |
jot .dim_set:N = \jot , |
| 381 |
jot .value_required:n = true , |
| 382 |
interline .skip_set:N = \l__witharrows_interline_skip , |
| 383 |
start-adjust .dim_set:N = \l__witharrows_start_adjust_dim , |
| 384 |
start-adjust .initial:n = 0.4 ex , |
| 385 |
start-adjust .value_required:n = true , |
| 386 |
end-adjust .dim_set:N = \l__witharrows_end_adjust_dim , |
| 387 |
end-adjust .initial:n = 0.4 ex , |
| 388 |
end-adjust .value_required:n = true , |
| 389 |
adjust .meta:n = { start-adjust = #1 , end-adjust = #1 } , |
| 390 |
adjust .value_required:n = true , |
| 391 |
up-and-down .code:n = \keys_set:nn { WithArrows / up-and-down } { #1 } , |
| 392 |
up-and-down .value_required:n = true , |
| 393 |
no-arrows .code:n = |
| 394 |
\cs_set_eq:NN \__witharrows_draw_arrows:nn \use_none:nn |
| 395 |
\cs_set_eq:NN \__witharrows_draw_arrow:nnn \use_none:nnn , |
| 396 |
no-arrows .value_forbidden:n = true |
| 397 |
} |
| 398 |
\keys_define:nn { WithArrows / WithArrowsSpecific } |
| 399 |
{ |
| 400 |
t .code:n = \int_set:Nn \l__witharrows_pos_env_int O , |
| 401 |
t .value_forbidden:n = true , |
| 402 |
c .code:n = \int_set:Nn \l__witharrows_pos_env_int 1 , |
| 403 |
c .value_forbidden:n = true , |
| 404 |
b .code:n = \int_set:Nn \l__witharrows_pos_env_int 2 , |
| 405 |
b .value_forbidden:n = true , |
| 406 |
right-overlap .bool_set:N = \l__witharrows_right_overlap_bool , |
| 407 |
right-overlap .value_required:n = true |
| 408 |
} |
| 409 |
\clist_new:N \c__witharrows_ext_delimiters_clist |
| 410 |
\clist_set:Nn \c__witharrows_ext_delimiters_clist |
| 411 |
{ |
| 412 |
., \{, (, [, \lbrace, \lbrack, \lgroup, \langle, \lmoustache, \lceil, \lfloor |
| 413 |
} |
| 414 |
\AtBeginDocument |
| 415 |
{ |
| 416 |
\bool_set_false:N \l_tmpa_bool |
| 417 |
\IfPackageLoadedT { amsmath } { \bool_set_true:N \l_tmpa_bool } |
| 418 |
\IfPackageLoadedT { unicode-math } { \bool_set_true:N \l_tmpa_bool } |
| 419 |
\bool_if:NT \l_tmpa_bool |
| 420 |
{ \clist_put_right:Nn \c__witharrows_ext_delimiters_clist { \lvert, \lVert } } |
| 421 |
} |
| 422 |
\keys_define:nn { WithArrows / DispWithArrowsSpecific } |
| 423 |
{ |
| 424 |
fleqn .bool_set:N = \l__witharrows_fleqn_bool , |
| 425 |
fleqn .default:n = true , |
| 426 |
mathindent .skip_set:N = \l__witharrows_mathindent_skip , |
| 427 |
mathindent .initial:n = 25 pt , |
| 428 |
mathindent .value_required:n = true , |
| 429 |
notag .code:n = |
| 430 |
\str_if_eq:nnTF { #1 } { true } |
| 431 |
{ \clist_clear:N \l__witharrows_tags_clist } |
| 432 |
{ \clist_set:Nn \l__witharrows_tags_clist { all } } , |
| 433 |
notag .default:n = true , |
| 434 |
subequations .code:n = |
| 435 |
\IfPackageLoadedTF { amsmath } |
| 436 |
{ \bool_set_true:N \l__witharrows_subequations_bool } |
| 437 |
{ |
| 438 |
\__witharrows_error:n { amsmath~not~loaded } |
| 439 |
\group_begin: |
| 440 |
\globaldefs = 1 |
| 441 |
\__witharrows_msg_redirect_name:nn { amsmath~not~loaded } { info } |
| 442 |
\group_end: |
| 443 |
} , |
| 444 |
subequations .default:n = true , |
| 445 |
subequations .value_forbidden:n = true , |
| 446 |
nonumber .meta:n = notag , |
| 447 |
allow-multiple-labels .code:n = |
| 448 |
\__witharrows_msg_redirect_name:nn { Multiple~labels } { none } , |
| 449 |
allow-multiple-labels .value_forbidden:n = true , |
| 450 |
tagged-lines .code:n = |
| 451 |
\clist_set:Nn \l__witharrows_tags_clist { #1 } |
| 452 |
\clist_if_in:NnT \l__witharrows_tags_clist { first } |
| 453 |
{ |
| 454 |
\clist_remove_all:Nn \l__witharrows_tags_clist { first } |
| 455 |
\clist_put_left:Nn \l__witharrows_tags_clist 1 |
| 456 |
} , |
| 457 |
tagged-lines .value_required:n = true , |
| 458 |
wrap-lines .bool_set:N = \l__witharrows_wrap_lines_bool , |
| 459 |
wrap-lines .default:n = true , |
| 460 |
replace-left-brace-by .code:n = |
| 461 |
{ |
| 462 |
\tl_set:Ne \l_tmpa_tl { \tl_head:n { #1 } } |
| 463 |
\clist_if_in:NoTF |
| 464 |
\c__witharrows_ext_delimiters_clist |
| 465 |
\l_tmpa_tl |
| 466 |
{ \tl_set:Nn \l__witharrows_replace_left_brace_by_tl { #1 } } |
| 467 |
{ \__witharrows_error:n { Bad~value~for~replace~brace~by } } |
| 468 |
} , |
| 469 |
replace-left-brace-by .initial:n = \lbrace , |
| 470 |
standard-behaviour-with-items .bool_set:N = \l__witharrows_sbwi_bool , |
| 471 |
standard-behaviour-with-items .default:n = true |
| 472 |
} |
| 473 |
\keys_define:nn { WithArrows / Env } |
| 474 |
{ |
| 475 |
name .code:n = |
| 476 |
\str_set:Nn \l_tmpa_str { #1 } |
| 477 |
\seq_if_in:NoTF \g__witharrows_names_seq \l_tmpa_str |
| 478 |
{ \__witharrows_error:n { Duplicate~name } } |
| 479 |
{ \seq_gput_left:No \g__witharrows_names_seq \l_tmpa_str } |
| 480 |
\str_set_eq:NN \l__witharrows_name_str \l_tmpa_str , |
| 481 |
name .value_required:n = true , |
| 482 |
code-before .code:n = \tl_put_right:Nn \l__witharrows_code_before_tl { #1 } , |
| 483 |
code-before .value_required:n = true, |
| 484 |
CodeBefore .meta:n = { code-before = #1 } , |
| 485 |
code-after .code:n = \tl_put_right:Nn \l__witharrows_code_after_tl { #1 } , |
| 486 |
code-after .value_required:n = true , |
| 487 |
CodeAfter .meta:n = { code-after = #1 } , |
| 488 |
format .code:n = |
| 489 |
\tl_if_empty:nTF { #1 } |
| 490 |
{ \__witharrows_error:n { Invalid~option~format } } |
| 491 |
{ |
| 492 |
\regex_match:nnTF { \A[rclRCL]*\Z } { #1 } |
| 493 |
{ \tl_set:Nn \l__witharrows_format_str { #1 } } |
| 494 |
{ \__witharrows_error:n { Invalid~option~format } } |
| 495 |
} , |
| 496 |
format .value_required:n = true |
| 497 |
} |
| 498 |
\keys_define:nn { WithArrows } |
| 499 |
{ |
| 500 |
WithArrows .inherit:n = |
| 501 |
{ |
| 502 |
WithArrows / Global , |
| 503 |
WithArrows / WithArrowsSpecific , |
| 504 |
WithArrows / Env |
| 505 |
} , |
| 506 |
WithArrows / up-and-down .inherit:n = WithArrows / up-and-down , |
| 507 |
DispWithArrows .inherit:n = |
| 508 |
{ |
| 509 |
WithArrows / DispWithArrowsSpecific , |
| 510 |
WithArrows / Global , |
| 511 |
WithArrows / Env , |
| 512 |
} , |
| 513 |
DispWithArrows / up-and-down .inherit:n = WithArrows / up-and-down , |
| 514 |
WithArrowsOptions .inherit:n = |
| 515 |
{ |
| 516 |
WithArrows / Global , |
| 517 |
WithArrows / WithArrowsSpecific , |
| 518 |
WithArrows / DispWithArrowsSpecific , |
| 519 |
} , |
| 520 |
WithArrowsOptions / up-and-down .inherit:n = WithArrows / up-and-down |
| 521 |
} |
| 522 |
\seq_new:N \l__witharrows_options_WithArrows_seq |
| 523 |
\__witharrows_set_seq_of_str_from_clist:Nn \l__witharrows_options_WithArrows_seq |
| 524 |
{ |
| 525 |
adjust, b, c, code-after, code-before, command-name, |
| 526 |
right-overlap, displaystyle, end-adjust, |
| 527 |
format, group, groups, i, |
| 528 |
interline, jot, ll, |
| 529 |
lr, max-length-of-arrow, more-columns, name, |
| 530 |
no-arrows, rl, rr, up-and-down, |
| 531 |
show-node-names, show-nodes, start-adjust, |
| 532 |
t, tikz, tikz-code, |
| 533 |
xoffset, ygap, ystart |
| 534 |
} |
| 535 |
\keys_define:nn { WithArrows / WithArrows } |
| 536 |
{ |
| 537 |
unknown .code:n = |
| 538 |
\__witharrows_sort_seq:N \l__witharrows_options_WithArrows_seq |
| 539 |
\__witharrows_error:n { Unknown~option~WithArrows } |
| 540 |
} |
| 541 |
\keys_define:nn { WithArrows / DispWithArrows } |
| 542 |
{ |
| 543 |
left-brace .tl_set:N = \l__witharrows_left_brace_tl , |
| 544 |
unknown .code:n = |
| 545 |
\__witharrows_sort_seq:N \l__witharrows_options_DispWithArrows_seq |
| 546 |
\__witharrows_error:n { Unknown~option~DispWithArrows } , |
| 547 |
} |
| 548 |
\seq_new:N \l__witharrows_options_DispWithArrows_seq |
| 549 |
\__witharrows_set_seq_of_str_from_clist:Nn \l__witharrows_options_DispWithArrows_seq |
| 550 |
{ |
| 551 |
code-after, code-before, command-name, tikz-code, adjust, |
| 552 |
displaystyle, end-adjust, fleqn, group, format, groups, i, interline, jot, |
| 553 |
left-brace, ll, lr, max-length-of-arrow, mathindent, name, no-arrows, |
| 554 |
up-and-down, replace-left-brace-by, rl, rr, show-node-names, |
| 555 |
show-nodes, start-adjust, tikz, wrap-lines, xoffset, ygap, ystart, |
| 556 |
allow-multiple-labels, tagged-lines, nonumber, notag |
| 557 |
} |
| 558 |
\keys_define:nn { WithArrows / WithArrowsOptions } |
| 559 |
{ |
| 560 |
allow-duplicate-names .code:n = |
| 561 |
\__witharrows_msg_redirect_name:nn { Duplicate~name } { none } , |
| 562 |
allow-duplicate-names .value_forbidden:n = true , |
| 563 |
xoffset-for-o-arrows .dim_set:N = \l__witharrows_xoffset_for_o_arrows_dim , |
| 564 |
xoffset-for-o-arrows .value_required:n = true , |
| 565 |
unknown .code:n = |
| 566 |
\__witharrows_sort_seq:N \l__witharrows_options_WithArrowsOptions_seq |
| 567 |
\__witharrows_error:n { Unknown~option~WithArrowsOptions } |
| 568 |
} |
| 569 |
\seq_new:N \l__witharrows_options_WithArrowsOptions_seq |
| 570 |
\__witharrows_set_seq_of_str_from_clist:Nn \l__witharrows_options_WithArrowsOptions_seq |
| 571 |
{ |
| 572 |
allow-duplicate-names, b, c, command-name, right_overlap, |
| 573 |
more-columns, tikz-code, adjust, |
| 574 |
displaystyle, end-adjust, fleqn, group, groups, i, interline, jot, ll, lr, |
| 575 |
mathindent, max-length-of-arrow, no-arrows, up-and-down, rl, rr, |
| 576 |
show-node-names, show-nodes, start-adjust, t, tikz, wrap-lines, xoffset, |
| 577 |
xoffset-for-o-arrows, ygap, ystart, |
| 578 |
allow-multiple-labels, nonumber, notag, standard-behaviour-with-items, |
| 579 |
tagged-lines |
| 580 |
} |
| 581 |
\cs_new_protected:Npn \__witharrows_set_independent: |
| 582 |
{ |
| 583 |
\str_if_eq:onF \l_keys_value_tl { NoValue } |
| 584 |
{ \__witharrows_error:n { Value~for~a~key } } |
| 585 |
\__witharrows_set_independent_bis: |
| 586 |
} |
| 587 |
\cs_new_protected:Npn \__witharrows_set_independent_bis: |
| 588 |
{ |
| 589 |
\str_if_empty:NTF \l__witharrows_previous_key_str |
| 590 |
{ |
| 591 |
\str_set_eq:NN \l__witharrows_previous_key_str \l_keys_key_str |
| 592 |
\str_set:Nn \l__witharrows_status_arrow_str { independent } |
| 593 |
} |
| 594 |
{ \__witharrows_error:n { Incompatible~options~in~Arrow } } |
| 595 |
} |
| 596 |
\keys_define:nn { WithArrows / Arrow / FirstPass } |
| 597 |
{ |
| 598 |
jump .code:n = |
| 599 |
\int_compare:nNnTF { #1 } > \c_zero_int |
| 600 |
{ \int_set:Nn \l__witharrows_jump_int { #1 } } |
| 601 |
{ \__witharrows_error:n { Negative~jump } } , |
| 602 |
jump .value_required:n = true, |
| 603 |
rr .code:n = \__witharrows_set_independent: , |
| 604 |
ll .code:n = \__witharrows_set_independent: , |
| 605 |
rl .code:n = \__witharrows_set_independent: , |
| 606 |
lr .code:n = \__witharrows_set_independent: , |
| 607 |
i .code:n = \__witharrows_set_independent: , |
| 608 |
rr .default:n = NoValue , |
| 609 |
ll .default:n = NoValue , |
| 610 |
rl .default:n = NoValue , |
| 611 |
lr .default:n = NoValue , |
| 612 |
i .default:n = NoValue , |
| 613 |
new-group .value_forbidden:n = true , |
| 614 |
new-group .code:n = |
| 615 |
\int_compare:nTF { \l__witharrows_pos_arrow_int = 6 } |
| 616 |
{ \str_set:Nn \l__witharrows_status_arrow_str { new-group } } |
| 617 |
{ \__witharrows_error:n { new-group~without~groups } } , |
| 618 |
o .code:n = |
| 619 |
\str_if_empty:NTF \l__witharrows_previous_key_str |
| 620 |
{ |
| 621 |
\int_compare:nNnTF \l__witharrows_pos_arrow_int < 6 |
| 622 |
{ \__witharrows_error:n { invalid~key~o } } |
| 623 |
{ |
| 624 |
\str_set:Nn \l__witharrows_status_arrow_str { over } |
| 625 |
\str_set_eq:NN \l__witharrows_previous_key_str \l_keys_key_str |
| 626 |
} |
| 627 |
} |
| 628 |
{ \__witharrows_error:n { Incompatible~options~in~Arrow } } , |
| 629 |
tikz-code .code:n = \prg_do_nothing: , |
| 630 |
tikz-code .value_required:n = true , |
| 631 |
tikz .code:n = \prg_do_nothing: , |
| 632 |
tikz .value_required:n = true , |
| 633 |
start-adjust .code:n = \prg_do_nothing: , |
| 634 |
start-adjust .value_required:n = true , |
| 635 |
end-adjust .code:n = \prg_do_nothing: , |
| 636 |
end-adjust .value_required:n = true , |
| 637 |
adjust .code:n = \prg_do_nothing: , |
| 638 |
adjust .value_required:n = true , |
| 639 |
xoffset .code:n = , |
| 640 |
unknown .code:n = |
| 641 |
\__witharrows_sort_seq:N \l__witharrows_options_Arrow_seq |
| 642 |
\seq_if_in:NoTF \l__witharrows_options_WithArrows_seq \l_keys_key_str |
| 643 |
{ |
| 644 |
\str_set:Nn \l_tmpa_str |
| 645 |
{ ~However,~this~key~can~be~used~in~the~options~of~{WithArrows}. } |
| 646 |
} |
| 647 |
{ \str_clear:N \l_tmpa_str } |
| 648 |
\__witharrows_error:n { Unknown~option~in~Arrow } |
| 649 |
} |
| 650 |
\seq_new:N \l__witharrows_options_Arrow_seq |
| 651 |
\__witharrows_set_seq_of_str_from_clist:Nn \l__witharrows_options_Arrow_seq |
| 652 |
{ |
| 653 |
adjust, end-adjust, i, jump, ll, lr, o , rl, rr, start-adjust, tikz, |
| 654 |
tikz-code, xoffset |
| 655 |
} |
| 656 |
\cs_new_protected:Npn \__witharrows_fix_pos_arrow:n #1 |
| 657 |
{ |
| 658 |
\str_if_empty:NT \l__witharrows_previous_key_str |
| 659 |
{ |
| 660 |
\str_set_eq:NN \l__witharrows_previous_key_str \l_keys_key_str |
| 661 |
\int_set:Nn \l__witharrows_pos_arrow_int { #1 } |
| 662 |
} |
| 663 |
} |
| 664 |
\keys_define:nn {WithArrows / Arrow / SecondPass } |
| 665 |
{ |
| 666 |
tikz-code .tl_set:N = \l__witharrows_tikz_code_tl , |
| 667 |
tikz-code .initial:n = \draw~(#1)~to~node{#3}~(#2)~; , |
| 668 |
tikz .code:n = \tikzset { WithArrows / arrow / .append~style = { #1 } } , |
| 669 |
rr .code:n = \__witharrows_fix_pos_arrow:n 3 , |
| 670 |
ll .code:n = \__witharrows_fix_pos_arrow:n 1 , |
| 671 |
rl .code:n = \__witharrows_fix_pos_arrow:n 2 , |
| 672 |
lr .code:n = \__witharrows_fix_pos_arrow:n 0 , |
| 673 |
i .code:n = \__witharrows_fix_pos_arrow:n 5 , |
| 674 |
o .code:n = \str_set:Nn \l__witharrows_previous_key_str { o } , |
| 675 |
xoffset .code:n = |
| 676 |
\bool_lazy_all:nTF |
| 677 |
{ |
| 678 |
{ \int_compare_p:nNn \g__witharrows_arrow_int > 1 } |
| 679 |
{ \int_compare_p:nNn \l__witharrows_pos_arrow_int > 5 } |
| 680 |
{ ! \str_if_eq_p:on \l__witharrows_status_arrow_str { independent } } |
| 681 |
} |
| 682 |
{ \__witharrows_error:n { Option~xoffset~forbidden } } |
| 683 |
{ \dim_set:Nn \l__witharrows_xoffset_dim { #1 } } , |
| 684 |
xoffset .value_required:n = true , |
| 685 |
start-adjust .dim_set:N = \l__witharrows_start_adjust_dim, |
| 686 |
end-adjust .dim_set:N = \l__witharrows_end_adjust_dim, |
| 687 |
adjust .code:n = |
| 688 |
\dim_set:Nn \l__witharrows_start_adjust_dim { #1 } |
| 689 |
\dim_set:Nn \l__witharrows_end_adjust_dim { #1 } , |
| 690 |
} |
| 691 |
\NewDocumentCommand \WithArrowsOptions { m } |
| 692 |
{ |
| 693 |
\str_clear_new:N \l__witharrows_previous_key_str |
| 694 |
\keys_set:nn { WithArrows / WithArrowsOptions } { #1 } |
| 695 |
} |
| 696 |
\cs_new_protected:Npn \__witharrows_Arrow |
| 697 |
{ \__witharrows_collect_options:n { \__witharrows_Arrow_iii } } |
| 698 |
\bool_if:NTF \g__witharrows_beamer_bool |
| 699 |
{ |
| 700 |
\NewDocumentCommand \__witharrows_Arrow_iii { m d < > m ! O { } } |
| 701 |
{ |
| 702 |
\tl_if_novalue:nTF { #2 } |
| 703 |
{ \__witharrows_Arrow_ii { #1 } { #3 } [ #4 ] } |
| 704 |
{ \only <#2> { \__witharrows_Arrow_ii { #1 } { #3 } [ #4 ] } } |
| 705 |
} |
| 706 |
} |
| 707 |
{ |
| 708 |
\NewDocumentCommand \__witharrows_Arrow_iii { m m ! O { } } |
| 709 |
{ \__witharrows_Arrow_ii { #1 } { #2 } [ #3 ] } |
| 710 |
} |
| 711 |
\NewDocumentCommand \__witharrows_Arrow_ii { m m ! O { } } |
| 712 |
{ |
| 713 |
\int_gincr:N \g__witharrows_arrow_int |
| 714 |
\str_clear_new:N \l__witharrows_previous_key_str |
| 715 |
\keys_set:nn { WithArrows / Arrow / FirstPass } { #1 , #3 } |
| 716 |
\prop_put:NnV \l_tmpa_prop { initial } \g__witharrows_line_int |
| 717 |
\int_set:Nn \l_tmpa_int { \g__witharrows_line_int + \l__witharrows_jump_int } |
| 718 |
\prop_put:NnV \l_tmpa_prop { final } \l_tmpa_int |
| 719 |
\prop_put:Nno \l_tmpa_prop { status } \l__witharrows_status_arrow_str |
| 720 |
\prop_put:Nnn \l_tmpa_prop { options } { #1 , #3 } |
| 721 |
\prop_put:Nnn \l_tmpa_prop { label } { #2 } |
| 722 |
\prop_put:Nne \l_tmpa_prop { input-line } \msg_line_number: |
| 723 |
\prop_put:Nnn \l_tmpa_prop { width } { 0 pt } |
| 724 |
\prop_gclear_new:c |
| 725 |
{ g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \g__witharrows_arrow_int _ prop } |
| 726 |
\prop_gset_eq:cN |
| 727 |
{ g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \g__witharrows_arrow_int _ prop } |
| 728 |
\l_tmpa_prop |
| 729 |
} |
| 730 |
\cs_new_protected:Npn \__witharrows_Arrow_first_columns: |
| 731 |
{ \__witharrows_error:n { Arrow~not~in~last~column } \__witharrows_Arrow } |
| 732 |
\cs_new_protected:Npn \__witharrows_pre_halign:n #1 |
| 733 |
{ |
| 734 |
\str_clear_new:N \l__witharrows_type_env_str |
| 735 |
\str_set:NV \l__witharrows_type_env_str \@currenvir |
| 736 |
\cs_if_exist:NT \tikz@library@external@loaded |
| 737 |
{ \tikzset { external / export = false } } |
| 738 |
\tikzset { arrows = [ flex ] } % https://texnique.fr/osqa/questions/12199 |
| 739 |
\str_clear_new:N \l__witharrows_name_str |
| 740 |
\str_clear_new:N \l__witharrows_status_arrow_str |
| 741 |
\dim_zero_new:N \l__witharrows_x_dim |
| 742 |
\str_clear_new:N \l__witharrows_input_line_str |
| 743 |
\seq_gput_right:NV \g__witharrows_arrow_int_seq \g__witharrows_arrow_int |
| 744 |
\int_gzero:N \g__witharrows_arrow_int |
| 745 |
\seq_gput_right:NV \g__witharrows_line_int_seq \g__witharrows_line_int |
| 746 |
\int_gzero:N \g__witharrows_line_int |
| 747 |
\seq_gput_right:NV \g__witharrows_col_int_seq \g__witharrows_col_int |
| 748 |
\int_gzero:N \g__witharrows_col_int |
| 749 |
\seq_gput_right:NV \g__witharrows_static_col_int_seq \g__witharrows_static_col_int |
| 750 |
\int_gzero:N \g__witharrows_static_col_int |
| 751 |
\seq_gput_right:Nn \g__witharrows_position_in_the_tree_seq 1 |
| 752 |
\seq_set_eq:NN \l_tmpa_seq \g__witharrows_position_in_the_tree_seq |
| 753 |
\seq_pop_right:NN \l_tmpa_seq \l_tmpa_tl |
| 754 |
\str_clear_new:N \l__witharrows_prefix_str |
| 755 |
\str_set:Ne \l__witharrows_prefix_str { \seq_use:Nnnn \l_tmpa_seq - - - } |
| 756 |
\cs_set_eq:NN \\ \__witharrows_cr: |
| 757 |
\dim_zero:N \mathsurround |
| 758 |
\int_zero_new:N \l__witharrows_initial_int |
| 759 |
\int_zero_new:N \l__witharrows_final_int |
| 760 |
\int_zero_new:N \l__witharrows_arrow_int |
| 761 |
\int_zero_new:N \l__witharrows_pos_of_arrow_int |
| 762 |
\int_zero_new:N \l__witharrows_jump_int |
| 763 |
\int_set:Nn \l__witharrows_jump_int 1 |
| 764 |
\str_set:Nn \l__witharrows_format_str { rL } |
| 765 |
\seq_clear_new:N \l__witharrows_labels_seq |
| 766 |
\bool_set_false:N \l__witharrows_tag_next_line_bool |
| 767 |
\skip_zero:N \l__witharrows_interline_skip |
| 768 |
\tl_clear_new:N \l__witharrows_code_before_tl |
| 769 |
\tl_clear_new:N \l__witharrows_code_after_tl |
| 770 |
\str_clear_new:N \l__witharrows_previous_key_str |
| 771 |
\bool_if:NT \l__witharrows_in_WithArrows_bool |
| 772 |
{ \keys_set:nn { WithArrows / WithArrows } { #1 } } |
| 773 |
\bool_if:NT \l__witharrows_in_DispWithArrows_bool |
| 774 |
{ \keys_set:nn { WithArrows / DispWithArrows } { #1 } } |
| 775 |
\bool_if:NF \l__witharrows_right_overlap_bool |
| 776 |
{ |
| 777 |
\bool_if:NT \l__witharrows_in_WithArrows_bool |
| 778 |
{ |
| 779 |
\dim_gzero_new:N \g__witharrows_overlap_x_dim |
| 780 |
\dim_zero_new:N \l__witharrows_delta_x_dim |
| 781 |
} |
| 782 |
} |
| 783 |
\cs_set_eq:cN \l__witharrows_command_name_str \__witharrows_Arrow_first_columns: |
| 784 |
\int_set:Nn \l__witharrows_nb_cols_int { \str_count:N \l__witharrows_format_str } |
| 785 |
\int_gset_eq:NN \g__witharrows_col_int \l__witharrows_nb_cols_int |
| 786 |
\seq_clear_new:N \l__witharrows_format_seq |
| 787 |
\seq_set_split:NnV \l__witharrows_format_seq { } \l__witharrows_format_str |
| 788 |
\bool_if:NT \c__witharrows_footnote_bool { \begin { savenotes } } |
| 789 |
\l__witharrows_code_before_tl |
| 790 |
\cs_set_eq:NN \notag \__witharrows_notag: |
| 791 |
\cs_set_eq:NN \nonumber \__witharrows_nonumber: |
| 792 |
\cs_set_eq:NN \tag \__witharrows_tag |
| 793 |
\cs_set_eq:NN \__witharrows_old_label \label |
| 794 |
\cs_set_eq:NN \label \__witharrows_label:n |
| 795 |
\cs_set_eq:NN \tagnextline \__witharrows_tagnextline: |
| 796 |
} |
| 797 |
\cs_new_protected:Npn \__witharrows_construct_halign: |
| 798 |
{ |
| 799 |
\seq_pop_right:NNTF \l__witharrows_format_seq \l__witharrows_type_col_str |
| 800 |
{ |
| 801 |
\use:e |
| 802 |
{ |
| 803 |
\int_gdecr:N \g__witharrows_col_int |
| 804 |
\__witharrows_construct_halign: |
| 805 |
\int_compare:nNnT \g__witharrows_col_int = \l__witharrows_nb_cols_int |
| 806 |
{ |
| 807 |
\cs_set_eq:cN { \l__witharrows_command_name_str } \__witharrows_Arrow |
| 808 |
\bool_if:NT \l__witharrows_in_DispWithArrows_bool |
| 809 |
{ |
| 810 |
\__witharrows_test_if_to_tag: |
| 811 |
\IfPackageLoadedT { amsmath } { \__witharrows_set_qedhere: } |
| 812 |
} |
| 813 |
} |
| 814 |
\str_if_eq:onT \l__witharrows_type_col_str { c } \hfil |
| 815 |
\str_if_eq:onT \l__witharrows_type_col_str { C } \hfil |
| 816 |
\str_if_eq:onT \l__witharrows_type_col_str { r } \hfill |
| 817 |
\str_if_eq:onT \l__witharrows_type_col_str { R } \hfill |
| 818 |
\int_gincr:N \g__witharrows_col_int |
| 819 |
\int_gset:Nn \g__witharrows_static_col_int { \int_use:N \g__witharrows_col_int } |
| 820 |
\c_math_toggle_token |
| 821 |
\str_if_eq:onT \l__witharrows_type_col_str { C } { { } } |
| 822 |
\str_if_eq:onT \l__witharrows_type_col_str { L } { { } } |
| 823 |
\bool_if:NT \l__witharrows_displaystyle_bool \displaystyle |
| 824 |
## |
| 825 |
\str_if_eq:onT \l__witharrows_type_col_str { C } { { } } |
| 826 |
\str_if_eq:onT \l__witharrows_type_col_str { R } { { } } |
| 827 |
\c_math_toggle_token |
| 828 |
\int_compare:nNnTF \g__witharrows_col_int = \l__witharrows_nb_cols_int |
| 829 |
\__witharrows_construct_nodes: |
| 830 |
{ |
| 831 |
\str_if_eq:onT \l__witharrows_type_col_str { l } \hfil |
| 832 |
\str_if_eq:onT \l__witharrows_type_col_str { L } \hfil |
| 833 |
\str_if_eq:onT \l__witharrows_type_col_str { c } \hfil |
| 834 |
\str_if_eq:onT \l__witharrows_type_col_str { C } \hfil |
| 835 |
\bool_if:NT \l__witharrows_in_DispWithArrows_bool { \tabskip = \c_zero_skip } |
| 836 |
& |
| 837 |
} |
| 838 |
} |
| 839 |
} |
| 840 |
{ |
| 841 |
\bool_if:NTF \l__witharrows_in_WithArrows_bool |
| 842 |
{ |
| 843 |
\ialign |
| 844 |
\bgroup |
| 845 |
} |
| 846 |
{ |
| 847 |
\halign to \l__witharrows_linewidth_dim |
| 848 |
\bgroup |
| 849 |
\bool_if:NT \l__witharrows_fleqn_bool |
| 850 |
{ \skip_horizontal:N \l__witharrows_mathindent_skip } |
| 851 |
} |
| 852 |
\int_gincr:N \g__witharrows_line_int |
| 853 |
\int_gzero:N \g__witharrows_col_int |
| 854 |
\tl_if_eq:NNF \l__witharrows_left_brace_tl \c_novalue_tl |
| 855 |
{ |
| 856 |
\skip_horizontal:n |
| 857 |
{ \box_wd:N \l__witharrows_left_brace_box + \l__witharrows_delim_wd_dim } |
| 858 |
} |
| 859 |
\strut |
| 860 |
} |
| 861 |
} |
| 862 |
\cs_new_protected:Npn \__witharrows_construct_nodes: |
| 863 |
{ |
| 864 |
\tikz [ remember~picture , overlay ] |
| 865 |
\node |
| 866 |
[ |
| 867 |
node~contents = { } , |
| 868 |
__witharrows_node_style , |
| 869 |
name = wa - \l__witharrows_prefix_str - \int_use:N \g__witharrows_line_int - l , |
| 870 |
] |
| 871 |
; |
| 872 |
\hfil |
| 873 |
\tikz [ remember~picture , overlay ] |
| 874 |
\node |
| 875 |
[ |
| 876 |
node~contents = { } , |
| 877 |
__witharrows_node_style , |
| 878 |
name = wa - \l__witharrows_prefix_str - \int_use:N \g__witharrows_line_int - r , |
| 879 |
] |
| 880 |
; |
| 881 |
\str_if_empty:NF \l__witharrows_name_str |
| 882 |
{ |
| 883 |
\pgfpicture |
| 884 |
\pgfnodealias |
| 885 |
{ \l__witharrows_name_str - \int_use:N \g__witharrows_line_int - l } |
| 886 |
{ wa - \l__witharrows_prefix_str - \int_use:N \g__witharrows_line_int - l } |
| 887 |
\pgfnodealias |
| 888 |
{ \l__witharrows_name_str - \int_use:N \g__witharrows_line_int - r } |
| 889 |
{ wa - \l__witharrows_prefix_str - \int_use:N \g__witharrows_line_int - r } |
| 890 |
\endpgfpicture |
| 891 |
} |
| 892 |
\bool_if:NT \l__witharrows_show_node_names_bool |
| 893 |
{ |
| 894 |
\hbox_overlap_right:n |
| 895 |
{ \small wa - \l__witharrows_prefix_str - \int_use:N \g__witharrows_line_int - r } |
| 896 |
} |
| 897 |
} |
| 898 |
\NewDocumentEnvironment { WithArrows } { ! O { } } |
| 899 |
{ |
| 900 |
\bool_set_true:N \l__witharrows_in_WithArrows_bool |
| 901 |
\bool_set_false:N \l__witharrows_in_DispWithArrows_bool |
| 902 |
\__witharrows_pre_halign:n { #1 } |
| 903 |
\if_mode_math: \else: |
| 904 |
\__witharrows_error:n { WithArrows~outside~math~mode } |
| 905 |
\fi: |
| 906 |
\box_clear_new:N \l__witharrows_env_box |
| 907 |
\hbox_set:Nw \l__witharrows_env_box |
| 908 |
\int_compare:nNnT \l__witharrows_pos_env_int = 1 \c_math_toggle_token |
| 909 |
\int_case:nn \l__witharrows_pos_env_int { 0 \vtop 1 \vcenter 2 \vbox } |
| 910 |
\bgroup |
| 911 |
\spread@equation |
| 912 |
\__witharrows_construct_halign: |
| 913 |
&& |
| 914 |
\__witharrows_error:n { Too~much~columns~in~WithArrows } |
| 915 |
\c_math_toggle_token |
| 916 |
\bool_if:NT \l__witharrows_displaystyle_bool \displaystyle |
| 917 |
{ ## } |
| 918 |
\c_math_toggle_token |
| 919 |
\cr |
| 920 |
} |
| 921 |
{ |
| 922 |
\\ |
| 923 |
\egroup |
| 924 |
\egroup |
| 925 |
\int_compare:nNnT \l__witharrows_pos_env_int = 1 \c_math_toggle_token |
| 926 |
\hbox_set_end: |
| 927 |
\__witharrows_post_halign: |
| 928 |
\bool_if:NF \l__witharrows_right_overlap_bool |
| 929 |
{ |
| 930 |
\box_set_wd:Nn \l__witharrows_env_box |
| 931 |
{ \g__witharrows_overlap_x_dim + \box_wd:N \l__witharrows_env_box } |
| 932 |
} |
| 933 |
\box_use_drop:N \l__witharrows_env_box |
| 934 |
\bool_if:NT \c__witharrows_footnote_bool { \end { savenotes } } |
| 935 |
} |
| 936 |
\cs_new_protected:Npn \__witharrows_post_halign: |
| 937 |
{ |
| 938 |
\cs_set:Npn \WithArrowsRightX { \g__witharrows_right_x_dim } |
| 939 |
\normalbaselines |
| 940 |
\int_if_zero:nF \g__witharrows_arrow_int |
| 941 |
{ |
| 942 |
\int_compare:nNnT \g__witharrows_arrow_int = 1 |
| 943 |
{ |
| 944 |
\int_compare:nNnT \l__witharrows_pos_arrow_int > 5 |
| 945 |
{ \int_set:Nn \l__witharrows_pos_arrow_int 5 } |
| 946 |
} |
| 947 |
\__witharrows_scan_arrows: |
| 948 |
} |
| 949 |
\group_begin: |
| 950 |
\tikzset { every~picture / .style = __witharrows_standard } |
| 951 |
\cs_set:Npn \WithArrowsNbLines { \int_use:N \g__witharrows_line_int } |
| 952 |
\cs_set_eq:NN \MultiArrow \__witharrows_MultiArrow:nn |
| 953 |
\cs_set_eq:cN \l__witharrows_command_name_str \__witharrows_Arrow_code_after |
| 954 |
\bool_set_true:N \l__witharrows_in_code_after_bool |
| 955 |
\l__witharrows_code_after_tl |
| 956 |
\group_end: |
| 957 |
\seq_gpop_right:NN \g__witharrows_position_in_the_tree_seq \l_tmpa_tl |
| 958 |
\seq_gpop_right:NN \g__witharrows_position_in_the_tree_seq \l_tmpa_tl |
| 959 |
\seq_gput_right:Ne \g__witharrows_position_in_the_tree_seq |
| 960 |
{ \int_eval:n { \l_tmpa_tl + 1 } } |
| 961 |
\int_compare:nNnT { \seq_count:N \g__witharrows_position_in_the_tree_seq } = 1 |
| 962 |
{ \int_gincr:N \g__witharrows_last_env_int } |
| 963 |
\seq_gpop_right:NN \g__witharrows_arrow_int_seq \l_tmpa_tl |
| 964 |
\int_gset:Nn \g__witharrows_arrow_int \l_tmpa_tl |
| 965 |
\seq_gpop_right:NN \g__witharrows_line_int_seq \l_tmpa_tl |
| 966 |
\int_gset:Nn \g__witharrows_line_int \l_tmpa_tl |
| 967 |
\seq_gpop_right:NN \g__witharrows_col_int_seq \l_tmpa_tl |
| 968 |
\int_gset:Nn \g__witharrows_col_int \l_tmpa_tl |
| 969 |
\seq_gpop_right:NN \g__witharrows_static_col_int_seq \l_tmpa_tl |
| 970 |
\int_gset:Nn \g__witharrows_static_col_int \l_tmpa_tl |
| 971 |
} |
| 972 |
\cs_new_protected:Npn \__witharrows_cr: |
| 973 |
{ |
| 974 |
\scan_stop: |
| 975 |
\int_compare:nNnF \g__witharrows_col_int = \g__witharrows_static_col_int |
| 976 |
{ \__witharrows_error:n { omit~probably~used } } |
| 977 |
\prg_replicate:nn { \l__witharrows_nb_cols_int - \g__witharrows_static_col_int } { & { } } |
| 978 |
\group_align_safe_begin: |
| 979 |
\peek_meaning_remove:NTF * \__witharrows_cr_i: \__witharrows_cr_i: |
| 980 |
} |
| 981 |
\cs_new_protected:Npn \__witharrows_cr_i: |
| 982 |
{ \peek_meaning:NTF [ \__witharrows_cr_ii: { \__witharrows_cr_ii: [ \c_zero_dim ] } } |
| 983 |
\cs_new_protected:Npn \__witharrows_cr_ii: [ #1 ] |
| 984 |
{ |
| 985 |
\peek_remove_spaces:n |
| 986 |
{ |
| 987 |
\peek_meaning:NTF \end |
| 988 |
{ |
| 989 |
\__witharrows_cr_iii:n { #1 } |
| 990 |
\__witharrows_analyze_end:Nn |
| 991 |
} |
| 992 |
{ \__witharrows_cr_iii:n { #1 } } |
| 993 |
} |
| 994 |
} |
| 995 |
\cs_new_protected:Npn \__witharrows_cr_iii:n #1 |
| 996 |
{ |
| 997 |
\group_align_safe_end: |
| 998 |
\bool_if:NT \l__witharrows_in_DispWithArrows_bool |
| 999 |
{ |
| 1000 |
\clist_if_in:NnTF \l__witharrows_tags_clist { all } |
| 1001 |
{ |
| 1002 |
\tl_if_empty:NT \l__witharrows_tag_tl { \int_gincr:N \c@equation } |
| 1003 |
\cs_gset:Npe \g_tmpa_tl |
| 1004 |
{ \tl_if_empty:NTF \l__witharrows_tag_tl \theequation \l__witharrows_tag_tl } |
| 1005 |
\seq_if_empty:NF \l__witharrows_labels_seq |
| 1006 |
{ |
| 1007 |
\cs_set:Npe \@currentlabel { \p@equation \g_tmpa_tl } |
| 1008 |
\IfPackageLoadedT { hyperref } |
| 1009 |
{ |
| 1010 |
% the following line is probably pointless (2022/05/16) |
| 1011 |
% \str_set:Nn \This@name { equation } |
| 1012 |
\hyper@refstepcounter { equation } |
| 1013 |
} |
| 1014 |
\IfPackageLoadedT { cleveref } |
| 1015 |
{ |
| 1016 |
\cref@constructprefix { equation } \cref@result |
| 1017 |
\protected@edef \cref@currentlabel |
| 1018 |
{ |
| 1019 |
[ |
| 1020 |
\cs_if_exist:NTF \cref@equation@alias |
| 1021 |
\cref@equation@alias |
| 1022 |
{ equation } |
| 1023 |
] |
| 1024 |
[ \arabic { equation } ] [ \cref@result ] |
| 1025 |
\p@equation \g_tmpa_tl |
| 1026 |
} |
| 1027 |
} |
| 1028 |
\seq_map_function:NN \l__witharrows_labels_seq \__witharrows_old_label |
| 1029 |
} |
| 1030 |
\__witharrows_save:N \l__witharrows_tag_star_bool |
| 1031 |
\__witharrows_save:N \l__witharrows_qedhere_bool |
| 1032 |
\bool_if:NT \l__witharrows_tag_next_line_bool |
| 1033 |
{ |
| 1034 |
\openup -\jot |
| 1035 |
\bool_set_false:N \l__witharrows_tag_next_line_bool |
| 1036 |
\notag \\ & |
| 1037 |
} |
| 1038 |
& |
| 1039 |
\__witharrows_restore:N \l__witharrows_tag_star_bool |
| 1040 |
\__witharrows_restore:N \l__witharrows_qedhere_bool |
| 1041 |
\bool_if:NT \l__witharrows_qedhere_bool |
| 1042 |
{ \hbox_overlap_left:n \__witharrows_qedhere_i: } |
| 1043 |
\cs_set_eq:NN \theequation \g_tmpa_tl |
| 1044 |
\bool_if:NT \l__witharrows_tag_star_bool |
| 1045 |
{ \cs_set_eq:NN \tagform@ \prg_do_nothing: } |
| 1046 |
\hbox_overlap_left:n |
| 1047 |
{ |
| 1048 |
\bool_if:NF \c__witharrows_leqno_bool |
| 1049 |
{ |
| 1050 |
\pgfpicture |
| 1051 |
\pgfrememberpicturepositiononpagetrue |
| 1052 |
\pgfcoordinate |
| 1053 |
{ wa - \l__witharrows_prefix_str - \int_use:N \g__witharrows_line_int - v } |
| 1054 |
\pgfpointorigin |
| 1055 |
\endpgfpicture |
| 1056 |
} |
| 1057 |
\quad |
| 1058 |
\@eqnnum |
| 1059 |
} |
| 1060 |
\bool_if:NT \c__witharrows_leqno_bool |
| 1061 |
{ |
| 1062 |
\pgfpicture |
| 1063 |
\pgfrememberpicturepositiononpagetrue |
| 1064 |
\pgfcoordinate |
| 1065 |
{ wa - \l__witharrows_prefix_str - \int_use:N \g__witharrows_line_int - v } |
| 1066 |
\pgfpointorigin |
| 1067 |
\endpgfpicture |
| 1068 |
} |
| 1069 |
} |
| 1070 |
{ |
| 1071 |
\__witharrows_save:N \l__witharrows_qedhere_bool |
| 1072 |
& |
| 1073 |
\__witharrows_restore:N \l__witharrows_qedhere_bool |
| 1074 |
\bool_if:NT \l__witharrows_qedhere_bool |
| 1075 |
{ \hbox_overlap_left:n \__witharrows_qedhere_i: } |
| 1076 |
\pgfpicture |
| 1077 |
\pgfrememberpicturepositiononpagetrue |
| 1078 |
\pgfcoordinate |
| 1079 |
{ wa - \l__witharrows_prefix_str - \int_use:N \g__witharrows_line_int - v } |
| 1080 |
\pgfpointorigin |
| 1081 |
\endpgfpicture |
| 1082 |
} |
| 1083 |
} |
| 1084 |
\dim_compare:nNnT { #1 } < \c_zero_dim |
| 1085 |
{ \__witharrows_error:n { option~of~cr~negative } } |
| 1086 |
|
| 1087 |
\cr |
| 1088 |
\noalign |
| 1089 |
{ |
| 1090 |
\dim_set:Nn \l_tmpa_dim { \dim_max:nn { #1 } \c_zero_dim } |
| 1091 |
\skip_vertical:N \l_tmpa_dim |
| 1092 |
\skip_vertical:N \l__witharrows_interline_skip |
| 1093 |
\scan_stop: |
| 1094 |
} |
| 1095 |
} |
| 1096 |
\cs_new_protected:Npn \__witharrows_analyze_end:Nn #1 #2 |
| 1097 |
{ |
| 1098 |
\str_if_eq:onT \l__witharrows_type_env_str { #2 } |
| 1099 |
{ |
| 1100 |
\__witharrows_error:n { newline~at~the~end~of~env } |
| 1101 |
\group_begin: |
| 1102 |
\globaldefs = 1 |
| 1103 |
\__witharrows_msg_redirect_name:nn { newline~at~the~end~of~env } { none } |
| 1104 |
\group_end: |
| 1105 |
} |
| 1106 |
\end { #2 } |
| 1107 |
} |
| 1108 |
\bool_new:N \l__witharrows_in_label_or_minipage_bool |
| 1109 |
\NewDocumentEnvironment { DispWithArrows } { ! d < > ! O { } } |
| 1110 |
{ |
| 1111 |
\bool_set_true:N \l__witharrows_in_DispWithArrows_bool |
| 1112 |
\bool_if:NF \l__witharrows_sbwi_bool |
| 1113 |
{ |
| 1114 |
\legacy_if:nT { @inlabel } |
| 1115 |
{ \bool_set_true:N \l__witharrows_in_label_or_minipage_bool } |
| 1116 |
\legacy_if:nT { @minipage } |
| 1117 |
{ \bool_set_true:N \l__witharrows_in_label_or_minipage_bool } |
| 1118 |
} |
| 1119 |
\IfPackageLoadedT { mathtools } |
| 1120 |
{ |
| 1121 |
\MH_if_boolean:nT { show_only_refs } |
| 1122 |
{ |
| 1123 |
\MT_showonlyrefs_false: |
| 1124 |
\MH_set_boolean_T:n { show_only_refs } |
| 1125 |
} |
| 1126 |
} |
| 1127 |
\IfPackageLoadedT { typedref } |
| 1128 |
{ \str_set:Nn \sr@name { equation } } |
| 1129 |
\IfPackageLoadedT { amsmath } { \intertext@ } |
| 1130 |
\tl_if_novalue:oF { #1 } |
| 1131 |
{ \cs_set_nopar:Npn \l__witharrows_left_brace_tl { #1 } } |
| 1132 |
\__witharrows_pre_halign:n { #2 } |
| 1133 |
\bool_if:NT \l__witharrows_subequations_bool { \begin { subequations } } |
| 1134 |
\tl_if_eq:NNF \l__witharrows_left_brace_tl \c_novalue_tl |
| 1135 |
{ |
| 1136 |
\hbox_set:Nn \l_tmpa_box |
| 1137 |
{ |
| 1138 |
\group_begin: |
| 1139 |
\dim_zero:N \nulldelimiterspace |
| 1140 |
\c_math_toggle_token |
| 1141 |
\left \l__witharrows_replace_left_brace_by_tl \vcenter to 1 cm { } \right. |
| 1142 |
\c_math_toggle_token |
| 1143 |
\group_end: |
| 1144 |
} |
| 1145 |
\dim_zero_new:N \l__witharrows_delim_wd_dim |
| 1146 |
\dim_set:Nn \l__witharrows_delim_wd_dim { \box_wd:N \l_tmpa_box } |
| 1147 |
\box_clear_new:N \l__witharrows_left_brace_box |
| 1148 |
\hbox_set:Nn \l__witharrows_left_brace_box |
| 1149 |
{ |
| 1150 |
\group_begin: |
| 1151 |
\cs_set_eq:NN \label \__witharrows_old_label |
| 1152 |
\c_math_toggle_token |
| 1153 |
\bool_if:NT \l__witharrows_displaystyle_bool \displaystyle |
| 1154 |
\l__witharrows_left_brace_tl |
| 1155 |
{ } |
| 1156 |
\c_math_toggle_token |
| 1157 |
\group_end: |
| 1158 |
} |
| 1159 |
} |
| 1160 |
\tl_clear_new:N \l__witharrows_tag_tl |
| 1161 |
\bool_set_false:N \l__witharrows_qedhere_bool |
| 1162 |
\bool_set_false:N \l__witharrows_tag_star_bool |
| 1163 |
\if_mode_math: |
| 1164 |
\__witharrows_fatal:n { DispWithArrows~in~math~mode } |
| 1165 |
\fi: |
| 1166 |
\bool_if:NTF \l__witharrows_in_label_or_minipage_bool |
| 1167 |
{ |
| 1168 |
\noindent |
| 1169 |
\c_math_toggle_token |
| 1170 |
} |
| 1171 |
{ |
| 1172 |
\if_mode_vertical: |
| 1173 |
\nointerlineskip |
| 1174 |
\hbox_to_wd:nn { .6 \linewidth } { } |
| 1175 |
\fi: |
| 1176 |
\c_math_toggle_token \c_math_toggle_token |
| 1177 |
} |
| 1178 |
\dim_zero_new:N \l__witharrows_linewidth_dim |
| 1179 |
\bool_if:NTF \l__witharrows_in_label_or_minipage_bool |
| 1180 |
{ \dim_set_eq:NN \l__witharrows_linewidth_dim \linewidth } |
| 1181 |
{ \dim_set_eq:NN \l__witharrows_linewidth_dim \displaywidth } |
| 1182 |
\box_clear_new:N \l__witharrows_halign_box |
| 1183 |
\setbox \l__witharrows_halign_box \vtop \bgroup |
| 1184 |
\tabskip = |
| 1185 |
\bool_if:NTF \l__witharrows_fleqn_bool |
| 1186 |
\c_zero_skip |
| 1187 |
{ 0 pt plus 1000 pt minus 1000 pt } |
| 1188 |
\spread@equation |
| 1189 |
\__witharrows_construct_halign: |
| 1190 |
\tabskip = 0 pt plus 1000 pt minus 1000 pt |
| 1191 |
& |
| 1192 |
$ ## $ |
| 1193 |
\tabskip = \c_zero_skip |
| 1194 |
&& |
| 1195 |
\__witharrows_fatal:n { Too~much~columns~in~DispWithArrows } |
| 1196 |
\bool_if:nT \c_false_bool { ## } |
| 1197 |
\cr |
| 1198 |
} |
| 1199 |
{ |
| 1200 |
\clist_if_in:NnT \l__witharrows_tags_clist { last } |
| 1201 |
{ \clist_set:Nn \l__witharrows_tags_clist { all } } |
| 1202 |
\\ |
| 1203 |
\egroup |
| 1204 |
\unskip \unpenalty \unskip \unpenalty |
| 1205 |
\box_set_to_last:N \l_tmpa_box |
| 1206 |
\nointerlineskip |
| 1207 |
\box_use:N \l_tmpa_box |
| 1208 |
\dim_gzero_new:N \g__witharrows_alignment_dim |
| 1209 |
\dim_gset:Nn \g__witharrows_alignment_dim { \box_wd:N \l_tmpa_box } |
| 1210 |
\box_clear_new:N \l__witharrows_new_box |
| 1211 |
\hbox_set:Nn \l__witharrows_new_box { \hbox_unpack_drop:N \l_tmpa_box } |
| 1212 |
\dim_compare:nNnT |
| 1213 |
{ \box_wd:N \l__witharrows_new_box } < \g__witharrows_alignment_dim |
| 1214 |
{ \dim_gset:Nn \g__witharrows_alignment_dim { \box_wd:N \l__witharrows_new_box } } |
| 1215 |
\egroup |
| 1216 |
\tl_if_eq:NNTF \l__witharrows_left_brace_tl \c_novalue_tl |
| 1217 |
{ \box_use_drop:N \l__witharrows_halign_box } |
| 1218 |
{ |
| 1219 |
\hbox_to_wd:nn \l__witharrows_linewidth_dim |
| 1220 |
{ |
| 1221 |
\bool_if:NTF \l__witharrows_fleqn_bool |
| 1222 |
{ \skip_horizontal:N \l__witharrows_mathindent_skip } |
| 1223 |
\hfil |
| 1224 |
\hbox_to_wd:nn \g__witharrows_alignment_dim |
| 1225 |
{ |
| 1226 |
\box_use_drop:N \l__witharrows_left_brace_box |
| 1227 |
\dim_set:Nn \l_tmpa_dim |
| 1228 |
{ |
| 1229 |
\box_ht:N \l__witharrows_halign_box |
| 1230 |
+ \box_dp:N \l__witharrows_halign_box |
| 1231 |
} |
| 1232 |
\group_begin: |
| 1233 |
\dim_zero:N \nulldelimiterspace |
| 1234 |
\c_math_toggle_token |
| 1235 |
\left \l__witharrows_replace_left_brace_by_tl |
| 1236 |
\vcenter to \l_tmpa_dim { \vfil } |
| 1237 |
\right. |
| 1238 |
\c_math_toggle_token |
| 1239 |
\group_end: |
| 1240 |
\hfil |
| 1241 |
} |
| 1242 |
\hfil |
| 1243 |
} |
| 1244 |
\skip_horizontal:N -\l__witharrows_linewidth_dim |
| 1245 |
\vcenter { \box_use_drop:N \l__witharrows_halign_box } |
| 1246 |
} |
| 1247 |
\dim_gzero_new:N \g__witharrows_right_x_dim |
| 1248 |
\dim_gset_eq:NN \g__witharrows_right_x_dim \c_max_dim |
| 1249 |
\pgfpicture |
| 1250 |
\pgfrememberpicturepositiononpagetrue |
| 1251 |
\int_step_variable:nNn \g__witharrows_line_int \l_tmpa_int |
| 1252 |
{ |
| 1253 |
\cs_if_free:cTF |
| 1254 |
{ pgf @ sh @ ns @ wa - \l__witharrows_prefix_str - \l_tmpa_int - v } |
| 1255 |
{ \__witharrows_fatal:n { Inexistent~v-node } } |
| 1256 |
{ |
| 1257 |
\pgfpointanchor |
| 1258 |
{ wa - \l__witharrows_prefix_str - \l_tmpa_int - v } |
| 1259 |
{ center } |
| 1260 |
\dim_compare:nNnT \pgf@x < \g__witharrows_right_x_dim |
| 1261 |
{ \dim_gset_eq:NN \g__witharrows_right_x_dim \pgf@x } |
| 1262 |
} |
| 1263 |
} |
| 1264 |
\endpgfpicture |
| 1265 |
\__witharrows_post_halign: |
| 1266 |
\IfPackageLoadedT { mathtools } |
| 1267 |
{ \MH_if_boolean:nT { show_only_refs } \MT_showonlyrefs_true: } |
| 1268 |
\bool_if:NTF \l__witharrows_in_label_or_minipage_bool |
| 1269 |
{ |
| 1270 |
\c_math_toggle_token |
| 1271 |
\skip_vertical:N \belowdisplayskip |
| 1272 |
} |
| 1273 |
{ \c_math_toggle_token \c_math_toggle_token } |
| 1274 |
\bool_if:NT \l__witharrows_subequations_bool { \end { subequations } } |
| 1275 |
\bool_if:NT \c__witharrows_footnote_bool { \end { savenotes } } |
| 1276 |
\ignorespacesafterend |
| 1277 |
} |
| 1278 |
\NewDocumentEnvironment { DispWithArrows* } { } |
| 1279 |
{ |
| 1280 |
\WithArrowsOptions { notag } |
| 1281 |
\DispWithArrows |
| 1282 |
} |
| 1283 |
\endDispWithArrows |
| 1284 |
\cs_new_protected:Npn \__witharrows_if_in_last_col_of_disp:Nn #1 #2 |
| 1285 |
{ |
| 1286 |
\bool_if:NTF \l__witharrows_in_WithArrows_bool |
| 1287 |
{ \__witharrows_error:nn { Not~allowed~in~WithArrows } { #1 } } |
| 1288 |
{ |
| 1289 |
\int_compare:nNnTF \g__witharrows_col_int < \l__witharrows_nb_cols_int |
| 1290 |
{ \__witharrows_error:nn { Not~allowed~in~DispWithArrows } { #1 } } |
| 1291 |
{ #2 } |
| 1292 |
} |
| 1293 |
} |
| 1294 |
\cs_new_protected:Npn \__witharrows_notag: |
| 1295 |
{ \__witharrows_if_in_last_col_of_disp:Nn \notag { \clist_clear:N \l__witharrows_tags_clist } } |
| 1296 |
\cs_new_protected:Npn \__witharrows_nonumber: |
| 1297 |
{ \__witharrows_if_in_last_col_of_disp:Nn \nonumber { \clist_clear:N \l__witharrows_tags_clist } } |
| 1298 |
\NewDocumentCommand \__witharrows_tag { s m } |
| 1299 |
{ |
| 1300 |
\__witharrows_if_in_last_col_of_disp:Nn \tag |
| 1301 |
{ |
| 1302 |
\tl_if_empty:NF \l__witharrows_tag_tl |
| 1303 |
{ \__witharrows_error:nn { Multiple~tags } { #2 } } |
| 1304 |
\clist_set:Nn \l__witharrows_tags_clist { all } |
| 1305 |
\IfPackageLoadedT { mathtools } |
| 1306 |
{ |
| 1307 |
\MH_if_boolean:nT { show_only_refs } |
| 1308 |
{ |
| 1309 |
\MH_if_boolean:nF { show_manual_tags } |
| 1310 |
{ \clist_clear:N \l__witharrows_tags_clist } |
| 1311 |
} |
| 1312 |
} |
| 1313 |
\tl_set:Nn \l__witharrows_tag_tl { #2 } |
| 1314 |
\bool_set:Nn \l__witharrows_tag_star_bool { #1 } |
| 1315 |
\bool_if:nT { #1 } |
| 1316 |
{ |
| 1317 |
\IfPackageLoadedF { amsmath } |
| 1318 |
{ \__witharrows_error:n { tag*~without~amsmath } } |
| 1319 |
} |
| 1320 |
} |
| 1321 |
} |
| 1322 |
\cs_new_protected:Npn \__witharrows_label:n #1 |
| 1323 |
{ |
| 1324 |
\__witharrows_if_in_last_col_of_disp:Nn \label |
| 1325 |
{ |
| 1326 |
\seq_if_empty:NF \l__witharrows_labels_seq |
| 1327 |
{ |
| 1328 |
\IfPackageLoadedTF { cleveref } |
| 1329 |
{ \__witharrows_error:n { Multiple~labels~with~cleveref } } |
| 1330 |
{ \__witharrows_error:n { Multiple~labels } } |
| 1331 |
} |
| 1332 |
\seq_put_right:Nn \l__witharrows_labels_seq { #1 } |
| 1333 |
\IfPackageLoadedT { mathtools } |
| 1334 |
{ |
| 1335 |
\MH_if_boolean:nT { show_only_refs } |
| 1336 |
{ |
| 1337 |
\cs_if_exist:cTF { MT_r_#1 } |
| 1338 |
{ \clist_set:Nn \l__witharrows_tags_clist { all } } |
| 1339 |
{ \clist_clear:N \l__witharrows_tags_clist } |
| 1340 |
} |
| 1341 |
} |
| 1342 |
\IfPackageLoadedT { autonum } |
| 1343 |
{ |
| 1344 |
\cs_if_exist:cTF { autonum@#1Referenced } |
| 1345 |
{ \clist_set:Nn \l__witharrows_tags_clist { all } } |
| 1346 |
{ \clist_clear:N \l__witharrows_tags_clist } |
| 1347 |
} |
| 1348 |
} |
| 1349 |
} |
| 1350 |
\cs_new_protected:Npn \__witharrows_tagnextline: |
| 1351 |
{ |
| 1352 |
\__witharrows_if_in_last_col_of_disp:Nn \tagnextline |
| 1353 |
{ \bool_set_true:N \l__witharrows_tag_next_line_bool } |
| 1354 |
} |
| 1355 |
\cs_new_protected:Npn \__witharrows_qedhere: { \bool_set_true:N \l__witharrows_qedhere_bool } |
| 1356 |
\cs_new_protected:Npn \__witharrows_set_qedhere: { \cs_set_eq:NN \qedhere \__witharrows_qedhere: } |
| 1357 |
\cs_new_protected:Npn \__witharrows_qedhere_i: |
| 1358 |
{ |
| 1359 |
\group_begin: |
| 1360 |
\cs_set_eq:NN \qed \qedsymbol |
| 1361 |
\cs_set_eq:NN \qed@elt \setQED@elt |
| 1362 |
\QED@stack \relax \relax |
| 1363 |
\group_end: |
| 1364 |
} |
| 1365 |
\cs_new_protected:Npn \__witharrows_scan_arrows: |
| 1366 |
{ |
| 1367 |
\group_begin: |
| 1368 |
\int_compare:nNnT \l__witharrows_pos_arrow_int = 7 |
| 1369 |
{ |
| 1370 |
\__witharrows_scan_arrows_i: |
| 1371 |
\int_set:Nn \l__witharrows_pos_arrow_int 8 |
| 1372 |
} |
| 1373 |
\__witharrows_scan_arrows_i: |
| 1374 |
\group_end: |
| 1375 |
} |
| 1376 |
\cs_new_protected:Npn \__witharrows_scan_arrows_i: |
| 1377 |
{ |
| 1378 |
\int_zero_new:N \l__witharrows_first_arrow_of_group_int |
| 1379 |
\int_zero_new:N \l__witharrows_first_line_of_group_int |
| 1380 |
\int_zero_new:N \l__witharrows_last_line_of_group_int |
| 1381 |
\seq_clear_new:N \l__witharrows_first_arrows_seq |
| 1382 |
\seq_clear_new:N \l__witharrows_last_arrows_seq |
| 1383 |
\bool_set_true:N \l__witharrows_new_group_bool |
| 1384 |
\int_set:Nn \l__witharrows_arrow_int 1 |
| 1385 |
\int_until_do:nNnn \l__witharrows_arrow_int > \g__witharrows_arrow_int |
| 1386 |
{ |
| 1387 |
\prop_get:cnN |
| 1388 |
{ g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop } |
| 1389 |
{ initial } \l_tmpa_tl |
| 1390 |
\int_set:Nn \l__witharrows_initial_int \l_tmpa_tl |
| 1391 |
\prop_get:cnN |
| 1392 |
{ g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop } |
| 1393 |
{ final } \l_tmpa_tl |
| 1394 |
\int_set:Nn \l__witharrows_final_int \l_tmpa_tl |
| 1395 |
\prop_get:cnN |
| 1396 |
{ g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop } |
| 1397 |
{ status } \l__witharrows_status_arrow_str |
| 1398 |
\prop_get:cnN |
| 1399 |
{ g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop } |
| 1400 |
{ input-line } \l__witharrows_input_line_str |
| 1401 |
\int_compare:nNnTF \l__witharrows_final_int > \g__witharrows_line_int |
| 1402 |
{ |
| 1403 |
\int_compare:nNnF \l__witharrows_pos_arrow_int = 8 |
| 1404 |
{ \__witharrows_error:n { Too~few~lines~for~an~arrow } } |
| 1405 |
} |
| 1406 |
\__witharrows_treat_an_arrow_in_scan: |
| 1407 |
\int_incr:N \l__witharrows_arrow_int |
| 1408 |
} |
| 1409 |
\bool_lazy_and:nnT |
| 1410 |
{ ! \int_compare_p:nNn \l__witharrows_pos_arrow_int = 7 } |
| 1411 |
{ \int_compare_p:nNn \l__witharrows_first_arrow_of_group_int > \c_zero_int } |
| 1412 |
{ \__witharrows_draw_arrows:nn \l__witharrows_first_arrow_of_group_int \g__witharrows_arrow_int } |
| 1413 |
} |
| 1414 |
\cs_new_protected:Npn \__witharrows_treat_an_arrow_in_scan: |
| 1415 |
{ |
| 1416 |
\bool_lazy_and:nnT |
| 1417 |
{ \int_compare_p:nNn \l__witharrows_arrow_int > 1 } |
| 1418 |
{ |
| 1419 |
\bool_lazy_or_p:nn |
| 1420 |
{ |
| 1421 |
\bool_lazy_and_p:nn |
| 1422 |
{ |
| 1423 |
\int_compare_p:nNn |
| 1424 |
\l__witharrows_initial_int > \l__witharrows_last_line_of_group_int |
| 1425 |
} |
| 1426 |
{ \bool_not_p:n { \int_compare_p:nNn \l__witharrows_pos_arrow_int = 7 } } |
| 1427 |
} |
| 1428 |
{ \str_if_eq_p:on \l__witharrows_status_arrow_str { new-group } } |
| 1429 |
} |
| 1430 |
{ |
| 1431 |
\int_if_zero:nF \l__witharrows_first_arrow_of_group_int |
| 1432 |
{ |
| 1433 |
\__witharrows_draw_arrows:nn |
| 1434 |
\l__witharrows_first_arrow_of_group_int |
| 1435 |
{ \l__witharrows_arrow_int - 1 } |
| 1436 |
} |
| 1437 |
\bool_set_true:N \l__witharrows_new_group_bool |
| 1438 |
} |
| 1439 |
\bool_if:nTF \l__witharrows_new_group_bool |
| 1440 |
{ |
| 1441 |
\bool_set_false:N \l__witharrows_new_group_bool |
| 1442 |
\int_set_eq:NN \l__witharrows_first_arrow_of_group_int \l__witharrows_arrow_int |
| 1443 |
\int_set_eq:NN \l__witharrows_first_line_of_group_int \l__witharrows_initial_int |
| 1444 |
\int_set_eq:NN \l__witharrows_last_line_of_group_int \l__witharrows_final_int |
| 1445 |
\seq_clear:N \l__witharrows_first_arrows_seq |
| 1446 |
\seq_put_left:NV \l__witharrows_first_arrows_seq \l__witharrows_arrow_int |
| 1447 |
\seq_clear:N \l__witharrows_last_arrows_seq |
| 1448 |
\seq_put_left:NV \l__witharrows_last_arrows_seq \l__witharrows_arrow_int |
| 1449 |
\int_compare:nNnF \l__witharrows_pos_arrow_int = 8 |
| 1450 |
{ \dim_set:Nn \l__witharrows_x_dim { - \c_max_dim } } |
| 1451 |
} |
| 1452 |
{ |
| 1453 |
\str_if_eq:onF \l__witharrows_status_arrow_str { independent } |
| 1454 |
{ |
| 1455 |
\int_compare:nNnT \l__witharrows_initial_int = \l__witharrows_first_line_of_group_int |
| 1456 |
{ \seq_put_left:NV \l__witharrows_first_arrows_seq \l__witharrows_arrow_int } |
| 1457 |
\int_compare:nNnTF \l__witharrows_final_int > \l__witharrows_last_line_of_group_int |
| 1458 |
{ |
| 1459 |
\int_set_eq:NN \l__witharrows_last_line_of_group_int \l__witharrows_final_int |
| 1460 |
\seq_clear:N \l__witharrows_last_arrows_seq |
| 1461 |
\seq_put_left:NV \l__witharrows_last_arrows_seq \l__witharrows_arrow_int |
| 1462 |
} |
| 1463 |
{ |
| 1464 |
\int_compare:nNnT \l__witharrows_final_int = \l__witharrows_last_line_of_group_int |
| 1465 |
{ \seq_put_left:NV \l__witharrows_last_arrows_seq \l__witharrows_arrow_int } |
| 1466 |
} |
| 1467 |
} |
| 1468 |
} |
| 1469 |
\str_if_eq:onF \l__witharrows_status_arrow_str { independent } |
| 1470 |
{ |
| 1471 |
\int_compare:nNnF \l__witharrows_pos_arrow_int = 8 |
| 1472 |
{ \__witharrows_update_x:nn \l__witharrows_initial_int \l__witharrows_final_int } |
| 1473 |
} |
| 1474 |
} |
| 1475 |
\cs_new_protected:Npn \__witharrows_draw_arrows:nn #1 #2 |
| 1476 |
{ |
| 1477 |
\group_begin: |
| 1478 |
\int_zero_new:N \l__witharrows_first_arrow_int |
| 1479 |
\int_set:Nn \l__witharrows_first_arrow_int { #1 } |
| 1480 |
\int_zero_new:N \l__witharrows_last_arrow_int |
| 1481 |
\int_set:Nn \l__witharrows_last_arrow_int { #2 } |
| 1482 |
\int_set:Nn \l__witharrows_arrow_int \l__witharrows_first_arrow_int |
| 1483 |
\int_until_do:nNnn \l__witharrows_arrow_int > \l__witharrows_last_arrow_int |
| 1484 |
{ |
| 1485 |
\prop_get:cnN |
| 1486 |
{ g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop } |
| 1487 |
{ initial } \l_tmpa_tl |
| 1488 |
\int_set:Nn \l__witharrows_initial_int \l_tmpa_tl |
| 1489 |
\prop_get:cnN |
| 1490 |
{ g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop } |
| 1491 |
{ final } \l_tmpa_tl |
| 1492 |
\int_set:Nn \l__witharrows_final_int \l_tmpa_tl |
| 1493 |
\prop_get:cnN |
| 1494 |
{ g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop } |
| 1495 |
{ status } \l__witharrows_status_arrow_str |
| 1496 |
\int_compare:nNnF \l__witharrows_final_int > \g__witharrows_line_int |
| 1497 |
{ |
| 1498 |
\str_if_eq:onTF \l__witharrows_status_arrow_str { over } |
| 1499 |
{ \seq_put_right:NV \l__witharrows_o_arrows_seq \l__witharrows_arrow_int } |
| 1500 |
\__witharrows_draw_arrow: |
| 1501 |
} |
| 1502 |
\int_incr:N \l__witharrows_arrow_int |
| 1503 |
} |
| 1504 |
\__witharrows_draw_o_arrows_of_the_group: |
| 1505 |
\group_end: |
| 1506 |
} |
| 1507 |
\cs_new_protected:Npn \__witharrows_draw_arrow: |
| 1508 |
{ |
| 1509 |
\group_begin: |
| 1510 |
\prop_get:cnN |
| 1511 |
{ g__witharrows_arrow _\l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop } |
| 1512 |
{ options } |
| 1513 |
\l_tmpa_tl |
| 1514 |
\str_clear_new:N \l__witharrows_previous_key_str |
| 1515 |
\exp_args:NNNno \exp_args:NNno \exp_args:Nno |
| 1516 |
\keys_set_known:nn |
| 1517 |
{ WithArrows / Arrow / SecondPass } |
| 1518 |
{ \l_tmpa_tl , tikz = { xshift = \l__witharrows_xoffset_dim } } |
| 1519 |
\bool_set_false:N \l__witharrows_initial_r_bool |
| 1520 |
\bool_set_false:N \l__witharrows_final_r_bool |
| 1521 |
\int_case:nn \l__witharrows_pos_arrow_int |
| 1522 |
{ |
| 1523 |
0 { \bool_set_true:N \l__witharrows_final_r_bool } |
| 1524 |
2 { \bool_set_true:N \l__witharrows_initial_r_bool } |
| 1525 |
3 |
| 1526 |
{ |
| 1527 |
\bool_set_true:N \l__witharrows_initial_r_bool |
| 1528 |
\bool_set_true:N \l__witharrows_final_r_bool |
| 1529 |
} |
| 1530 |
} |
| 1531 |
\int_compare:nNnT \l__witharrows_pos_arrow_int = 5 |
| 1532 |
{ |
| 1533 |
\dim_set:Nn \l__witharrows_x_dim { - \c_max_dim } |
| 1534 |
\__witharrows_update_x:nn \l__witharrows_initial_int \l__witharrows_final_int |
| 1535 |
} |
| 1536 |
\tl_set:Ne \l__witharrows_initial_tl |
| 1537 |
{ \int_use:N \l__witharrows_initial_int - \bool_if:NTF \l__witharrows_initial_r_bool rl } |
| 1538 |
\tl_set:Ne \l__witharrows_final_tl |
| 1539 |
{ \int_use:N \l__witharrows_final_int - \bool_if:NTF \l__witharrows_final_r_bool rl } |
| 1540 |
\prop_get:cnN |
| 1541 |
{ g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop } |
| 1542 |
{ label } |
| 1543 |
\l_tmpa_tl |
| 1544 |
\seq_if_in:NeTF \l__witharrows_first_arrows_seq |
| 1545 |
{ \int_use:N \l__witharrows_arrow_int } |
| 1546 |
{ \bool_set_true:N \l_tmpa_bool } |
| 1547 |
{ \bool_set_false:N \l_tmpa_bool } |
| 1548 |
\seq_if_in:NeTF \l__witharrows_last_arrows_seq |
| 1549 |
{ \int_use:N \l__witharrows_arrow_int } |
| 1550 |
{ \bool_set_true:N \l_tmpb_bool } |
| 1551 |
{ \bool_set_false:N \l_tmpb_bool } |
| 1552 |
\int_compare:nNnT \l__witharrows_pos_arrow_int = 5 |
| 1553 |
{ |
| 1554 |
\bool_set_true:N \l_tmpa_bool |
| 1555 |
\bool_set_true:N \l_tmpb_bool |
| 1556 |
} |
| 1557 |
\dim_gzero_new:N \g__witharrows_x_initial_dim |
| 1558 |
\dim_gzero_new:N \g__witharrows_x_final_dim |
| 1559 |
\dim_gzero_new:N \g__witharrows_y_initial_dim |
| 1560 |
\dim_gzero_new:N \g__witharrows_y_final_dim |
| 1561 |
\pgfpicture |
| 1562 |
\pgfrememberpicturepositiononpagetrue |
| 1563 |
\pgfpointanchor { wa - \l__witharrows_prefix_str - \l__witharrows_initial_tl } { south } |
| 1564 |
\dim_gset:Nn \g__witharrows_x_initial_dim \pgf@x |
| 1565 |
\dim_gset:Nn \g__witharrows_y_initial_dim \pgf@y |
| 1566 |
\pgfpointanchor { wa - \l__witharrows_prefix_str - \l__witharrows_final_tl } { north } |
| 1567 |
\dim_gset:Nn \g__witharrows_x_final_dim \pgf@x |
| 1568 |
\dim_gset:Nn \g__witharrows_y_final_dim \pgf@y |
| 1569 |
\endpgfpicture |
| 1570 |
\bool_lazy_and:nnTF |
| 1571 |
{ |
| 1572 |
\dim_compare_p:nNn { \g__witharrows_y_initial_dim - \g__witharrows_y_final_dim } |
| 1573 |
> \l__witharrows_max_length_of_arrow_dim |
| 1574 |
} |
| 1575 |
{ \int_compare_p:nNn { \l__witharrows_final_int - \l__witharrows_initial_int } = 1 } |
| 1576 |
{ |
| 1577 |
\tl_gset:Ne \g_tmpa_tl |
| 1578 |
{ |
| 1579 |
\int_compare:nNnTF \l__witharrows_pos_arrow_int < 5 |
| 1580 |
{ \dim_use:N \g__witharrows_x_initial_dim } |
| 1581 |
{ \dim_use:N \l__witharrows_x_dim } , |
| 1582 |
\dim_eval:n |
| 1583 |
{ |
| 1584 |
( \g__witharrows_y_initial_dim + \g__witharrows_y_final_dim ) / 2 |
| 1585 |
+ 0.5 \l__witharrows_max_length_of_arrow_dim |
| 1586 |
} |
| 1587 |
} |
| 1588 |
\tl_gset:Ne \g_tmpb_tl |
| 1589 |
{ |
| 1590 |
\int_compare:nNnTF \l__witharrows_pos_arrow_int < 5 |
| 1591 |
{ \dim_use:N \g__witharrows_x_final_dim } |
| 1592 |
{ \dim_use:N \l__witharrows_x_dim } , |
| 1593 |
\dim_eval:n |
| 1594 |
{ |
| 1595 |
( \g__witharrows_y_initial_dim + \g__witharrows_y_final_dim ) / 2 |
| 1596 |
- 0.5 \l__witharrows_max_length_of_arrow_dim |
| 1597 |
} |
| 1598 |
} |
| 1599 |
} |
| 1600 |
{ |
| 1601 |
\tl_gset:Ne \g_tmpa_tl |
| 1602 |
{ |
| 1603 |
\int_compare:nNnTF \l__witharrows_pos_arrow_int < 5 |
| 1604 |
{ \dim_use:N \g__witharrows_x_initial_dim } |
| 1605 |
{ \dim_use:N \l__witharrows_x_dim } , |
| 1606 |
\bool_if:NTF \l_tmpa_bool |
| 1607 |
{ \dim_eval:n { \g__witharrows_y_initial_dim + \l__witharrows_start_adjust_dim } } |
| 1608 |
{ \dim_use:N \g__witharrows_y_initial_dim } |
| 1609 |
} |
| 1610 |
\tl_gset:Ne \g_tmpb_tl |
| 1611 |
{ |
| 1612 |
\int_compare:nNnTF \l__witharrows_pos_arrow_int < 5 |
| 1613 |
{ \dim_use:N \g__witharrows_x_final_dim } |
| 1614 |
{ \dim_use:N \l__witharrows_x_dim } , |
| 1615 |
\bool_if:NTF \l_tmpb_bool |
| 1616 |
{ \dim_eval:n { \g__witharrows_y_final_dim - \l__witharrows_end_adjust_dim } } |
| 1617 |
{ \dim_use:N \g__witharrows_y_final_dim } |
| 1618 |
} |
| 1619 |
} |
| 1620 |
\bool_if:NF \l__witharrows_right_overlap_bool |
| 1621 |
{ |
| 1622 |
\bool_if:NT \l__witharrows_in_WithArrows_bool |
| 1623 |
{ |
| 1624 |
\pgfpicture |
| 1625 |
\pgfrememberpicturepositiononpagetrue |
| 1626 |
\pgfpointanchor { wa - \l__witharrows_prefix_str - 1 - r } { south } |
| 1627 |
\int_compare:nNnTF \l__witharrows_pos_arrow_int < 5 |
| 1628 |
{ |
| 1629 |
\dim_set:Nn \l__witharrows_delta_x_dim |
| 1630 |
{ |
| 1631 |
\pgf@x - |
| 1632 |
( \dim_min:nn \g__witharrows_x_initial_dim \g__witharrows_x_final_dim ) |
| 1633 |
} |
| 1634 |
} |
| 1635 |
{ \dim_set:Nn \l__witharrows_delta_x_dim { \pgf@x - \l__witharrows_x_dim } } |
| 1636 |
\endpgfpicture |
| 1637 |
} |
| 1638 |
} |
| 1639 |
\__witharrows_draw_arrow:nno \g_tmpa_tl \g_tmpb_tl \l_tmpa_tl |
| 1640 |
\group_end: |
| 1641 |
} |
| 1642 |
\cs_generate_variant:Nn \__witharrows_def_function_arrow:n { o } |
| 1643 |
\cs_new_protected:Npn \__witharrows_def_function_arrow:n #1 |
| 1644 |
{ |
| 1645 |
\cs_set:Npn \__witharrows_arrow:nnn ##1 ##2 ##3 |
| 1646 |
{ |
| 1647 |
\begin{tikzpicture} |
| 1648 |
[ __witharrows_standard_arrow ] |
| 1649 |
\pgf@relevantforpicturesizetrue |
| 1650 |
#1 |
| 1651 |
\dim_compare:nNnTF \pgf@picminx = { 16000 pt } |
| 1652 |
{ \dim_zero:N \l_tmpa_dim } |
| 1653 |
{ \dim_set:Nn \l_tmpa_dim { \pgf@picmaxx - \pgf@picminx } } |
| 1654 |
\dim_add:Nn \l_tmpa_dim \l__witharrows_xoffset_dim |
| 1655 |
\int_compare:nNnT \l__witharrows_arrow_int > 0 % added 2024/10/01 |
| 1656 |
{ |
| 1657 |
\prop_gput:cnV |
| 1658 |
{ g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop } |
| 1659 |
{ width } |
| 1660 |
\l_tmpa_dim |
| 1661 |
} |
| 1662 |
\bool_if:NF \l__witharrows_right_overlap_bool |
| 1663 |
{ |
| 1664 |
\bool_if:NT \l__witharrows_in_WithArrows_bool |
| 1665 |
{ |
| 1666 |
\dim_gset:Nn \g__witharrows_overlap_x_dim |
| 1667 |
{ |
| 1668 |
\dim_max:nn |
| 1669 |
\g__witharrows_overlap_x_dim |
| 1670 |
{ \l_tmpa_dim - \l__witharrows_delta_x_dim } |
| 1671 |
} |
| 1672 |
} |
| 1673 |
} |
| 1674 |
\pgfresetboundingbox |
| 1675 |
\end{tikzpicture} |
| 1676 |
} |
| 1677 |
} |
| 1678 |
\cs_generate_variant:Nn \__witharrows_draw_arrow:nnn { n n o } |
| 1679 |
\cs_new_protected:Npn \__witharrows_draw_arrow:nnn #1 #2 #3 |
| 1680 |
{ |
| 1681 |
\bool_lazy_and:nnT \l__witharrows_wrap_lines_bool \l__witharrows_in_DispWithArrows_bool |
| 1682 |
{ \tl_set_eq:NN \l__witharrows_tikz_code_tl \c__witharrows_tikz_code_wrap_lines_tl } |
| 1683 |
\__witharrows_def_function_arrow:o \l__witharrows_tikz_code_tl |
| 1684 |
\__witharrows_arrow:nnn { #1 } { #2 } { #3 } |
| 1685 |
} |
| 1686 |
\tl_const:Nn \c__witharrows_tikz_code_wrap_lines_tl |
| 1687 |
{ |
| 1688 |
\pgfset { inner~sep = 0pt } |
| 1689 |
\draw ( #1 ) to node ( __witharrows_label ) { } ( #2 ) ; |
| 1690 |
\pgfpointanchor { wa - \l__witharrows_prefix_str - __witharrows_label } { west } |
| 1691 |
\dim_set:Nn \l_tmpa_dim { \g__witharrows_right_x_dim - \pgf@x - 0.33333 em } |
| 1692 |
\path \pgfextra { \tl_gset:Ne \g_tmpa_tl \tikz@text@width } ; |
| 1693 |
\tl_if_empty:NF \g_tmpa_tl |
| 1694 |
{ |
| 1695 |
\dim_set:Nn \l_tmpb_dim \g_tmpa_tl |
| 1696 |
\dim_compare:nNnT \l_tmpb_dim < \l_tmpa_dim |
| 1697 |
{ \dim_set_eq:NN \l_tmpa_dim \l_tmpb_dim } |
| 1698 |
} |
| 1699 |
\dim_compare:nNnT \l_tmpa_dim > \c_zero_dim |
| 1700 |
{ |
| 1701 |
\path ( __witharrows_label.west ) |
| 1702 |
node [ anchor = west ] |
| 1703 |
{ |
| 1704 |
\skip_horizontal:n { 0.33333 em } |
| 1705 |
\begin { minipage } { \l_tmpa_dim } |
| 1706 |
\tikz@text@action |
| 1707 |
\pgfkeysgetvalue { / tikz / node~halign~header } \l_tmpa_tl |
| 1708 |
\tl_if_eq:NnTF \l_tmpa_tl { \tikz@align@left@header } |
| 1709 |
{ \pgfutil@raggedright } |
| 1710 |
{ |
| 1711 |
\tl_if_eq:NnTF \l_tmpa_tl { \tikz@align@right@header } |
| 1712 |
{ \pgfutil@raggedleft } |
| 1713 |
{ |
| 1714 |
\tl_if_eq:NnT \l_tmpa_tl { \tikz@align@center@header } |
| 1715 |
{ \centering } |
| 1716 |
} |
| 1717 |
} |
| 1718 |
#3 |
| 1719 |
\end { minipage } |
| 1720 |
} ; |
| 1721 |
} |
| 1722 |
} |
| 1723 |
\cs_new_protected:Npn \__witharrows_update_x:nn #1 #2 |
| 1724 |
{ |
| 1725 |
\dim_gset_eq:NN \g_tmpa_dim \l__witharrows_x_dim |
| 1726 |
\pgfpicture |
| 1727 |
\pgfrememberpicturepositiononpagetrue |
| 1728 |
\int_step_inline:nnn { #1 } { #2 } |
| 1729 |
{ |
| 1730 |
\pgfpointanchor { wa - \l__witharrows_prefix_str - ##1 - l } { center } |
| 1731 |
\dim_gset:Nn \g_tmpa_dim { \dim_max:nn \g_tmpa_dim \pgf@x } |
| 1732 |
} |
| 1733 |
\endpgfpicture |
| 1734 |
\dim_set_eq:NN \l__witharrows_x_dim \g_tmpa_dim |
| 1735 |
} |
| 1736 |
\cs_new_protected:Npn \__witharrows_draw_o_arrows_of_the_group: |
| 1737 |
{ |
| 1738 |
\seq_sort:Nn \l__witharrows_o_arrows_seq |
| 1739 |
{ |
| 1740 |
\prop_get:cnN |
| 1741 |
{ g__witharrows_arrow _ \l__witharrows_prefix_str _ ##1 _ prop } |
| 1742 |
{ final } \l_tmpa_tl |
| 1743 |
\prop_get:cnN |
| 1744 |
{ g__witharrows_arrow _ \l__witharrows_prefix_str _ ##2 _ prop } |
| 1745 |
{ final } \l_tmpb_tl |
| 1746 |
\int_compare:nNnTF \l_tmpa_tl < \l_tmpb_tl |
| 1747 |
\sort_return_same: |
| 1748 |
{ |
| 1749 |
\int_compare:nNnTF \l_tmpa_tl > \l_tmpb_tl |
| 1750 |
\sort_return_swapped: |
| 1751 |
{ |
| 1752 |
\prop_get:cnN |
| 1753 |
{ g__witharrows_arrow _ \l__witharrows_prefix_str _ ##1 _ prop } |
| 1754 |
{ initial } \l_tmpa_tl |
| 1755 |
\prop_get:cnN |
| 1756 |
{ g__witharrows_arrow _ \l__witharrows_prefix_str _ ##2 _ prop } |
| 1757 |
{ initial } \l_tmpb_tl |
| 1758 |
\int_compare:nNnTF \l_tmpa_tl < \l_tmpb_tl |
| 1759 |
\sort_return_swapped: |
| 1760 |
\sort_return_same: |
| 1761 |
} |
| 1762 |
} |
| 1763 |
} |
| 1764 |
\seq_map_inline:Nn \l__witharrows_o_arrows_seq |
| 1765 |
{ |
| 1766 |
\prop_get:cnN |
| 1767 |
{ g__witharrows_arrow _ \l__witharrows_prefix_str _ ##1 _ prop } |
| 1768 |
{ initial } \l_tmpa_tl |
| 1769 |
\int_set:Nn \l__witharrows_initial_int \l_tmpa_tl |
| 1770 |
\prop_get:cnN |
| 1771 |
{ g__witharrows_arrow _ \l__witharrows_prefix_str _ ##1 _ prop } |
| 1772 |
{ final } \l_tmpa_tl |
| 1773 |
\int_set:Nn \l__witharrows_final_int \l_tmpa_tl |
| 1774 |
\prop_get:cnN |
| 1775 |
{ g__witharrows_arrow _ \l__witharrows_prefix_str _ ##1 _ prop } |
| 1776 |
{ input-line } \l__witharrows_input_line_str |
| 1777 |
\dim_gzero:N \g_tmpa_dim |
| 1778 |
\bool_set_false:N \g_tmpa_bool |
| 1779 |
\pgfpicture |
| 1780 |
\pgfrememberpicturepositiononpagetrue |
| 1781 |
\int_step_inline:nnn \l__witharrows_first_arrow_int \l__witharrows_last_arrow_int |
| 1782 |
{ |
| 1783 |
\prop_get:cnN |
| 1784 |
{ g__witharrows_arrow _ \l__witharrows_prefix_str _ ####1 _ prop } |
| 1785 |
{ initial } \l_tmpa_tl |
| 1786 |
\prop_get:cnN |
| 1787 |
{ g__witharrows_arrow _ \l__witharrows_prefix_str _ ####1 _ prop } |
| 1788 |
{ final } \l_tmpb_tl |
| 1789 |
\prop_get:cnN |
| 1790 |
{ g__witharrows_arrow _ \l__witharrows_prefix_str _ ####1 _ prop } |
| 1791 |
{ status } \l__witharrows_status_arrow_str |
| 1792 |
\bool_lazy_any:nF |
| 1793 |
{ |
| 1794 |
{ \int_compare_p:n { ##1 = ####1 } } |
| 1795 |
{ \int_compare_p:nNn \l__witharrows_initial_int > \l_tmpa_tl } |
| 1796 |
{ \int_compare_p:nNn \l_tmpb_tl > \l__witharrows_final_int } |
| 1797 |
{ \str_if_eq_p:on \l__witharrows_status_arrow_str { independent } } |
| 1798 |
} |
| 1799 |
{ |
| 1800 |
\bool_gset_true:N \g_tmpa_bool |
| 1801 |
\prop_get:cnN |
| 1802 |
{ g__witharrows _ arrow _ \l__witharrows_prefix_str _ ####1 _ prop } |
| 1803 |
{ width } |
| 1804 |
\l_tmpa_tl |
| 1805 |
\dim_gset:Nn \g_tmpa_dim { \dim_max:nn \g_tmpa_dim \l_tmpa_tl } |
| 1806 |
} |
| 1807 |
} |
| 1808 |
\endpgfpicture |
| 1809 |
\bool_if:NTF \g_tmpa_bool |
| 1810 |
{ |
| 1811 |
\int_set:Nn \l__witharrows_arrow_int { ##1 } |
| 1812 |
\dim_set_eq:NN \l__witharrows_xoffset_dim \g_tmpa_dim |
| 1813 |
\dim_add:Nn \l__witharrows_xoffset_dim \l__witharrows_xoffset_for_o_arrows_dim |
| 1814 |
\__witharrows_draw_arrow: |
| 1815 |
} |
| 1816 |
{ \__witharrows_error:n { o~arrow~with~no~arrow~under } } |
| 1817 |
} |
| 1818 |
} |
| 1819 |
\NewExpandableDocumentCommand \WithArrowsLastEnv { } |
| 1820 |
{ \int_use:N \g__witharrows_last_env_int } |
| 1821 |
\keys_define:nn { WithArrows / Arrow / code-after } |
| 1822 |
{ |
| 1823 |
tikz .code:n = |
| 1824 |
\tikzset { WithArrows / arrow / .append~style = { #1 } } , |
| 1825 |
tikz .value_required:n = true , |
| 1826 |
rr .value_forbidden:n = true , |
| 1827 |
rr .code:n = \__witharrows_fix_pos_option:n 0 , |
| 1828 |
ll .value_forbidden:n = true, |
| 1829 |
ll .code:n = \__witharrows_fix_pos_option:n 1 , |
| 1830 |
rl .value_forbidden:n = true , |
| 1831 |
rl .code:n = \__witharrows_fix_pos_option:n 2 , |
| 1832 |
lr .value_forbidden:n = true , |
| 1833 |
lr .code:n = \__witharrows_fix_pos_option:n 3 , |
| 1834 |
v .value_forbidden:n = true , |
| 1835 |
v .code:n = \__witharrows_fix_pos_option:n 4 , |
| 1836 |
tikz-code .tl_set:N = \l__witharrows_tikz_code_tl , |
| 1837 |
tikz-code .value_required:n = true , |
| 1838 |
xoffset .dim_set:N = \l__witharrows_xoffset_dim , |
| 1839 |
xoffset .value_required:n = true , |
| 1840 |
unknown .code:n = |
| 1841 |
\__witharrows_sort_seq:N \l__witharrows_options_Arrow_code_after_seq |
| 1842 |
\__witharrows_error:n { Unknown~option~Arrow~in~code-after } |
| 1843 |
} |
| 1844 |
\seq_new:N \l__witharrows_options_Arrow_code_after_seq |
| 1845 |
\__witharrows_set_seq_of_str_from_clist:Nn \l__witharrows_options_Arrow_code_after_seq |
| 1846 |
{ ll, lr, rl, rr, tikz, tikz-code, v, x, offset } |
| 1847 |
\NewDocumentCommand \__witharrows_Arrow_code_after { O { } m m m ! O { } } |
| 1848 |
{ |
| 1849 |
\int_set_eq:NN \l__witharrows_pos_arrow_int \c_one_int |
| 1850 |
\str_clear_new:N \l__witharrows_previous_key_str |
| 1851 |
\group_begin: |
| 1852 |
\keys_set:nn { WithArrows / Arrow / code-after } |
| 1853 |
{ #1, #5, tikz = { xshift = \l__witharrows_xoffset_dim } } |
| 1854 |
\bool_set_false:N \l__witharrows_initial_r_bool |
| 1855 |
\bool_set_false:N \l__witharrows_final_r_bool |
| 1856 |
\int_case:nn \l__witharrows_pos_arrow_int |
| 1857 |
{ |
| 1858 |
0 |
| 1859 |
{ |
| 1860 |
\bool_set_true:N \l__witharrows_initial_r_bool |
| 1861 |
\bool_set_true:N \l__witharrows_final_r_bool |
| 1862 |
} |
| 1863 |
2 { \bool_set_true:N \l__witharrows_initial_r_bool } |
| 1864 |
3 { \bool_set_true:N \l__witharrows_final_r_bool } |
| 1865 |
} |
| 1866 |
\tl_if_eq:nnTF { #2 } { #3 } |
| 1867 |
{ \__witharrows_error:nn { Both~lines~are~equal } { #2 } } |
| 1868 |
{ |
| 1869 |
\cs_if_free:cTF { pgf@sh@ns@wa - \l__witharrows_prefix_str - #2 - l } |
| 1870 |
{ \__witharrows_error:ne { Wrong~line~in~Arrow } { #2 } } |
| 1871 |
{ |
| 1872 |
\cs_if_free:cTF { pgf@sh@ns@wa - \l__witharrows_prefix_str - #3 - l } |
| 1873 |
{ \__witharrows_error:ne { Wrong~line~in~Arrow } { #3 } } |
| 1874 |
{ |
| 1875 |
\int_compare:nNnTF \l__witharrows_pos_arrow_int = 4 |
| 1876 |
{ |
| 1877 |
\pgfpicture |
| 1878 |
\pgfrememberpicturepositiononpagetrue |
| 1879 |
\pgfpointanchor { wa - \l__witharrows_prefix_str - #2 - l } |
| 1880 |
{ south } |
| 1881 |
\dim_set_eq:NN \l_tmpa_dim \pgf@x |
| 1882 |
\dim_set_eq:NN \l_tmpb_dim \pgf@y |
| 1883 |
\pgfpointanchor { wa - \l__witharrows_prefix_str - #3 - l } |
| 1884 |
{ north } |
| 1885 |
\dim_set:Nn \l_tmpa_dim |
| 1886 |
{ \dim_max:nn \l_tmpa_dim \pgf@x } |
| 1887 |
\tl_gset:Ne \g_tmpa_tl |
| 1888 |
{ \dim_use:N \l_tmpa_dim , \dim_use:N \l_tmpb_dim } |
| 1889 |
\tl_gset:Ne \g_tmpb_tl |
| 1890 |
{ \dim_use:N \l_tmpa_dim , \dim_use:N \pgf@y } |
| 1891 |
\endpgfpicture |
| 1892 |
} |
| 1893 |
{ |
| 1894 |
\pgfpicture |
| 1895 |
\pgfrememberpicturepositiononpagetrue |
| 1896 |
\pgfpointanchor |
| 1897 |
{ |
| 1898 |
wa - \l__witharrows_prefix_str - |
| 1899 |
#2 - \bool_if:NTF \l__witharrows_initial_r_bool r l |
| 1900 |
} |
| 1901 |
{ south } |
| 1902 |
\tl_gset:Ne \g_tmpa_tl |
| 1903 |
{ \dim_use:N \pgf@x , \dim_use:N \pgf@y } |
| 1904 |
\pgfpointanchor |
| 1905 |
{ |
| 1906 |
wa - \l__witharrows_prefix_str - |
| 1907 |
#3 - \bool_if:NTF \l__witharrows_final_r_bool r l |
| 1908 |
} |
| 1909 |
{ north } |
| 1910 |
\tl_gset:Ne \g_tmpb_tl |
| 1911 |
{ \dim_use:N \pgf@x , \dim_use:N \pgf@y } |
| 1912 |
\endpgfpicture |
| 1913 |
} |
| 1914 |
\__witharrows_draw_arrow:nnn \g_tmpa_tl \g_tmpb_tl { #4 } |
| 1915 |
} |
| 1916 |
} |
| 1917 |
} |
| 1918 |
\group_end: |
| 1919 |
} |
| 1920 |
\cs_new_protected:Npn \__witharrows_MultiArrow:nn #1 #2 |
| 1921 |
{ |
| 1922 |
\exp_args:Nne |
| 1923 |
\regex_match:nnTF |
| 1924 |
{ \A \d+ (\,\d+)* ( \, \.\.\. (\,\d+)+ )* \Z } |
| 1925 |
{ #1 } |
| 1926 |
{ \__witharrows_MultiArrow_i:nn { #1 } { #2 } } |
| 1927 |
{ \__witharrows_error:ne { Invalid~specification~for~MultiArrow } { #1 } } |
| 1928 |
} |
| 1929 |
\cs_new_protected:Npn \__witharrows_MultiArrow_i:nn #1 #2 |
| 1930 |
{ |
| 1931 |
\foreach \x in { #1 } |
| 1932 |
{ |
| 1933 |
\cs_if_free:cTF { pgf@sh@ns@wa - \l__witharrows_prefix_str - \x - l } |
| 1934 |
{ \__witharrows_error:ne { Wrong~line~specification~in~MultiArrow } \x } |
| 1935 |
{ \clist_gput_right:Ne \g_tmpa_clist \x } |
| 1936 |
} |
| 1937 |
\int_compare:nTF { \clist_count:N \g_tmpa_clist < 2 } |
| 1938 |
{ \__witharrows_error:n { Too~small~specification~for~MultiArrow } } |
| 1939 |
{ |
| 1940 |
\clist_sort:Nn \g_tmpa_clist |
| 1941 |
{ |
| 1942 |
\int_compare:nNnTF { ##1 } > { ##2 } |
| 1943 |
\sort_return_swapped: |
| 1944 |
\sort_return_same: |
| 1945 |
} |
| 1946 |
\clist_pop:NN \g_tmpa_clist \l_tmpa_tl |
| 1947 |
\clist_reverse:N \g_tmpa_clist |
| 1948 |
\clist_pop:NN \g_tmpa_clist \l_tmpb_tl |
| 1949 |
\exp_args:No \__witharrows_MultiArrow_i:n \g_tmpa_clist |
| 1950 |
\begin { tikzpicture } |
| 1951 |
[ |
| 1952 |
__witharrows_standard , |
| 1953 |
every~path / .style = { WithArrows / arrow } |
| 1954 |
] |
| 1955 |
\draw [<->] ([xshift = \l__witharrows_xoffset_dim]\l_tmpa_tl-r.south) |
| 1956 |
-- ++(5mm,0) |
| 1957 |
-- node (__witharrows_label) {} |
| 1958 |
([xshift = \l__witharrows_xoffset_dim+5mm]\l_tmpb_tl-r.south) |
| 1959 |
-- ([xshift = \l__witharrows_xoffset_dim]\l_tmpb_tl-r.south) ; |
| 1960 |
\pgfpointanchor { wa - \l__witharrows_prefix_str - __witharrows_label } { west } |
| 1961 |
\dim_set:Nn \l_tmpa_dim { 20 cm } |
| 1962 |
\path \pgfextra { \tl_gset:Ne \g_tmpa_tl \tikz@text@width } ; |
| 1963 |
\tl_if_empty:NF \g_tmpa_tl { \dim_set:Nn \l_tmpa_dim \g_tmpa_tl } |
| 1964 |
\bool_lazy_and:nnT \l__witharrows_wrap_lines_bool \l__witharrows_in_DispWithArrows_bool |
| 1965 |
{ |
| 1966 |
\dim_set:Nn \l_tmpb_dim |
| 1967 |
{ \g__witharrows_right_x_dim - \pgf@x - 0.3333 em } |
| 1968 |
\dim_compare:nNnT \l_tmpb_dim < \l_tmpa_dim |
| 1969 |
{ \dim_set_eq:NN \l_tmpa_dim \l_tmpb_dim } |
| 1970 |
} |
| 1971 |
\path (__witharrows_label.west) |
| 1972 |
node [ anchor = west, text~width = \dim_use:N \l_tmpa_dim ] { #2 } ; |
| 1973 |
\end { tikzpicture } |
| 1974 |
} |
| 1975 |
} |
| 1976 |
\cs_new_protected:Npn \__witharrows_MultiArrow_i:n #1 |
| 1977 |
{ |
| 1978 |
\begin { tikzpicture } |
| 1979 |
[ |
| 1980 |
__witharrows_standard , |
| 1981 |
every~path / .style = { WithArrows / arrow } |
| 1982 |
] |
| 1983 |
\foreach \k in { #1 } |
| 1984 |
{ |
| 1985 |
\draw [ <- ] |
| 1986 |
( [xshift = \l__witharrows_xoffset_dim]\k-r.south ) -- ++(5mm,0) ; |
| 1987 |
} % ; |
| 1988 |
\end{tikzpicture} |
| 1989 |
} |
| 1990 |
\bool_if:NTF \c__witharrows_messages_for_Overleaf_bool |
| 1991 |
{ \str_const:Nn \c__witharrows_available_keys_str { } } |
| 1992 |
{ |
| 1993 |
\str_const:Nn \c__witharrows_available_keys_str |
| 1994 |
{ For~a~list~of~the~available~keys,~type~H~<return>. } |
| 1995 |
} |
| 1996 |
\str_new:N \l_witharrows_body_str |
| 1997 |
\cs_new:Npn \__witharrows_potential_body_i: |
| 1998 |
{ |
| 1999 |
\str_if_empty:NF \l_witharrows_body_str |
| 2000 |
{ \\ If~you~want~to~see~the~body~of~the~environment,~type~H~<return>. } |
| 2001 |
} |
| 2002 |
\cs_new:Npn \__witharrows_potential_body_ii: |
| 2003 |
{ |
| 2004 |
\str_if_empty:NTF \l_witharrows_body_str |
| 2005 |
{ No~further~help~available } |
| 2006 |
{ |
| 2007 |
The~body~of~your~environment~was:\\ |
| 2008 |
\l_witharrows_body_str |
| 2009 |
} |
| 2010 |
} |
| 2011 |
\str_const:Nn \c__witharrows_option_ignored_str |
| 2012 |
{ If~you~go~on,~this~option~will~be~ignored. } |
| 2013 |
\str_const:Nn \c__witharrows_command_ignored_str |
| 2014 |
{ If~you~go~on,~this~command~will~be~ignored. } |
| 2015 |
\__witharrows_msg_new:nn { amsmath~not~loaded } |
| 2016 |
{ |
| 2017 |
amsmath~not~loaded.\\ |
| 2018 |
You~can't~use~the~option~'\l_keys_key_str'~because~the~ |
| 2019 |
package~'amsmath'~has~not~been~loaded.\\ |
| 2020 |
If~you~go~on,~this~option~will~be~ignored~in~the~rest~ |
| 2021 |
of~the~document. |
| 2022 |
} |
| 2023 |
\__witharrows_msg_new:nn { Bad~value~for~replace~brace~by } |
| 2024 |
{ |
| 2025 |
Incorrect~value.\\ |
| 2026 |
Bad~value~for~the~option~'\l_keys_key_str'.~The~value~must~begin~ |
| 2027 |
with~an~extensible~left~delimiter.~The~possible~values~are:~., |
| 2028 |
\token_to_str:N \{,~(,~[,~\token_to_str:N \lbrace,~ |
| 2029 |
\token_to_str:N \lbrack,~\token_to_str:N \lgroup,~ |
| 2030 |
\token_to_str:N \langle,~\token_to_str:N \lmoustache,~ |
| 2031 |
\token_to_str:N \lfloor\ and~\token_to_str:N \lceil\ |
| 2032 |
(and~\token_to_str:N \lvert\ and~\token_to_str:N \lVert\ |
| 2033 |
if~amsmath~or~unicode-math~is~loaded~in~LaTeX).\\ |
| 2034 |
\c__witharrows_option_ignored_str |
| 2035 |
} |
| 2036 |
\__witharrows_msg_new:nn { option~of~cr~negative } |
| 2037 |
{ |
| 2038 |
Bad~value.\\ |
| 2039 |
The~argument~of~the~command~\token_to_str:N\\~ |
| 2040 |
should~be~positive~in~the~row~\int_use:N \g__witharrows_line_int\ |
| 2041 |
of~your~environment~\{\l__witharrows_type_env_str\}.\\ |
| 2042 |
\c__witharrows_option_ignored_str |
| 2043 |
} |
| 2044 |
\__witharrows_msg_new:nn { omit~probably~used } |
| 2045 |
{ |
| 2046 |
Strange~problem.\\ |
| 2047 |
Maybe~you~have~used~a~command~ |
| 2048 |
\token_to_str:N\omit\ in~the~line~\int_use:N \g__witharrows_line_int\ |
| 2049 |
(or~another~line)~of~your~environment~\{\l__witharrows_type_env_str\}.\\ |
| 2050 |
You~can~go~on~but~you~may~have~others~errors. |
| 2051 |
} |
| 2052 |
\__witharrows_msg_new:nnn { newline~at~the~end~of~env } |
| 2053 |
{ |
| 2054 |
Incorrect~end.\\ |
| 2055 |
The~environments~of~witharrows~(\{WithArrows\}~and~ |
| 2056 |
\{DispWithArrows\})~should~not~end~by~\token_to_str:N \\.\\ |
| 2057 |
However,~you~can~go~on~for~this~time.~No~similar~error~will~be~ |
| 2058 |
raised~in~this~document. |
| 2059 |
\__witharrows_potential_body_i: |
| 2060 |
} |
| 2061 |
{ \__witharrows_potential_body_ii: } |
| 2062 |
\__witharrows_msg_new:nnn { Invalid~option~format } |
| 2063 |
{ |
| 2064 |
Invalide~value.\\ |
| 2065 |
The~key~'format'~should~contain~only~letters~r,~c~and~l~and~ |
| 2066 |
must~not~be~empty.\\ |
| 2067 |
\c__witharrows_option_ignored_str |
| 2068 |
\__witharrows_potential_body_i: |
| 2069 |
} |
| 2070 |
{ \__witharrows_potential_body_ii: } |
| 2071 |
\__witharrows_msg_new:nnn { invalid~key~o } |
| 2072 |
{ |
| 2073 |
Invalid~use~of~a~key.\\ |
| 2074 |
The~key~'o'~for~individual~arrows~can~be~used~only~in~mode~ |
| 2075 |
'group'~or~in~mode~'groups'.\\ |
| 2076 |
\c__witharrows_option_ignored_str |
| 2077 |
\__witharrows_potential_body_i: |
| 2078 |
} |
| 2079 |
{ \__witharrows_potential_body_ii: } |
| 2080 |
\__witharrows_msg_new:nnn { Value~for~a~key } |
| 2081 |
{ |
| 2082 |
Misuse~of~a~key.\\ |
| 2083 |
The~key~'\l_keys_key_str'~should~be~used~without~value. \\ |
| 2084 |
However,~you~can~go~on~for~this~time. |
| 2085 |
\__witharrows_potential_body_i: |
| 2086 |
} |
| 2087 |
{ \__witharrows_potential_body_ii: } |
| 2088 |
\__witharrows_msg_new:nnn { Unknown~option~in~Arrow } |
| 2089 |
{ |
| 2090 |
Unknown~option.\\ |
| 2091 |
The~key~'\l_keys_key_str'~is~unknown~for~the~command~ |
| 2092 |
\l__witharrows_string_Arrow_for_msg_str\ in~the~row~ |
| 2093 |
\int_use:N \g__witharrows_line_int\ of~your~environment~ |
| 2094 |
\{\l__witharrows_type_env_str\}. \l_tmpa_str \\ |
| 2095 |
\c__witharrows_option_ignored_str \\ |
| 2096 |
\c__witharrows_available_keys_str |
| 2097 |
} |
| 2098 |
{ |
| 2099 |
The~available~keys~are~(in~alphabetic~order):~ |
| 2100 |
\seq_use:Nnnn \l__witharrows_options_Arrow_seq {~and~} {,~} {~and~}. |
| 2101 |
} |
| 2102 |
\__witharrows_msg_new:nnn { Unknown~option~WithArrows } |
| 2103 |
{ |
| 2104 |
Unknown~option.\\ |
| 2105 |
The~key~'\l_keys_key_str'~is~unknown~in~\{\l__witharrows_type_env_str\}. \\ |
| 2106 |
\c__witharrows_option_ignored_str \\ |
| 2107 |
\c__witharrows_available_keys_str |
| 2108 |
} |
| 2109 |
{ |
| 2110 |
The~available~keys~are~(in~alphabetic~order):~ |
| 2111 |
\seq_use:Nnnn \l__witharrows_options_WithArrows_seq {~and~} {,~} {~and~}. |
| 2112 |
} |
| 2113 |
\__witharrows_msg_new:nnn { Unknown~option~DispWithArrows } |
| 2114 |
{ |
| 2115 |
Unknown~option.\\ |
| 2116 |
The~key~'\l_keys_key_str'~is~unknown~in~\{\l__witharrows_type_env_str\}. \\ |
| 2117 |
\c__witharrows_option_ignored_str \\ |
| 2118 |
\c__witharrows_available_keys_str |
| 2119 |
} |
| 2120 |
{ |
| 2121 |
The~available~keys~are~(in~alphabetic~order):~ |
| 2122 |
\seq_use:Nnnn \l__witharrows_options_DispWithArrows_seq {~and~} {,~} {~and~}. |
| 2123 |
} |
| 2124 |
\__witharrows_msg_new:nnn { Unknown~option~WithArrowsOptions } |
| 2125 |
{ |
| 2126 |
Unknown~option.\\ |
| 2127 |
The~key~'\l_keys_key_str'~is~unknown~in~ |
| 2128 |
\token_to_str:N \WithArrowsOptions. \\ |
| 2129 |
\c__witharrows_option_ignored_str \\ |
| 2130 |
\c__witharrows_available_keys_str |
| 2131 |
} |
| 2132 |
{ |
| 2133 |
The~available~keys~are~(in~alphabetic~order):~ |
| 2134 |
\seq_use:Nnnn \l__witharrows_options_WithArrowsOptions_seq {~and~} {,~} {~and~}. |
| 2135 |
} |
| 2136 |
\__witharrows_msg_new:nnn { Unknown~option~Arrow~in~code-after } |
| 2137 |
{ |
| 2138 |
Unknown~option.\\ |
| 2139 |
The~key~'\l_keys_key_str'~is~unknown~in~ |
| 2140 |
\token_to_str:N \Arrow\ in~code-after. \\ |
| 2141 |
\c__witharrows_option_ignored_str \\ |
| 2142 |
\c__witharrows_available_keys_str |
| 2143 |
} |
| 2144 |
{ |
| 2145 |
The~available~keys~are~(in~alphabetic~order):~ |
| 2146 |
\seq_use:Nnnn \l__witharrows_options_Arrow_code_after_seq {~and~} {,~} {~and~}. |
| 2147 |
} |
| 2148 |
\__witharrows_msg_new:nnn { Too~much~columns~in~WithArrows } |
| 2149 |
{ |
| 2150 |
Too~much~columns.\\ |
| 2151 |
Your~environment~\{\l__witharrows_type_env_str\}~has~\int_use:N |
| 2152 |
\l__witharrows_nb_cols_int\ columns~and~you~try~to~use~one~more.~ |
| 2153 |
Maybe~you~have~forgotten~a~\c_backslash_str\c_backslash_str.~ |
| 2154 |
If~you~really~want~to~use~more~columns~(after~the~arrows)~you~should~use~ |
| 2155 |
the~option~'more-columns'~at~a~global~level~or~for~an~environment. \\ |
| 2156 |
However,~you~can~go~one~for~this~time. |
| 2157 |
\__witharrows_potential_body_i: |
| 2158 |
} |
| 2159 |
{ \__witharrows_potential_body_ii: } |
| 2160 |
\__witharrows_msg_new:nnn { Too~much~columns~in~DispWithArrows } |
| 2161 |
{ |
| 2162 |
Too~much~columns.\\ |
| 2163 |
Your~environment~\{\l__witharrows_type_env_str\}~has~\int_use:N |
| 2164 |
\l__witharrows_nb_cols_int\ columns~and~you~try~to~use~one~more.~ |
| 2165 |
Maybe~you~have~forgotten~a~\c_backslash_str\c_backslash_str\ |
| 2166 |
at~the~end~of~row~\int_use:N \g__witharrows_line_int. \\ |
| 2167 |
This~error~is~fatal. |
| 2168 |
\__witharrows_potential_body_i: |
| 2169 |
} |
| 2170 |
{ \__witharrows_potential_body_ii: } |
| 2171 |
\__witharrows_msg_new:nn { Negative~jump } |
| 2172 |
{ |
| 2173 |
Incorrect~value.\\ |
| 2174 |
You~can't~use~a~negative~value~for~the~option~'jump'~of~command~ |
| 2175 |
\l__witharrows_string_Arrow_for_msg_str\ |
| 2176 |
in~the~row~\int_use:N \g__witharrows_line_int\ |
| 2177 |
of~your~environment~\{\l__witharrows_type_env_str\}.~ |
| 2178 |
You~can~create~an~arrow~going~backwards~with~the~option~'<-'~of~Tikz. \\ |
| 2179 |
\c__witharrows_option_ignored_str |
| 2180 |
} |
| 2181 |
\__witharrows_msg_new:nn { new-group~without~groups } |
| 2182 |
{ |
| 2183 |
Misuse~of~a~key.\\ |
| 2184 |
You~can't~use~the~option~'new-group'~for~the~command~ |
| 2185 |
\l__witharrows_string_Arrow_for_msg_str\ |
| 2186 |
because~you~are~not~in~'groups'~mode.~Try~to~use~the~option~ |
| 2187 |
'groups'~in~your~environment~\{\l__witharrows_type_env_str\}. \\ |
| 2188 |
\c__witharrows_option_ignored_str |
| 2189 |
} |
| 2190 |
\__witharrows_msg_new:nnn |
| 2191 |
{ Too~few~lines~for~an~arrow } |
| 2192 |
{ |
| 2193 |
Impossible~arrow.\\ |
| 2194 |
Line~\l__witharrows_input_line_str\ |
| 2195 |
:~an~arrow~specified~in~the~row~\int_use:N \l__witharrows_initial_int\ |
| 2196 |
of~your~environment~\{\l__witharrows_type_env_str\}~can't~be~drawn~ |
| 2197 |
because~it~arrives~after~the~last~row~of~the~environment. \\ |
| 2198 |
If~you~go~on,~this~arrow~will~be~ignored. |
| 2199 |
\__witharrows_potential_body_i: |
| 2200 |
} |
| 2201 |
{ \__witharrows_potential_body_ii: } |
| 2202 |
\__witharrows_msg_new:nn { o~arrow~with~no~arrow~under } |
| 2203 |
{ |
| 2204 |
Problem~with~the~key~'o'.\\ |
| 2205 |
Line~\l__witharrows_input_line_str\ |
| 2206 |
:~there~is~no~arrow~'under'~your~arrow~of~type~'o'.\\ |
| 2207 |
If~you~go~on,~this~arrow~won't~be~drawn. |
| 2208 |
} |
| 2209 |
\__witharrows_msg_new:nnn { WithArrows~outside~math~mode } |
| 2210 |
{ |
| 2211 |
You~are~outside~math~mode.\\ |
| 2212 |
The~environment~\{\l__witharrows_type_env_str\}~should~be~used~only~in~math~mode~ |
| 2213 |
like~the~environment~\{aligned\}~of~amsmath. \\ |
| 2214 |
Nevertheless,~you~can~go~on. |
| 2215 |
\__witharrows_potential_body_i: |
| 2216 |
} |
| 2217 |
{ \__witharrows_potential_body_ii: } |
| 2218 |
\__witharrows_msg_new:nnn { DispWithArrows~in~math~mode } |
| 2219 |
{ |
| 2220 |
You~are~in~math~mode.\\ |
| 2221 |
The~environment~\{\l__witharrows_type_env_str\}~should~be~used~only~outside~math~ |
| 2222 |
mode~like~the~environments~\{align\}~and~\{align*\}~of~amsmath. \\ |
| 2223 |
This~error~is~fatal. |
| 2224 |
\__witharrows_potential_body_i: |
| 2225 |
} |
| 2226 |
{ \__witharrows_potential_body_ii: } |
| 2227 |
\__witharrows_msg_new:nn { Incompatible~options~in~Arrow } |
| 2228 |
{ |
| 2229 |
Incompatible~options.\\ |
| 2230 |
You~try~to~use~the~option~'\l_keys_key_str'~but~ |
| 2231 |
this~option~is~incompatible~or~redundant~with~the~option~ |
| 2232 |
'\l__witharrows_previous_key_str'~set~in~the~same~command~ |
| 2233 |
\l__witharrows_string_Arrow_for_msg_str. \\ |
| 2234 |
\c__witharrows_option_ignored_str |
| 2235 |
} |
| 2236 |
\__witharrows_msg_new:nn { Incompatible~options a} |
| 2237 |
{ |
| 2238 |
Incompatible~options.\\ |
| 2239 |
You~try~to~use~the~option~'\l_keys_key_str'~but~ |
| 2240 |
this~option~is~incompatible~or~redundant~with~the~option~ |
| 2241 |
'\l__witharrows_previous_key_str'~set~in~the~same~command~ |
| 2242 |
\bool_if:NT \l__witharrows_in_code_after_bool |
| 2243 |
{ |
| 2244 |
\l__witharrows_string_Arrow_for_msg_str\ |
| 2245 |
in~the~code-after~of~your~environment~\{\l__witharrows_type_env_str\} |
| 2246 |
}. \\ |
| 2247 |
\c__witharrows_option_ignored_str |
| 2248 |
} |
| 2249 |
\__witharrows_msg_new:nnn { Arrow~not~in~last~column } |
| 2250 |
{ |
| 2251 |
Bad~use~of~\l__witharrows_string_Arrow_for_msg_str.\\ |
| 2252 |
You~should~use~the~command~\l__witharrows_string_Arrow_for_msg_str\ |
| 2253 |
only~in~the~last~column~(column~\int_use:N\l__witharrows_nb_cols_int)~ |
| 2254 |
in~the~row~\int_use:N \g__witharrows_line_int\ |
| 2255 |
of~your~environment~\{\l__witharrows_type_env_str\}.\\ |
| 2256 |
However~you~can~go~on~for~this~time. |
| 2257 |
\__witharrows_potential_body_i: |
| 2258 |
} |
| 2259 |
{ \__witharrows_potential_body_ii: } |
| 2260 |
\__witharrows_msg_new:nn { Wrong~line~in~Arrow } |
| 2261 |
{ |
| 2262 |
Wrong~line.\\ |
| 2263 |
The~specification~of~line~'#1'~you~use~in~the~command~ |
| 2264 |
\l__witharrows_string_Arrow_for_msg_str\ |
| 2265 |
in~the~'code-after'~of~\{\l__witharrows_type_env_str\}~doesn't~exist. \\ |
| 2266 |
\c__witharrows_option_ignored_str |
| 2267 |
} |
| 2268 |
\__witharrows_msg_new:nn { Both~lines~are~equal } |
| 2269 |
{ |
| 2270 |
Both~lines~are~equal.\\ |
| 2271 |
In~the~'code-after'~of~\{\l__witharrows_type_env_str\}~you~try~to~ |
| 2272 |
draw~an~arrow~going~to~itself~from~the~line~'#1'.~This~is~not~possible. \\ |
| 2273 |
\c__witharrows_option_ignored_str |
| 2274 |
} |
| 2275 |
\__witharrows_msg_new:nn { Wrong~line~specification~in~MultiArrow } |
| 2276 |
{ |
| 2277 |
Wrong~line~specification.\\ |
| 2278 |
The~specification~of~line~'#1'~doesn't~exist. \\ |
| 2279 |
If~you~go~on,~it~will~be~ignored~for~\token_to_str:N \MultiArrow. |
| 2280 |
} |
| 2281 |
\__witharrows_msg_new:nn { Too~small~specification~for~MultiArrow } |
| 2282 |
{ |
| 2283 |
Too~small~specification.\\ |
| 2284 |
The~specification~of~lines~you~gave~to~\token_to_str:N \MultiArrow\ |
| 2285 |
is~too~small:~you~need~at~least~two~lines. \\ |
| 2286 |
\c__witharrows_command_ignored_str |
| 2287 |
} |
| 2288 |
\__witharrows_msg_new:nn { Not~allowed~in~DispWithArrows } |
| 2289 |
{ |
| 2290 |
Forbidden~command.\\ |
| 2291 |
The~command~\token_to_str:N #1 |
| 2292 |
is~allowed~only~in~the~last~column~ |
| 2293 |
(column~\int_use:N\l__witharrows_nb_cols_int)~of~\{\l__witharrows_type_env_str\}. \\ |
| 2294 |
\c__witharrows_option_ignored_str |
| 2295 |
} |
| 2296 |
\__witharrows_msg_new:nn { Not~allowed~in~WithArrows } |
| 2297 |
{ |
| 2298 |
Forbidden~command.\\ |
| 2299 |
The~command~\token_to_str:N #1 is~not~allowed~in~\{\l__witharrows_type_env_str\}~ |
| 2300 |
(it's~allowed~in~the~last~column~of~\{DispWithArrows\}). \\ |
| 2301 |
\c__witharrows_option_ignored_str |
| 2302 |
} |
| 2303 |
\__witharrows_msg_new:nn { tag*~without~amsmath } |
| 2304 |
{ |
| 2305 |
amsmath~not~loaded.\\ |
| 2306 |
We~can't~use~\token_to_str:N\tag*~because~you~haven't~loaded~amsmath~ |
| 2307 |
(or~mathtools). \\ |
| 2308 |
If~you~go~on,~the~command~\token_to_str:N\tag\ |
| 2309 |
will~be~used~instead. |
| 2310 |
} |
| 2311 |
\__witharrows_msg_new:nn { Multiple~tags } |
| 2312 |
{ |
| 2313 |
Multiple~tags.\\ |
| 2314 |
You~can't~use~twice~the~command~\token_to_str:N\tag\ |
| 2315 |
in~a~line~of~the~environment~\{\l__witharrows_type_env_str\}. \\ |
| 2316 |
If~you~go~on,~the~tag~'#1'~will~be~used. |
| 2317 |
} |
| 2318 |
\__witharrows_msg_new:nn { Multiple~labels } |
| 2319 |
{ |
| 2320 |
Multiple~labels.\\ |
| 2321 |
Normally,~we~can't~use~the~command~\token_to_str:N\label\ |
| 2322 |
twice~in~a~line~of~the~environment~\{\l__witharrows_type_env_str\}. \\ |
| 2323 |
However,~you~can~go~on.~ |
| 2324 |
\IfPackageLoadedT { showlabels } |
| 2325 |
{ However,~only~the~last~label~will~be~shown~by~showlabels.~ } |
| 2326 |
If~you~don't~want~to~see~this~message~again,~you~can~use~the~option~ |
| 2327 |
'allow-multiple-labels'~at~the~global~or~environment~level. |
| 2328 |
} |
| 2329 |
\__witharrows_msg_new:nn { Multiple~labels~with~cleveref } |
| 2330 |
{ |
| 2331 |
Multiple~labels.\\ |
| 2332 |
Since~you~use~cleveref,~you~can't~use~the~command~\token_to_str:N\label\ |
| 2333 |
twice~in~a~line~of~the~environment~\{\l__witharrows_type_env_str\}. \\ |
| 2334 |
If~you~go~on,~you~may~have~undefined~references. |
| 2335 |
} |
| 2336 |
\__witharrows_msg_new:nn { Inexistent~v-node } |
| 2337 |
{ |
| 2338 |
There~is~a~problem.\\ |
| 2339 |
Maybe~you~have~put~a~command~\token_to_str:N\cr\ |
| 2340 |
instead~of~a~command~\token_to_str:N\\~at~the~end~of~ |
| 2341 |
the~row~\l_tmpa_int\ |
| 2342 |
of~your~environment~\{\l__witharrows_type_env_str\}. \\ |
| 2343 |
This~error~is~fatal. |
| 2344 |
} |
| 2345 |
\__witharrows_msg_new:nn { Option~xoffset~forbidden } |
| 2346 |
{ |
| 2347 |
Incorrect~key.\\ |
| 2348 |
You~can't~use~the~option~'xoffset'~in~the~command~ |
| 2349 |
\l__witharrows_string_Arrow_for_msg_str\ in~the~row~\int_use:N \g__witharrows_line_int\ |
| 2350 |
of~your~environment~\{\l__witharrows_type_env_str\}~ |
| 2351 |
because~you~are~using~the~option~ |
| 2352 |
' \int_compare:nNnTF \l__witharrows_pos_arrow_int = 7 |
| 2353 |
{ group } |
| 2354 |
{ groups } '.~It's~possible~for~an~independent~arrow~or~if~there~is~ |
| 2355 |
only~one~arrow. \\ |
| 2356 |
\c__witharrows_option_ignored_str |
| 2357 |
} |
| 2358 |
\__witharrows_msg_new:nnn { Duplicate~name } |
| 2359 |
{ |
| 2360 |
Duplicate~name.\\ |
| 2361 |
The~name~'\l_keys_value_tl'~is~already~used~and~you~shouldn't~use~ |
| 2362 |
the~same~environment~name~twice.~You~can~go~on,~but,~ |
| 2363 |
maybe,~you~will~have~incorrect~results. \\ |
| 2364 |
For~a~list~of~the~names~already~used,~type~H~<return>. \\ |
| 2365 |
If~you~don't~want~to~see~this~message~again,~use~the~option~ |
| 2366 |
'allow-duplicate-names'. |
| 2367 |
} |
| 2368 |
{ |
| 2369 |
The~names~already~defined~in~this~document~are:~ |
| 2370 |
\seq_use:Nnnn \g__witharrows_names_seq { ,~ } { ,~ } { ~and~ }. |
| 2371 |
} |
| 2372 |
\__witharrows_msg_new:nn { Invalid~specification~for~MultiArrow } |
| 2373 |
{ |
| 2374 |
Invalid~specification.\\ |
| 2375 |
The~specification~of~rows~for~\token_to_str:N\MultiArrow\ |
| 2376 |
(i.e.~#1)~is~invalid. \\ |
| 2377 |
\c__witharrows_command_ignored_str |
| 2378 |
} |
| 2379 |
\NewDocumentCommand \WithArrowsNewStyle { m m } |
| 2380 |
{ |
| 2381 |
\keys_if_exist:nnTF { WithArrows / Global } { #1 } |
| 2382 |
{ \__witharrows_error:nn { Key~already~defined } { #1 } } |
| 2383 |
{ |
| 2384 |
\seq_clear:N \l_tmpa_seq |
| 2385 |
\keyval_parse:NNn \__witharrows_valid_key:n \__witharrows_valid_key:nn { #2 } |
| 2386 |
\seq_if_empty:NTF \l_tmpa_seq |
| 2387 |
{ |
| 2388 |
\seq_put_right:Ne \l__witharrows_options_WithArrows_seq |
| 2389 |
{ \tl_to_str:n { #1 } } |
| 2390 |
\seq_put_right:Ne \l__witharrows_options_DispWithArrows_seq |
| 2391 |
{ \tl_to_str:n { #1 } } |
| 2392 |
\seq_put_right:Ne \l__witharrows_options_WithArrowsOptions_seq |
| 2393 |
{ \tl_to_str:N { #1 } } |
| 2394 |
\keys_precompile:nnc |
| 2395 |
{ WithArrows / WithArrowsOptions } |
| 2396 |
{ #2 } |
| 2397 |
{ __witharrows _ style _ #1 _ tl } |
| 2398 |
\keys_define:nn { WithArrows / Global } |
| 2399 |
{ #1 .code:n = \use:c { __witharrows _ style _ #1 _ tl } } |
| 2400 |
} |
| 2401 |
{ \__witharrows_error:nn { Impossible~style } { #1 } } |
| 2402 |
} |
| 2403 |
} |
| 2404 |
\__witharrows_msg_new:nn { Impossible~style } |
| 2405 |
{ |
| 2406 |
Impossible~style.\\ |
| 2407 |
It's~impossible~to~define~the~style~'#1'~ |
| 2408 |
because~it~contains~unknown~keys:~' |
| 2409 |
\seq_use:Nnnn \l_tmpa_seq { '~and~' } { ',~'} { ',~and~}'. |
| 2410 |
} |
| 2411 |
\cs_new_protected:Npn \__witharrows_valid_key:n #1 |
| 2412 |
{ |
| 2413 |
\keys_if_exist:nnF { WithArrows / Global } { #1 } |
| 2414 |
{ \seq_put_right:Nn \l_tmpa_seq { #1 } } |
| 2415 |
} |
| 2416 |
\cs_new_protected:Npn \__witharrows_valid_key:nn #1 #2 |
| 2417 |
{ |
| 2418 |
\keys_if_exist:nnF { WithArrows / Global } { #1 } |
| 2419 |
{ \seq_put_right:Nn \l_tmpa_seq { #1 } } |
| 2420 |
} |
| 2421 |
\__witharrows_msg_new:nn { Key~already~defined } |
| 2422 |
{ |
| 2423 |
Key~already~defined.\\ |
| 2424 |
The~key~'#1'~is~already~defined. \\ |
| 2425 |
If~you~go~on,~your~instruction~\token_to_str:N\WithArrowsNewStyle\ |
| 2426 |
will~be~ignored. |
| 2427 |
} |
| 2428 |
\keys_define:nn { WithArrows / up-and-down } |
| 2429 |
{ |
| 2430 |
radius .dim_set:N = \l__witharrows_up_and_down_radius_dim , |
| 2431 |
radius .value_required:n = true , |
| 2432 |
width .code:n = |
| 2433 |
\str_case:nnF { #1 } |
| 2434 |
{ |
| 2435 |
{ min } { \dim_zero:N \l__witharrows_arrow_width_dim } |
| 2436 |
{ max } { \dim_set_eq:NN \l__witharrows_arrow_width_dim \c_max_dim } |
| 2437 |
} |
| 2438 |
{ \dim_set:Nn \l__witharrows_arrow_width_dim { #1 } } , |
| 2439 |
width .value_required:n = true , |
| 2440 |
unknown .code:n = \__witharrows_error:n { Option~unknown~for~up-and-down } |
| 2441 |
} |
| 2442 |
\__witharrows_msg_new:nn { Option~unknown~for~up-and-down } |
| 2443 |
{ |
| 2444 |
Unknown~option.\\ |
| 2445 |
The~option~'\l_keys_key_str'~is~unknown.~\c__witharrows_option_ignored_str |
| 2446 |
} |
| 2447 |
\tl_const:Nn \c__witharrows_tikz_code_up_tl |
| 2448 |
{ |
| 2449 |
\dim_compare:nNnTF \l__witharrows_arrow_width_dim = \c_max_dim |
| 2450 |
{ |
| 2451 |
\draw [ rounded~corners = \l__witharrows_up_and_down_radius_dim ] |
| 2452 |
let \p1 = ( #1 ) , \p2 = ( #2 ) |
| 2453 |
in (\p1) -- node |
| 2454 |
{ |
| 2455 |
\dim_set:Nn \l_tmpa_dim { \x2 - \x1 } |
| 2456 |
\begin { varwidth } \l_tmpa_dim |
| 2457 |
\narrowragged |
| 2458 |
#3 |
| 2459 |
\end { varwidth } |
| 2460 |
} |
| 2461 |
(\x2,\y1) -- (\p2) ; |
| 2462 |
} |
| 2463 |
{ |
| 2464 |
\path |
| 2465 |
let \p1 = ( #1 ) , \p2 = ( #2 ) |
| 2466 |
in node |
| 2467 |
{ |
| 2468 |
\dim_set:Nn \l_tmpa_dim |
| 2469 |
{ \x2 - \x1 - \l__witharrows_up_and_down_radius_dim } |
| 2470 |
\dim_compare:nNnF \l__witharrows_arrow_width_dim = \c_zero_dim |
| 2471 |
{ |
| 2472 |
\dim_set:Nn \l_tmpa_dim |
| 2473 |
{ \dim_min:nn \l_tmpa_dim \l__witharrows_arrow_width_dim } |
| 2474 |
} |
| 2475 |
\hbox_gset:Nn \g_tmpa_box |
| 2476 |
{ |
| 2477 |
\begin { varwidth } \l_tmpa_dim |
| 2478 |
\narrowragged |
| 2479 |
#3 |
| 2480 |
\end { varwidth } |
| 2481 |
} |
| 2482 |
\dim_compare:nNnTF \l__witharrows_arrow_width_dim > \c_zero_dim |
| 2483 |
{ \dim_gset_eq:NN \g_tmpa_dim \l__witharrows_arrow_width_dim } |
| 2484 |
{ \dim_gset:Nn \g_tmpa_dim { \box_wd:N \g_tmpa_box } } |
| 2485 |
\dim_gadd:Nn \g_tmpa_dim \l__witharrows_up_and_down_radius_dim |
| 2486 |
} ; |
| 2487 |
\draw |
| 2488 |
let \p1 = ( #1 ) , \p2 = ( #2 ) |
| 2489 |
in (\x2-\g_tmpa_dim,\y1) |
| 2490 |
-- node { \box_use:N \g_tmpa_box } |
| 2491 |
(\x2-\l__witharrows_up_and_down_radius_dim,\y1) |
| 2492 |
[ rounded~corners = \l__witharrows_up_and_down_radius_dim ] |
| 2493 |
-| (\p2) ; |
| 2494 |
} |
| 2495 |
} |
| 2496 |
\tl_const:Nn \c__witharrows_tikz_code_down_tl |
| 2497 |
{ |
| 2498 |
\dim_compare:nNnTF \l__witharrows_arrow_width_dim = \c_max_dim |
| 2499 |
{ |
| 2500 |
\draw [ rounded~corners = \l__witharrows_up_and_down_radius_dim ] |
| 2501 |
let \p1 = ( #1 ) , \p2 = ( #2 ) |
| 2502 |
in (\p1) -- (\x1,\y2) -- node |
| 2503 |
{ |
| 2504 |
\dim_set:Nn \l_tmpa_dim { \x1 - \x2 } |
| 2505 |
\begin { varwidth } \l_tmpa_dim |
| 2506 |
\narrowragged |
| 2507 |
#3 |
| 2508 |
\end { varwidth } |
| 2509 |
} |
| 2510 |
(\p2) ; |
| 2511 |
} |
| 2512 |
{ |
| 2513 |
\path |
| 2514 |
let \p1 = ( #1 ) , \p2 = ( #2 ) |
| 2515 |
in node |
| 2516 |
{ |
| 2517 |
\hbox_gset:Nn \g_tmpa_box |
| 2518 |
{ |
| 2519 |
\dim_set:Nn \l_tmpa_dim |
| 2520 |
{ \x1 - \x2 - \l__witharrows_up_and_down_radius_dim - 2 mm } |
| 2521 |
\begin { varwidth } \l_tmpa_dim |
| 2522 |
\narrowragged |
| 2523 |
#3 |
| 2524 |
\end { varwidth } |
| 2525 |
} |
| 2526 |
\dim_compare:nNnTF \l__witharrows_arrow_width_dim > \c_zero_dim |
| 2527 |
{ \dim_gset_eq:NN \g_tmpa_dim \l__witharrows_arrow_width_dim } |
| 2528 |
{ \dim_gset:Nn \g_tmpa_dim { \box_wd:N \g_tmpa_box } } |
| 2529 |
\dim_gadd:Nn \g_tmpa_dim \l__witharrows_up_and_down_radius_dim |
| 2530 |
} ; |
| 2531 |
|
| 2532 |
\draw |
| 2533 |
let \p1 = ( #1 ) , \p2 = ( #2 ) |
| 2534 |
in (\p1) |
| 2535 |
{ [ rounded~corners = \l__witharrows_up_and_down_radius_dim ] -- (\x1,\y2) } |
| 2536 |
-- (\x1-\l__witharrows_up_and_down_radius_dim,\y2) |
| 2537 |
-- node { \box_use:N \g_tmpa_box } (\x1-\g_tmpa_dim,\y2) |
| 2538 |
-- ++ (-2mm,0) ; |
| 2539 |
} |
| 2540 |
} |
| 2541 |
\keys_define:nn { WithArrows / Arrow / FirstPass } |
| 2542 |
{ |
| 2543 |
up .code:n = \__witharrows_set_independent_bis: , |
| 2544 |
down .code:n = \__witharrows_set_independent_bis: , |
| 2545 |
up .default:n = NoValue , |
| 2546 |
down .default:n = NoValue |
| 2547 |
} |
| 2548 |
\keys_define:nn { WithArrows / Arrow / SecondPass } |
| 2549 |
{ |
| 2550 |
up .code:n = |
| 2551 |
\str_if_empty:NT \l__witharrows_previous_key_str |
| 2552 |
{ |
| 2553 |
\str_set:Nn \l__witharrows_previous_key_str { up } |
| 2554 |
\cs_if_exist:NTF \tikz@library@calc@loaded |
| 2555 |
{ |
| 2556 |
\keys_set:no { WithArrows / up-and-down } \l_keys_value_tl |
| 2557 |
\int_set:Nn \l__witharrows_pos_arrow_int 1 |
| 2558 |
\bool_set_false:N \l__witharrows_wrap_lines_bool |
| 2559 |
\tl_set_eq:NN \l__witharrows_tikz_code_tl \c__witharrows_tikz_code_up_tl |
| 2560 |
} |
| 2561 |
{ \__witharrows_error:n { calc~not~loaded } } |
| 2562 |
} , |
| 2563 |
down .code:n = |
| 2564 |
\str_if_empty:NT \l__witharrows_previous_key_str |
| 2565 |
{ |
| 2566 |
\str_set:Nn \l__witharrows_previous_key_str { down } |
| 2567 |
\cs_if_exist:NTF \tikz@library@calc@loaded |
| 2568 |
{ |
| 2569 |
\keys_set:no { WithArrows / up-and-down } \l_keys_value_tl |
| 2570 |
\int_set:Nn \l__witharrows_pos_arrow_int 1 |
| 2571 |
\bool_set_false:N \l__witharrows_wrap_lines_bool |
| 2572 |
\tl_set_eq:NN \l__witharrows_tikz_code_tl \c__witharrows_tikz_code_down_tl |
| 2573 |
} |
| 2574 |
{ \__witharrows_error:n { calc~not~loaded } } |
| 2575 |
} |
| 2576 |
} |
| 2577 |
\seq_put_right:Nn \l__witharrows_options_Arrow_seq { down } |
| 2578 |
\seq_put_right:Nn \l__witharrows_options_Arrow_seq { up } |
| 2579 |
\__witharrows_msg_new:nn { calc~not~loaded } |
| 2580 |
{ |
| 2581 |
calc~not~loaded.\\ |
| 2582 |
You~can't~use~the~option~'\l_keys_key_str'~because~you~don't~have~loaded~the~ |
| 2583 |
Tikz~library~'calc'.You~should~add~'\token_to_str:N\usetikzlibrary{calc}'~ |
| 2584 |
~in~the~preamble~of~your~document. \\ |
| 2585 |
\c__witharrows_option_ignored_str |
| 2586 |
} |
| 2587 |
\endinput |
| 2588 |
%% |
| 2589 |
%% End of file `witharrows.sty'. |