%%
%% This is file `witharrows.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% witharrows.dtx  (with options: `plain-TeX')
%% 
%% Copyright (C) 2017-2023 by F. Pantigny
%% 
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3 of this license or (at your option) any later
%% version.  The latest version of this license is in:
%% 
%%      http://www.latex-project.org/lppl.txt
%% 
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%% 
\def\myfileversion{2.8}
\def\myfiledate{2023/01/01}
\input tikz.tex
\input expl3-generic.tex
\usetikzlibrary{arrows.meta,bending}
\ExplSyntaxOn
\catcode `\@ = 11
\cs_new_protected:Npn \__witharrows_msg_new:nn { \msg_new:nnn { witharrows } }
\cs_new_protected:Npn \__witharrows_msg_new:nnn #1 #2 #3
  {
    \bool_if:NTF \c__witharrows_messages_for_Overleaf_bool
      { \msg_new:nnn { witharrows } { #1 } { #2 \\ #3 } }
      { \msg_new:nnnn { witharrows } { #1 } { #2 } { #3 } }
  }
\cs_new_protected:Npn \__witharrows_msg_redirect_name:nn
  { \msg_redirect_name:nnn { witharrows } }
\cs_new_protected:Npn \__witharrows_error:n { \msg_error:nn { witharrows } }
\cs_new_protected:Npn \__witharrows_warning:n { \msg_warning:nn { witharrows } }
\cs_new_protected:Npn \__witharrows_fatal:n { \msg_fatal:nn { witharrows } }
\cs_new_protected:Npn \__witharrows_error:nn  { \msg_error:nnn { witharrows } }
\cs_generate_variant:Nn \__witharrows_error:nn { n x }
\cs_new_protected:Npn \__witharrows_error_or_warning:n
  { \bool_if:NTF \c__witharrows_messages_for_Overleaf_bool \__witharrows_warning:n \__witharrows_error:n }
\bool_set:Nn \c__witharrows_messages_for_Overleaf_bool
  {
       \str_if_eq_p:Vn \c_sys_jobname_str { _region_ }  % for Emacs
    || \str_if_eq_p:Vn \c_sys_jobname_str { output }   % for Overleaf
  }
\cs_generate_variant:Nn \seq_set_split:Nnn { N x x }
\AtBeginDocument
  {
    \clist_map_inline:nn
      {
        amsmath, amsthm, autonum, cleveref, hyperref, mathtools, showlabels,
        typedref, unicode-math
      }
      {
        \bool_new:c { c__witharrows_#1_loaded_bool }
        \bool_set_false:c { c__witharrows_#1_loaded_bool }
      }
  }
\cs_new_protected:Npn \__witharrows_sort_seq:N #1
  {
    \seq_sort:Nn #1
      {
        \int_compare:nNnTF
          {
            \tex_strcmp:D
              { \str_lower_case:n { ##1 } }
              { \str_lower_case:n { ##2 } }
          }
          > 0
          \sort_return_swapped:
          \sort_return_same:
      }
  }
\cs_new_protected:Npn \__witharrows_set_seq_of_str_from_clist:Nn #1 #2
  {
    \seq_set_from_clist:Nn #1 { #2 }
    \seq_set_map_x:NNn #1 #1 { \tl_to_str:n { ##1 } }
  }
\cs_new_protected:Npn \__witharrows_save:N #1
  {
    \seq_set_split:Nxx \l_tmpa_seq
       { \char_generate:nn { `_ } { 12 } }
       { \cs_to_str:N #1 }
    \seq_pop_left:NN \l_tmpa_seq \l_tmpa_tl
    \str_set:Nx \l_tmpa_str { \seq_item:Nn \l_tmpa_seq { -1 } }
    \use:c { \l_tmpa_str _if_exist:cF }
      { g _\seq_use:Nnnn \l_tmpa_seq _ _ _ }
      {
        \use:c { \l_tmpa_str _new:c }
          { g _\seq_use:Nnnn \l_tmpa_seq _ _ _ }
      }
    \use:c { \l_tmpa_str _gset_eq:cN }
      { g _\seq_use:Nnnn \l_tmpa_seq _ _ _ } #1
  }
\cs_new_protected:Npn \__witharrows_restore:N #1
  {
    \seq_set_split:Nxx \l_tmpa_seq
      { \char_generate:nn { `_ } { 12 } }
      { \cs_to_str:N #1 }
    \seq_pop_left:NN \l_tmpa_seq \l_tmpa_tl
    \str_set:Nx \l_tmpa_str { \seq_item:Nn \l_tmpa_seq { -1 } }
    \use:c { \l_tmpa_str _set_eq:Nc }
      #1 { g_\seq_use:Nnnn \l_tmpa_seq _ _ _ }
  }
\tikzset
  {
    __witharrows_node_style / .style =
      {
        above = \l__witharrows_ystart_dim ,
        inner~sep = \c_zero_dim ,
        minimum~width = \c_zero_dim ,
        minimum~height = \l__witharrows_ygap_dim
      }
  }
\tikzset
  {
    __witharrows_standard / .style =
      {
        remember~picture ,
        overlay ,
        name~prefix = wa - \l__witharrows_prefix_str -
      }
  }
\tikzset
  {
    WithArrows / arrow / tips / .style =
      { > = { Straight~Barb [ scale = 1.2 , bend ] } }
  }
\tikzset
 {
   WithArrows / arrow / .style  =
     {
       align = flush~left ,
       auto = left ,
       WithArrows / arrow / tips ,
       bend~left = 45 ,
       ->
     }
 }
        \cs_new_protected:Npn \spread@equation
          {
            \openup \jot
            \cs_set_eq:NN \spread@equation \prg_do_nothing:
          }
\tl_new:N \l__witharrows_left_brace_tl
\tl_set_eq:NN \l__witharrows_left_brace_tl \c_novalue_tl
\bool_new:N \l__witharrows_in_WithArrows_bool
\bool_new:N \l__witharrows_in_DispWithArrows_bool
\bool_new:N \l__witharrows_in_code_after_bool
\seq_new:N \g__witharrows_position_in_the_tree_seq
\seq_gput_right:Nn \g__witharrows_position_in_the_tree_seq 1
\int_new:N \g__witharrows_last_env_int
\int_new:N \l__witharrows_pos_env_int
\int_new:N \l__witharrows_pos_arrow_int
\int_set:Nn \l__witharrows_pos_arrow_int 3
\seq_new:N \g__witharrows_arrow_int_seq
\int_new:N \g__witharrows_arrow_int
\seq_new:N \g__witharrows_line_int_seq
\int_new:N \g__witharrows_line_int
\seq_new:N \g__witharrows_col_int_seq
\int_new:N \g__witharrows_col_int
\seq_new:N \g__witharrows_static_col_int_seq
\int_new:N \g__witharrows_static_col_int
\str_new:N \l__witharrows_command_name_str
\str_set:Nn \l__witharrows_command_name_str { Arrow }
\str_new:N \l__witharrows_string_Arrow_for_msg_str
\str_set:Nx \l__witharrows_string_Arrow_for_msg_str { \token_to_str:N \Arrow }
\seq_new:N \g__witharrows_names_seq
\bool_new:N \l__witharrows_in_first_columns_bool
\bool_new:N \l__witharrows_new_group_bool
\bool_new:N \l__witharrows_initial_r_bool
\bool_new:N \l__witharrows_final_r_bool
\tl_new:N \l__witharrows_initial_tl
\tl_new:N \l__witharrows_final_tl
\int_new:N \l__witharrows_nb_cols_int
\str_new:N \l__witharrows_format_str
\dim_new:N \l__witharrows_arrow_width_dim
\dim_set_eq:NN \l__witharrows_arrow_width_dim \c_max_dim
\dim_new:N \l__witharrows_up_and_down_radius_dim
\dim_set:Nn \l__witharrows_up_and_down_radius_dim { 4 pt }
\seq_new:N \l__witharrows_o_arrows_seq
\dim_new:N \l__witharrows_xoffset_for_o_arrows_dim
\dim_set:Nn \l__witharrows_xoffset_for_o_arrows_dim { 2 mm }
\bool_new:N \l__witharrows_right_overlap_bool
\bool_set_true:N \l__witharrows_right_overlap_bool
\cs_new_protected:Npn \__witharrows_eval_if_allowed:n #1
  {
    \str_if_empty:NTF \l__witharrows_previous_key_str
      {
        \str_set_eq:NN \l__witharrows_previous_key_str \l_keys_key_str
        #1
      }
      { \__witharrows_error:n { Incompatible~options } }
  }
\cs_new_protected:Npn \__witharrows_fix_pos_option:n #1
  { \__witharrows_eval_if_allowed:n { \int_set:Nn \l__witharrows_pos_arrow_int { #1 } } }
\keys_define:nn { WithArrows / Global }
  {
    max-length-of-arrow .dim_set:N = \l__witharrows_max_length_of_arrow_dim ,
    max-length-of-arrow .value_required:n = true ,
    max-length-of-arrow .initial:n = 2 cm ,
    ygap .dim_set:N = \l__witharrows_ygap_dim ,
    ygap .initial:n = 0.4 ex ,
    ygap .value_required:n = true ,
    ystart .dim_set:N = \l__witharrows_ystart_dim ,
    ystart .value_required:n = true ,
    ystart .initial:n = 0.4 ex ,
    more-columns .code:n =
      \__witharrows_msg_redirect_name:nn { Too~much~columns~in~WithArrows } { none } ,
    more-columns .value_forbidden:n = true ,
    command-name .code:n =
      \str_set:Nn \l__witharrows_command_name_str { #1 }
      \str_set:Nx \l__witharrows_string_Arrow_for_msg_str
        { \c_backslash_str Arrow~alias~\c_backslash_str #1 } ,
    command-name .value_required:n = true ,
    tikz-code .tl_set:N = \l__witharrows_tikz_code_tl ,
    tikz-code .initial:n = \draw~(#1)~to~node{#3}~(#2)~; ,
    tikz-code .value_required:n = true ,
    displaystyle .bool_set:N = \l__witharrows_displaystyle_bool ,
    displaystyle .default:n = true ,
    show-nodes .code:n =
      \tikzset { __witharrows_node_style / .append~style = { draw , red } } ,
    show-node-names .bool_set:N = \l__witharrows_show_node_names_bool ,
    show-node-names .default:n = true ,
    group .code:n =
      \str_if_empty:NTF \l__witharrows_previous_key_str
        {
          \str_set:Nn \l__witharrows_previous_key_str { group }
          \seq_remove_all:Nn \l__witharrows_options_Arrow_seq { xoffset }
          \int_set:Nn \l__witharrows_pos_arrow_int 7
        }
        { \__witharrows_error:n { Incompatible~options } } ,
    group  .value_forbidden:n = true ,
    groups .code:n =
      \str_if_empty:NTF \l__witharrows_previous_key_str
        {
          \str_set:Nn \l__witharrows_previous_key_str { groups }
          \seq_if_in:NnF \l__witharrows_options_Arrow_seq { new-group }
            { \seq_put_right:Nn \l__witharrows_options_Arrow_seq { new-group } }
          \seq_remove_all:Nn \l__witharrows_options_Arrow_seq { xoffset }
          \int_set:Nn \l__witharrows_pos_arrow_int 6
        }
        { \__witharrows_error:n { Incompatible~options } } ,
    groups .value_forbidden:n = true ,
    tikz   .code:n = \tikzset { WithArrows / arrow / .append~style = { #1 } } ,
    tikz   .initial:n         = \c_empty_tl ,
    tikz   .value_required:n  = true ,
    rr     .code:n            = \__witharrows_fix_pos_option:n 3 ,
    rr     .value_forbidden:n = true ,
    ll     .code:n            = \__witharrows_fix_pos_option:n 1 ,
    ll     .value_forbidden:n = true ,
    rl     .code:n            = \__witharrows_fix_pos_option:n 2 ,
    rl     .value_forbidden:n = true ,
    lr     .code:n            = \__witharrows_fix_pos_option:n 0 ,
    lr     .value_forbidden:n = true ,
    i      .code:n            = \__witharrows_fix_pos_option:n 5 ,
    i      .value_forbidden:n = true ,
    xoffset .dim_set:N  = \l__witharrows_xoffset_dim ,
    xoffset .value_required:n  = true ,
    xoffset .initial:n = 3 mm ,
    jot .dim_set:N = \jot ,
    jot .value_required:n = true ,
    interline .skip_set:N = \l__witharrows_interline_skip ,
    start-adjust .dim_set:N = \l__witharrows_start_adjust_dim ,
    start-adjust .initial:n = 0.4 ex ,
    start-adjust .value_required:n = true ,
    end-adjust .dim_set:N = \l__witharrows_end_adjust_dim ,
    end-adjust .initial:n = 0.4 ex ,
    end-adjust .value_required:n = true ,
    adjust .meta:n  = { start-adjust = #1 , end-adjust = #1 } ,
    adjust .value_required:n = true ,
    up-and-down .code:n = \keys_set:nn { WithArrows / up-and-down } { #1 } ,
    up-and-down .value_required:n = true ,
    no-arrows .code:n =
      \cs_set_eq:NN \__witharrows_draw_arrows:nn \use_none:nn
      \cs_set_eq:NN \__witharrows_draw_arrow:nnn \use_none:nnn  ,
    no-arrows .value_forbidden:n = true
  }
\keys_define:nn { WithArrows / WithArrowsSpecific }
  {
    t   .code:n            = \int_set:Nn \l__witharrows_pos_env_int O ,
    t   .value_forbidden:n = true ,
    c   .code:n            = \int_set:Nn \l__witharrows_pos_env_int 1 ,
    c   .value_forbidden:n = true ,
    b   .code:n            = \int_set:Nn \l__witharrows_pos_env_int 2 ,
    b   .value_forbidden:n = true ,
    right-overlap .bool_set:N       = \l__witharrows_right_overlap_bool ,
    right-overlap .value_required:n = true
  }
\clist_new:N \c__witharrows_extensible_delimiters_clist
\clist_set:Nn \c__witharrows_extensible_delimiters_clist
  {
    ., \{, (, [, \lbrace, \lbrack, \lgroup, \langle, \lmoustache, \lceil, \lfloor
  }
\keys_define:nn { WithArrows / DispWithArrowsSpecific }
  {
    fleqn .bool_set:N = \l__witharrows_fleqn_bool ,
    fleqn .default:n = true ,
    mathindent .skip_set:N = \l__witharrows_mathindent_skip ,
    mathindent .initial:n = 25 pt ,
    mathindent .value_required:n = true ,
    wrap-lines .bool_set:N = \l__witharrows_wrap_lines_bool ,
    wrap-lines .default:n = true ,
    replace-left-brace-by .code:n =
      {
        \tl_set:Nx \l_tmpa_tl { \tl_head:n { #1 } }
        \clist_if_in:NVTF
          \c__witharrows_extensible_delimiters_clist
          \l_tmpa_tl
          { \tl_set:Nn \l__witharrows_replace_left_brace_by_tl { #1 } }
          { \__witharrows_error:n { Bad~value~for~replace~brace~by } }
      } ,
    replace-left-brace-by .initial:n = \lbrace ,
  }
\keys_define:nn { WithArrows / Env }
  {
    name .code:n =
      \str_set:Nn \l_tmpa_str { #1 }
      \seq_if_in:NVTF \g__witharrows_names_seq \l_tmpa_str
        { \__witharrows_error:n { Duplicate~name } }
        { \seq_gput_left:NV \g__witharrows_names_seq \l_tmpa_str }
      \str_set_eq:NN \l__witharrows_name_str \l_tmpa_str ,
    name .value_required:n = true ,
    code-before .code:n = \tl_put_right:Nn \l__witharrows_code_before_tl { #1 } ,
    code-before .value_required:n = true,
    CodeBefore .meta:n = { code-before = #1 } ,
    code-after .code:n = \tl_put_right:Nn \l__witharrows_code_after_tl { #1 } ,
    code-after .value_required:n = true ,
    CodeAfter .meta:n = { code-after = #1 } ,
    format .code:n =
      \tl_if_empty:nTF { #1 }
        { \__witharrows_error:n { Invalid~option~format } }
        {
          \regex_match:nnTF { \A[rclRCL]*\Z } { #1 }
            { \tl_set:Nn \l__witharrows_format_str { #1 } }
            { \__witharrows_error:n { Invalid~option~format } }
        } ,
    format .value_required:n = true
  }
\keys_define:nn { WithArrows }
  {
    WithArrows .inherit:n =
      {
        WithArrows / Global ,
        WithArrows / WithArrowsSpecific ,
        WithArrows / Env
      } ,
    WithArrows / up-and-down .inherit:n = WithArrows / up-and-down ,
    DispWithArrows .inherit:n =
      {
        WithArrows / DispWithArrowsSpecific ,
        WithArrows / Global ,
        WithArrows / Env ,
      } ,
    DispWithArrows / up-and-down .inherit:n = WithArrows / up-and-down ,
    WithArrowsOptions .inherit:n =
      {
        WithArrows / Global ,
        WithArrows / WithArrowsSpecific ,
        WithArrows / DispWithArrowsSpecific ,
      } ,
    WithArrowsOptions / up-and-down .inherit:n = WithArrows / up-and-down
  }
\seq_new:N \l__witharrows_options_WithArrows_seq
\__witharrows_set_seq_of_str_from_clist:Nn \l__witharrows_options_WithArrows_seq
  {
    adjust, b, c, code-after, code-before, command-name,
    right-overlap, displaystyle, end-adjust,
    format, group, groups, i,
    interline, jot, ll,
    lr, max-length-of-arrow, more-columns, name,
    no-arrows, rl, rr, up-and-down,
    show-node-names, show-nodes, start-adjust,
    t, tikz, tikz-code,
    xoffset, ygap, ystart
  }
\keys_define:nn { WithArrows / WithArrows }
  {
    unknown .code:n  =
      \__witharrows_sort_seq:N \l__witharrows_options_WithArrows_seq
      \__witharrows_error:n { Unknown~option~WithArrows }
  }
\keys_define:nn { WithArrows / DispWithArrows }
  {
    left-brace .tl_set:N = \l__witharrows_left_brace_tl ,
    unknown .code:n  =
      \__witharrows_sort_seq:N \l__witharrows_options_DispWithArrows_seq
      \__witharrows_error:n { Unknown~option~DispWithArrows } ,
  }
\seq_new:N \l__witharrows_options_DispWithArrows_seq
\__witharrows_set_seq_of_str_from_clist:Nn \l__witharrows_options_DispWithArrows_seq
  {
    code-after, code-before, command-name, tikz-code, adjust,
    displaystyle, end-adjust, fleqn, group, format, groups, i, interline, jot,
    left-brace, ll, lr, max-length-of-arrow, mathindent, name, no-arrows,
    up-and-down, replace-left-brace-by, rl, rr, show-node-names,
    show-nodes, start-adjust, tikz, wrap-lines, xoffset, ygap, ystart,
  }
\keys_define:nn { WithArrows / WithArrowsOptions }
  {
    allow-duplicate-names .code:n =
      \__witharrows_msg_redirect_name:nn { Duplicate~name } { none } ,
    allow-duplicate-names .value_forbidden:n = true ,
    xoffset-for-o-arrows .dim_set:N = \l__witharrows_xoffset_for_o_arrows_dim ,
    xoffset-for-o-arrows .value_required:n = true ,
    unknown .code:n  =
      \__witharrows_sort_seq:N \l__witharrows_options_WithArrowsOptions_seq
      \__witharrows_error:n { Unknown~option~WithArrowsOptions }
  }
\seq_new:N \l__witharrows_options_WithArrowsOptions_seq
\__witharrows_set_seq_of_str_from_clist:Nn \l__witharrows_options_WithArrowsOptions_seq
  {
    allow-duplicate-names, b, c, command-name, right_overlap,
    more-columns, tikz-code, adjust,
    displaystyle, end-adjust, fleqn, group, groups, i, interline, jot, ll, lr,
    mathindent, max-length-of-arrow, no-arrows, up-and-down, rl, rr,
    show-node-names, show-nodes, start-adjust, t, tikz, wrap-lines, xoffset,
    xoffset-for-o-arrows, ygap, ystart,
  }
\cs_new_protected:Npn \__witharrows_set_independent:
  {
    \str_if_eq:VnF \l_keys_value_tl { NoValue }
      { \__witharrows_error:n { Value~for~a~key } }
    \__witharrows_set_independent_bis:
  }
\cs_new_protected:Npn \__witharrows_set_independent_bis:
  {
    \str_if_empty:NTF \l__witharrows_previous_key_str
      {
        \str_set_eq:NN \l__witharrows_previous_key_str \l_keys_key_str
        \str_set:Nn \l__witharrows_status_arrow_str { independent }
      }
      { \__witharrows_error:n { Incompatible~options~in~Arrow } }
  }
\keys_define:nn { WithArrows / Arrow / FirstPass }
  {
    jump .code:n =
      \int_compare:nTF { #1 > 0 }
        { \int_set:Nn \l__witharrows_jump_int { #1 } }
        { \__witharrows_error:n { Negative~jump } } ,
    jump .value_required:n  = true,
    rr .code:n = \__witharrows_set_independent: ,
    ll .code:n = \__witharrows_set_independent: ,
    rl .code:n = \__witharrows_set_independent: ,
    lr .code:n = \__witharrows_set_independent: ,
    i  .code:n = \__witharrows_set_independent: ,
    rr .default:n = NoValue ,
    ll .default:n = NoValue ,
    rl .default:n = NoValue ,
    lr .default:n = NoValue ,
    i  .default:n = NoValue ,
    new-group .value_forbidden:n = true ,
    new-group .code:n =
      \int_compare:nTF { \l__witharrows_pos_arrow_int = 6 }
        { \str_set:Nn \l__witharrows_status_arrow_str { new-group } }
        { \__witharrows_error:n { new-group~without~groups } } ,
    o .code:n =
      \str_if_empty:NTF \l__witharrows_previous_key_str
        {
          \int_compare:nNnTF \l__witharrows_pos_arrow_int < 6
            { \__witharrows_error:n { invalid~key~o } }
            {
              \str_set:Nn \l__witharrows_status_arrow_str { over }
              \str_set_eq:NN \l__witharrows_previous_key_str \l_keys_key_str
            }
        }
        { \__witharrows_error:n { Incompatible~options~in~Arrow } } ,
    tikz-code .code:n = \prg_do_nothing: ,
    tikz-code .value_required:n = true ,
    tikz .code:n = \prg_do_nothing: ,
    tikz .value_required:n = true ,
    start-adjust .code:n = \prg_do_nothing: ,
    start-adjust .value_required:n = true ,
    end-adjust .code:n = \prg_do_nothing: ,
    end-adjust .value_required:n = true ,
    adjust .code:n  = \prg_do_nothing: ,
    adjust .value_required:n = true ,
    xoffset .code:n = ,
    unknown .code:n =
      \__witharrows_sort_seq:N \l__witharrows_options_Arrow_seq
      \seq_if_in:NVTF \l__witharrows_options_WithArrows_seq \l_keys_key_str
        {
          \str_set:Nn \l_tmpa_str
           { ~However,~this~key~can~be~used~in~the~options~of~{WithArrows}. }
        }
        { \str_clear:N \l_tmpa_str }
      \__witharrows_error:n { Unknown~option~in~Arrow }
  }
\seq_new:N \l__witharrows_options_Arrow_seq
\__witharrows_set_seq_of_str_from_clist:Nn \l__witharrows_options_Arrow_seq
  {
    adjust, end-adjust, i, jump, ll, lr, o , rl, rr, start-adjust, tikz,
    tikz-code, xoffset
  }
\cs_new_protected:Npn \__witharrows_fix_pos_arrow:n #1
  {
    \str_if_empty:NT \l__witharrows_previous_key_str
      {
        \str_set_eq:NN \l__witharrows_previous_key_str \l_keys_key_str
        \int_set:Nn \l__witharrows_pos_arrow_int { #1 }
      }
  }
\keys_define:nn {WithArrows / Arrow / SecondPass }
  {
    tikz-code .tl_set:N = \l__witharrows_tikz_code_tl ,
    tikz-code .initial:n = \draw~(#1)~to~node{#3}~(#2)~; ,
    tikz .code:n = \tikzset { WithArrows / arrow / .append~style = { #1 } } ,
    tikz .initial:n = \c_empty_tl ,
    rr .code:n = \__witharrows_fix_pos_arrow:n 3 ,
    ll .code:n = \__witharrows_fix_pos_arrow:n 1 ,
    rl .code:n = \__witharrows_fix_pos_arrow:n 2 ,
    lr .code:n = \__witharrows_fix_pos_arrow:n 0 ,
    i  .code:n = \__witharrows_fix_pos_arrow:n 5 ,
    o  .code:n = \str_set:Nn \l__witharrows_previous_key_str { o } ,
    xoffset .code:n  =
      \bool_if:nTF
        {
          \int_compare_p:nNn \g__witharrows_arrow_int > 1
          &&
          \int_compare_p:nNn \l__witharrows_pos_arrow_int > 5
          &&
          ! \str_if_eq_p:Vn \l__witharrows_status_arrow_str { independent }
        }
        { \__witharrows_error:n { Option~xoffset~forbidden } }
        { \dim_set:Nn \l__witharrows_xoffset_dim { #1 } } ,
    xoffset .value_required:n = true ,
    start-adjust .dim_set:N = \l__witharrows_start_adjust_dim,
    end-adjust .dim_set:N = \l__witharrows_end_adjust_dim,
    adjust .code:n  =
      \dim_set:Nn \l__witharrows_start_adjust_dim { #1 }
      \dim_set:Nn \l__witharrows_end_adjust_dim { #1 } ,
  }
\cs_set_protected:Npn \WithArrowsOptions #1
  {
    \str_clear_new:N \l__witharrows_previous_key_str
    \keys_set:nn { WithArrows / WithArrowsOptions } { #1 }
  }
\cs_new_protected:Npn \__witharrows_Arrow
  {
    \peek_meaning:NTF [
      { \__witharrows_Arrow_i }
      { \__witharrows_Arrow_i [ ] }
  }
\cs_new_protected:Npn \__witharrows_Arrow_i [ #1 ] #2
  {
    \peek_meaning:NTF [
      { \__witharrows_Arrow_ii [ #1 ] { #2 } }
      { \__witharrows_Arrow_ii [ #1 ] { #2 } [ ] }
  }
\cs_new_protected:Npn \__witharrows_Arrow_ii [ #1 ] #2 [ #3 ]
  {
    \int_gincr:N \g__witharrows_arrow_int
    \str_clear_new:N \l__witharrows_previous_key_str
    \keys_set:nn { WithArrows / Arrow / FirstPass } { #1 , #3 }
    \prop_put:NnV \l_tmpa_prop { initial } \g__witharrows_line_int
    \int_set:Nn \l_tmpa_int { \g__witharrows_line_int + \l__witharrows_jump_int }
    \prop_put:NnV \l_tmpa_prop { final } \l_tmpa_int
    \prop_put:NnV \l_tmpa_prop { status } \l__witharrows_status_arrow_str
    \prop_put:Nnn \l_tmpa_prop { options } { #1 , #3 }
    \prop_put:Nnn \l_tmpa_prop { label } { #2 }
    \prop_put:Nnx \l_tmpa_prop { input-line } \msg_line_number:
    \prop_put:Nnn \l_tmpa_prop { width } { 0 pt }
    \prop_gclear_new:c
      { g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \g__witharrows_arrow_int _ prop }
    \prop_gset_eq:cN
      { g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \g__witharrows_arrow_int _ prop }
      \l_tmpa_prop
  }
\cs_new_protected:Npn \__witharrows_Arrow_first_columns:
  { \__witharrows_error:n { Arrow~not~in~last~column } \__witharrows_Arrow }
\cs_new_protected:Npn \__witharrows_pre_halign:n #1
  {
    \cs_if_exist:NT \tikz@library@external@loaded
      { \tikzset { external / export = false } }
    \str_clear_new:N \l__witharrows_name_str
    \str_clear_new:N \l__witharrows_status_arrow_str
    \dim_zero_new:N \l__witharrows_x_dim
    \str_clear_new:N \l__witharrows_input_line_str
    \seq_gput_right:NV \g__witharrows_arrow_int_seq \g__witharrows_arrow_int
    \int_gzero:N \g__witharrows_arrow_int
    \seq_gput_right:NV \g__witharrows_line_int_seq \g__witharrows_line_int
    \int_gzero:N \g__witharrows_line_int
    \seq_gput_right:NV \g__witharrows_col_int_seq \g__witharrows_col_int
    \int_gzero:N \g__witharrows_col_int
    \seq_gput_right:NV \g__witharrows_static_col_int_seq \g__witharrows_static_col_int
    \int_gzero:N \g__witharrows_static_col_int
    \seq_gput_right:Nn \g__witharrows_position_in_the_tree_seq 1
    \seq_set_eq:NN \l_tmpa_seq \g__witharrows_position_in_the_tree_seq
    \seq_pop_right:NN \l_tmpa_seq \l_tmpa_tl
    \str_clear_new:N \l__witharrows_prefix_str
    \str_set:Nx \l__witharrows_prefix_str { \seq_use:Nnnn \l_tmpa_seq - - - }
    \cs_set_eq:NN \\ \__witharrows_cr:
    \dim_zero:N \mathsurround
    \int_zero_new:N \l__witharrows_initial_int
    \int_zero_new:N \l__witharrows_final_int
    \int_zero_new:N \l__witharrows_arrow_int
    \int_zero_new:N \l__witharrows_pos_of_arrow_int
    \int_zero_new:N \l__witharrows_jump_int
    \int_set:Nn \l__witharrows_jump_int 1
    \str_set:Nn \l__witharrows_format_str { rL }
    \skip_zero:N \l__witharrows_interline_skip
    \tl_clear_new:N \l__witharrows_code_before_tl
    \tl_clear_new:N \l__witharrows_code_after_tl
    \str_clear_new:N \l__witharrows_previous_key_str
    \bool_if:NT \l__witharrows_in_WithArrows_bool
      { \keys_set:nn { WithArrows / WithArrows } { #1 } }
    \bool_if:NT \l__witharrows_in_DispWithArrows_bool
      { \keys_set:nn { WithArrows / DispWithArrows } { #1 } }
    \bool_if:NF \l__witharrows_right_overlap_bool
      {
        \bool_if:NT \l__witharrows_in_WithArrows_bool
          {
            \dim_gzero_new:N \g__witharrows_overlap_x_dim
            \dim_zero_new:N \l__witharrows_delta_x_dim
          }
      }
    \cs_set_eq:cN \l__witharrows_command_name_str \__witharrows_Arrow_first_columns:
    \int_set:Nn \l__witharrows_nb_cols_int { \str_count:N \l__witharrows_format_str }
    \int_gset_eq:NN \g__witharrows_col_int \l__witharrows_nb_cols_int
    \seq_clear_new:N \l__witharrows_format_seq
    \seq_set_split:NnV \l__witharrows_format_seq { } \l__witharrows_format_str
    \l__witharrows_code_before_tl
  }
\cs_new_protected:Npn \__witharrows_construct_halign:
  {
    \seq_pop_right:NNTF \l__witharrows_format_seq \l__witharrows_type_col_str
      {
        \use:e
          {
            \int_gdecr:N \g__witharrows_col_int
            \__witharrows_construct_halign:
            \int_compare:nNnT \g__witharrows_col_int = \l__witharrows_nb_cols_int
              {
                \cs_set_eq:cN { \l__witharrows_command_name_str } \__witharrows_Arrow
              }
            \str_if_eq:VnT \l__witharrows_type_col_str { c } \hfil
            \str_if_eq:VnT \l__witharrows_type_col_str { C } \hfil
            \str_if_eq:VnT \l__witharrows_type_col_str { r } \hfill
            \str_if_eq:VnT \l__witharrows_type_col_str { R } \hfill
            \int_gincr:N \g__witharrows_col_int
            \int_gset:Nn \g__witharrows_static_col_int { \int_use:N \g__witharrows_col_int }
            \c_math_toggle_token
            \str_if_eq:VnT \l__witharrows_type_col_str { C } { { } }
            \str_if_eq:VnT \l__witharrows_type_col_str { L } { { } }
            \bool_if:NT \l__witharrows_displaystyle_bool \displaystyle
            ##
            \str_if_eq:VnT \l__witharrows_type_col_str { C } { { } }
            \str_if_eq:VnT \l__witharrows_type_col_str { R } { { } }
            \c_math_toggle_token
            \int_compare:nNnTF \g__witharrows_col_int = \l__witharrows_nb_cols_int
              \__witharrows_construct_nodes:
              {
                \str_if_eq:VnT \l__witharrows_type_col_str { l } \hfil
                \str_if_eq:VnT \l__witharrows_type_col_str { L } \hfil
                \str_if_eq:VnT \l__witharrows_type_col_str { c } \hfil
                \str_if_eq:VnT \l__witharrows_type_col_str { C } \hfil
                \bool_if:NT \l__witharrows_in_DispWithArrows_bool { \tabskip = \c_zero_skip }
                &
              }
          }
      }
      {
        \bool_if:NTF \l__witharrows_in_WithArrows_bool
          {
            \ialign
            \bgroup
          }
          {
            \halign to \l__witharrows_linewidth_dim
            \bgroup
            \bool_if:NT \l__witharrows_fleqn_bool
              { \skip_horizontal:N \l__witharrows_mathindent_skip }
          }
        \int_gincr:N \g__witharrows_line_int
        \int_gzero:N \g__witharrows_col_int
        \tl_if_eq:NNF \l__witharrows_left_brace_tl \c_novalue_tl
          {
            \skip_horizontal:n
              { \box_wd:N \l__witharrows_left_brace_box + \l__witharrows_delim_wd_dim }
          }
        \strut
      }
  }
\cs_new_protected:Npn \__witharrows_construct_nodes:
  {
    \tikz [ remember~picture , overlay ]
      \node
        [
          node~contents = { } ,
          __witharrows_node_style ,
          name = wa - \l__witharrows_prefix_str - \int_use:N \g__witharrows_line_int - l ,
        ]
        ;
    \hfil
    \tikz [ remember~picture , overlay ]
      \node
        [
          node~contents = { } ,
          __witharrows_node_style ,
          name = wa - \l__witharrows_prefix_str - \int_use:N \g__witharrows_line_int - r ,
        ]
        ;
    \str_if_empty:NF \l__witharrows_name_str
      {
        \pgfpicture
        \pgfnodealias
          { \l__witharrows_name_str - \int_use:N \g__witharrows_line_int - l }
          { wa - \l__witharrows_prefix_str - \int_use:N \g__witharrows_line_int - l }
        \pgfnodealias
          { \l__witharrows_name_str - \int_use:N \g__witharrows_line_int - r }
          { wa - \l__witharrows_prefix_str - \int_use:N \g__witharrows_line_int - r }
        \endpgfpicture
      }
    \bool_if:NT \l__witharrows_show_node_names_bool
      {
        \hbox_overlap_right:n
          { \small wa - \l__witharrows_prefix_str - \int_use:N \g__witharrows_line_int - r }
      }
  }
\cs_new_protected:Npn \WithArrows
  {
    \group_begin:
    \peek_meaning:NTF [
     { \WithArrows_i }
     { \WithArrows_i [  ] }
  }
\cs_new_protected:Npn \WithArrows_i [ #1 ]
  {
    \bool_set_true:N \l__witharrows_in_WithArrows_bool
    \bool_set_false:N \l__witharrows_in_DispWithArrows_bool
    \str_clear_new:N \l__witharrows_type_env_str
    \str_set:Nn \l__witharrows_type_env_str { WithArrows }
    \__witharrows_pre_halign:n { #1 }
    \if_mode_math: \else:
      \__witharrows_error:n { WithArrows~outside~math~mode }
    \fi:
    \box_clear_new:N \l__witharrows_env_box
    \hbox_set:Nw \l__witharrows_env_box
    \int_compare:nNnT \l__witharrows_pos_env_int = 1 \c_math_toggle_token
    \int_case:nn \l__witharrows_pos_env_int { 0 \vtop 1 \vcenter 2 \vbox }
    \bgroup
    \spread@equation
    \__witharrows_construct_halign:
    &&
    \__witharrows_error:n { Too~much~columns~in~WithArrows }
    \c_math_toggle_token
    \bool_if:NT \l__witharrows_displaystyle_bool \displaystyle
    { ## }
    \c_math_toggle_token
    \cr
  }
\cs_new_protected:Npn \endWithArrows
  {
    \\
    \egroup
    \egroup
    \int_compare:nNnT \l__witharrows_pos_env_int = 1 \c_math_toggle_token
    \hbox_set_end:
    \__witharrows_post_halign:
    \bool_if:NF \l__witharrows_right_overlap_bool
      {
        \box_set_wd:Nn \l__witharrows_env_box
          { \g__witharrows_overlap_x_dim + \box_wd:N \l__witharrows_env_box }
      }
    \box_use_drop:N \l__witharrows_env_box
    \group_end:
  }
\cs_new_protected:Npn \__witharrows_post_halign:
  {
    \cs_set:Npn \WithArrowsRightX { \g__witharrows_right_x_dim }
    \normalbaselines
    \int_compare:nNnT \g__witharrows_arrow_int > 0
      {
        \int_compare:nNnT \g__witharrows_arrow_int = 1
          {
            \int_compare:nNnT \l__witharrows_pos_arrow_int > 5
              { \int_set:Nn \l__witharrows_pos_arrow_int 5 }
          }
        \__witharrows_scan_arrows:
      }
    \group_begin:
      \tikzset { every~picture / .style = __witharrows_standard }
      \cs_set:Npn \WithArrowsNbLines { \int_use:N \g__witharrows_line_int }
      \cs_set_eq:NN \MultiArrow \__witharrows_MultiArrow:nn
      \cs_set_eq:cN \l__witharrows_command_name_str \__witharrows_Arrow_code_after
      \bool_set_true:N \l__witharrows_in_code_after_bool
      \l__witharrows_code_after_tl
    \group_end:
    \seq_gpop_right:NN \g__witharrows_position_in_the_tree_seq \l_tmpa_tl
    \seq_gpop_right:NN \g__witharrows_position_in_the_tree_seq \l_tmpa_tl
    \seq_gput_right:Nx \g__witharrows_position_in_the_tree_seq
      { \int_eval:n { \l_tmpa_tl + 1 } }
    \int_compare:nNnT { \seq_count:N \g__witharrows_position_in_the_tree_seq } = 1
      { \int_gincr:N \g__witharrows_last_env_int }
    \seq_gpop_right:NN \g__witharrows_arrow_int_seq \l_tmpa_tl
    \int_gset:Nn \g__witharrows_arrow_int \l_tmpa_tl
    \seq_gpop_right:NN \g__witharrows_line_int_seq \l_tmpa_tl
    \int_gset:Nn \g__witharrows_line_int \l_tmpa_tl
    \seq_gpop_right:NN \g__witharrows_col_int_seq \l_tmpa_tl
    \int_gset:Nn \g__witharrows_col_int \l_tmpa_tl
    \seq_gpop_right:NN \g__witharrows_static_col_int_seq \l_tmpa_tl
    \int_gset:Nn \g__witharrows_static_col_int \l_tmpa_tl
  }
\cs_new_protected:Npn \__witharrows_cr:
  {
    \scan_stop:
    \int_compare:nNnF \g__witharrows_col_int = \g__witharrows_static_col_int
      { \__witharrows_error:n { omit~probably~used } }
    \prg_replicate:nn { \l__witharrows_nb_cols_int - \g__witharrows_static_col_int } { & { } }
    \group_align_safe_begin:
    \peek_meaning_remove:NTF * \__witharrows_cr_i: \__witharrows_cr_i:
  }
\cs_new_protected:Npn \__witharrows_cr_i:
  { \peek_meaning:NTF [ \__witharrows_cr_ii: { \__witharrows_cr_ii: [ \c_zero_dim ] } }
\cs_new_protected:Npn \__witharrows_cr_ii: [ #1 ]
  {
    \group_align_safe_end:
    \bool_if:NT \l__witharrows_in_DispWithArrows_bool
      {
            &
            \pgfpicture
            \pgfrememberpicturepositiononpagetrue
            \pgfcoordinate
              { wa - \l__witharrows_prefix_str - \int_use:N \g__witharrows_line_int - v }
              \pgfpointorigin
            \endpgfpicture
      }
    \dim_compare:nNnT { #1 } < \c_zero_dim
       { \__witharrows_error:n { option~of~cr~negative } }

    \cr
    \noalign
      {
        \dim_set:Nn \l_tmpa_dim { \dim_max:nn { #1 } \c_zero_dim }
        \skip_vertical:N \l_tmpa_dim
        \skip_vertical:N \l__witharrows_interline_skip
        \scan_stop:
      }
  }
\cs_new_protected:Npn \DispWithArrows
  {
    \group_begin:
    \peek_meaning:NTF <
      { \DispWithArrows_i }
      { \DispWithArrows_i < \c_novalue_tl > }
  }
\cs_new_protected:Npn \DispWithArrows_i < #1 >
  {
    \peek_meaning:NTF [
      { \DispWithArrows_ii < #1 > }
      { \DispWithArrows_ii < #1 > [ ] }
  }
\cs_new_protected:Npn \DispWithArrows_ii < #1 > [ #2 ]
  {
    \bool_set_true:N \l__witharrows_in_DispWithArrows_bool
    \str_clear_new:N \l__witharrows_type_env_str
    \str_set:Nn \l__witharrows_type_env_str { DispWithArrows }
    \exp_args:No \tl_if_novalue:nF { #1 } { \tl_set:Nn \l__witharrows_left_brace_tl { #1 } }
    \__witharrows_pre_halign:n { #2 }
    \tl_if_eq:NNF \l__witharrows_left_brace_tl \c_novalue_tl
      {
        \hbox_set:Nn \l_tmpa_box
          {
            \group_begin:
            \dim_zero:N \nulldelimiterspace
            \c_math_toggle_token
            \left \l__witharrows_replace_left_brace_by_tl \vcenter to 1 cm { } \right.
            \c_math_toggle_token
            \group_end:
          }
        \dim_zero_new:N \l__witharrows_delim_wd_dim
        \dim_set:Nn \l__witharrows_delim_wd_dim { \box_wd:N \l_tmpa_box }
        \box_clear_new:N \l__witharrows_left_brace_box
        \hbox_set:Nn \l__witharrows_left_brace_box
          {
            \group_begin:
              \cs_set_eq:NN \label \__witharrows_old_label
              \c_math_toggle_token
              \bool_if:NT \l__witharrows_displaystyle_bool \displaystyle
              \l__witharrows_left_brace_tl
              { }
              \c_math_toggle_token
            \group_end:
          }
      }
    \if_mode_math:
      \__witharrows_fatal:n { DispWithArrows~in~math~mode }
    \fi:
     \dim_zero_new:N \linewidth
     \dim_set_eq:NN \linewidth \displaywidth
        \if_mode_vertical:
        \nointerlineskip
        \hbox_to_wd:nn { .6 \linewidth } { }
        \fi:
        \c_math_toggle_token \c_math_toggle_token
    \dim_zero_new:N \l__witharrows_linewidth_dim
    \dim_set_eq:NN \l__witharrows_linewidth_dim \displaywidth
    \box_clear_new:N \l__witharrows_halign_box
    \setbox \l__witharrows_halign_box \vtop \bgroup
    \tabskip =
      \bool_if:NTF \l__witharrows_fleqn_bool
        \c_zero_skip
        { 0 pt plus 1000 pt minus 1000 pt }
    \spread@equation
    \__witharrows_construct_halign:
    \tabskip = 0 pt plus 1000 pt minus 1000 pt
    &
    $ ## $
    \tabskip = \c_zero_skip
    &&
    \__witharrows_fatal:n { Too~much~columns~in~DispWithArrows }
    \bool_if:nT \c_false_bool { ## }
    \cr
  }
\cs_new_protected:Npn \endDispWithArrows
  {
    \\
    \egroup
    \unskip \unpenalty \unskip \unpenalty
    \box_set_to_last:N \l_tmpa_box
    \nointerlineskip
    \box_use:N \l_tmpa_box
    \dim_gzero_new:N \g__witharrows_alignment_dim
    \dim_gset:Nn \g__witharrows_alignment_dim { \box_wd:N \l_tmpa_box }
    \box_clear_new:N \l__witharrows_new_box
    \hbox_set:Nn \l__witharrows_new_box { \hbox_unpack_drop:N \l_tmpa_box }
    \dim_compare:nNnT
      { \box_wd:N \l__witharrows_new_box } < \g__witharrows_alignment_dim
      { \dim_gset:Nn \g__witharrows_alignment_dim { \box_wd:N \l__witharrows_new_box } }
    \egroup
     \tl_if_eq:NNTF \l__witharrows_left_brace_tl \c_novalue_tl
       { \box_use_drop:N \l__witharrows_halign_box }
       {
         \hbox_to_wd:nn \l__witharrows_linewidth_dim
           {
            \bool_if:NTF \l__witharrows_fleqn_bool
              { \skip_horizontal:N \l__witharrows_mathindent_skip }
              \hfil
            \hbox_to_wd:nn \g__witharrows_alignment_dim
              {
                \box_use_drop:N \l__witharrows_left_brace_box
                \dim_set:Nn \l_tmpa_dim
                  {
                    \box_ht:N \l__witharrows_halign_box
                    + \box_dp:N \l__witharrows_halign_box
                  }
                \group_begin:
                \dim_zero:N \nulldelimiterspace
                \c_math_toggle_token
                  \left \l__witharrows_replace_left_brace_by_tl
                    \vcenter to \l_tmpa_dim { \vfil }
                  \right.
                \c_math_toggle_token
                \group_end:
                \hfil
              }
            \hfil
           }
         \skip_horizontal:N -\l__witharrows_linewidth_dim
         \vcenter { \box_use_drop:N \l__witharrows_halign_box }
       }
    \dim_gzero_new:N \g__witharrows_right_x_dim
    \dim_gset_eq:NN \g__witharrows_right_x_dim \c_max_dim
    \pgfpicture
      \pgfrememberpicturepositiononpagetrue
      \int_step_variable:nNn \g__witharrows_line_int \l_tmpa_int
        {
          \cs_if_free:cTF
            { pgf @ sh @ ns @ wa - \l__witharrows_prefix_str - \l_tmpa_int - v }
            { \__witharrows_fatal:n { Inexistent~v-node } }
            {
              \pgfpointanchor
                { wa - \l__witharrows_prefix_str - \l_tmpa_int - v }
                { center }
              \dim_compare:nNnT \pgf@x < \g__witharrows_right_x_dim
                { \dim_gset_eq:NN \g__witharrows_right_x_dim \pgf@x }
            }
        }
    \endpgfpicture
    \__witharrows_post_halign:
      \c_math_toggle_token \c_math_toggle_token
    \group_end:
  }
\cs_new_protected:Npn \__witharrows_if_in_last_col_of_disp:Nn #1 #2
  {
    \bool_if:NTF \l__witharrows_in_WithArrows_bool
      { \__witharrows_error:nn { Not~allowed~in~WithArrows } { #1 } }
      {
        \int_compare:nNnTF \g__witharrows_col_int < \l__witharrows_nb_cols_int
          { \__witharrows_error:nn { Not~allowed~in~DispWithArrows } { #1 } }
          { #2 }
      }
  }
\cs_new_protected:Npn \__witharrows_scan_arrows:
  {
    \group_begin:
    \int_compare:nNnT \l__witharrows_pos_arrow_int = 7
      {
        \__witharrows_scan_arrows_i:
        \int_set:Nn \l__witharrows_pos_arrow_int 8
      }
    \__witharrows_scan_arrows_i:
    \group_end:
  }
\cs_new_protected:Npn \__witharrows_scan_arrows_i:
  {
    \int_zero_new:N \l__witharrows_first_arrow_of_group_int
    \int_zero_new:N \l__witharrows_first_line_of_group_int
    \int_zero_new:N \l__witharrows_last_line_of_group_int
    \seq_clear_new:N \l__witharrows_first_arrows_seq
    \seq_clear_new:N \l__witharrows_last_arrows_seq
    \bool_set_true:N \l__witharrows_new_group_bool
    \int_set:Nn \l__witharrows_arrow_int 1
    \int_until_do:nNnn \l__witharrows_arrow_int > \g__witharrows_arrow_int
      {
        \prop_get:cnN
          { g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop }
          { initial } \l_tmpa_tl
        \int_set:Nn \l__witharrows_initial_int \l_tmpa_tl
        \prop_get:cnN
          { g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop }
          { final } \l_tmpa_tl
        \int_set:Nn \l__witharrows_final_int \l_tmpa_tl
        \prop_get:cnN
          { g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop }
          { status } \l__witharrows_status_arrow_str
        \prop_get:cnN
          { g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop }
          { input-line } \l__witharrows_input_line_str
        \int_compare:nNnTF \l__witharrows_final_int > \g__witharrows_line_int
          {
            \int_compare:nNnF \l__witharrows_pos_arrow_int = 8
              { \__witharrows_error:n { Too~few~lines~for~an~arrow } }
          }
          \__witharrows_treat_an_arrow_in_scan:
        \int_incr:N \l__witharrows_arrow_int
      }
    \bool_if:nT
      {
        ! \int_compare_p:nNn \l__witharrows_pos_arrow_int = 7
        &&
        \int_compare_p:nNn \l__witharrows_first_arrow_of_group_int > 0
      }
      { \__witharrows_draw_arrows:nn \l__witharrows_first_arrow_of_group_int \g__witharrows_arrow_int }
  }
\cs_new_protected:Npn \__witharrows_treat_an_arrow_in_scan:
  {
    \bool_lazy_and:nnT
      { \int_compare_p:nNn \l__witharrows_arrow_int > 1 }
      {
        \bool_lazy_or_p:nn
          {
            \bool_lazy_and_p:nn
              {
                \int_compare_p:nNn
                  \l__witharrows_initial_int > \l__witharrows_last_line_of_group_int
              }
              { \bool_not_p:n { \int_compare_p:nNn \l__witharrows_pos_arrow_int = 7 } }
          }
          { \str_if_eq_p:Vn \l__witharrows_status_arrow_str { new-group } }
      }
      {
        \int_compare:nNnF \l__witharrows_first_arrow_of_group_int = \c_zero_int
          {
            \__witharrows_draw_arrows:nn
              \l__witharrows_first_arrow_of_group_int
              { \l__witharrows_arrow_int - 1 }
          }
        \bool_set_true:N \l__witharrows_new_group_bool
      }
    \bool_if:nTF \l__witharrows_new_group_bool
      {
        \bool_set_false:N \l__witharrows_new_group_bool
        \int_set_eq:NN \l__witharrows_first_arrow_of_group_int \l__witharrows_arrow_int
        \int_set_eq:NN \l__witharrows_first_line_of_group_int \l__witharrows_initial_int
        \int_set_eq:NN \l__witharrows_last_line_of_group_int \l__witharrows_final_int
        \seq_clear:N \l__witharrows_first_arrows_seq
        \seq_put_left:NV \l__witharrows_first_arrows_seq \l__witharrows_arrow_int
        \seq_clear:N \l__witharrows_last_arrows_seq
        \seq_put_left:NV \l__witharrows_last_arrows_seq \l__witharrows_arrow_int
        \int_compare:nNnF \l__witharrows_pos_arrow_int = 8
          { \dim_set:Nn \l__witharrows_x_dim { - \c_max_dim } }
      }
      {
        \str_if_eq:VnF \l__witharrows_status_arrow_str { independent }
          {
            \int_compare:nT
              { \l__witharrows_initial_int = \l__witharrows_first_line_of_group_int }
              { \seq_put_left:NV \l__witharrows_first_arrows_seq \l__witharrows_arrow_int }
            \int_compare:nNnTF \l__witharrows_final_int > \l__witharrows_last_line_of_group_int
              {
                \int_set_eq:NN \l__witharrows_last_line_of_group_int \l__witharrows_final_int
                \seq_clear:N \l__witharrows_last_arrows_seq
                \seq_put_left:NV \l__witharrows_last_arrows_seq \l__witharrows_arrow_int
              }
              {
                \int_compare:nNnT \l__witharrows_final_int = \l__witharrows_last_line_of_group_int
                  { \seq_put_left:NV \l__witharrows_last_arrows_seq \l__witharrows_arrow_int }
              }
          }
      }
    \str_if_eq:VnF \l__witharrows_status_arrow_str { independent }
      {
        \int_compare:nNnF \l__witharrows_pos_arrow_int = 8
          { \__witharrows_update_x:nn \l__witharrows_initial_int \l__witharrows_final_int }
      }
  }
\cs_generate_variant:Nn \keys_set:nn { n o }
\cs_new_protected:Npn \__witharrows_keys_set:
  { \keys_set_known:no { WithArrows / Arrow / SecondPass } }
\cs_new_protected:Npn \__witharrows_draw_arrows:nn #1 #2
  {
    \group_begin:
    \int_zero_new:N \l__witharrows_first_arrow_int
    \int_set:Nn \l__witharrows_first_arrow_int { #1 }
    \int_zero_new:N \l__witharrows_last_arrow_int
    \int_set:Nn \l__witharrows_last_arrow_int { #2 }
    \int_set:Nn \l__witharrows_arrow_int \l__witharrows_first_arrow_int
    \int_until_do:nNnn \l__witharrows_arrow_int > \l__witharrows_last_arrow_int
      {
        \prop_get:cnN
          { g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop }
          { initial } \l_tmpa_tl
        \int_set:Nn \l__witharrows_initial_int \l_tmpa_tl
        \prop_get:cnN
          { g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop }
          { final } \l_tmpa_tl
        \int_set:Nn \l__witharrows_final_int \l_tmpa_tl
        \prop_get:cnN
          { g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop }
          { status } \l__witharrows_status_arrow_str
        \int_compare:nNnF \l__witharrows_final_int > \g__witharrows_line_int
          {
            \str_if_eq:VnTF \l__witharrows_status_arrow_str { over }
              { \seq_put_right:NV \l__witharrows_o_arrows_seq \l__witharrows_arrow_int }
              \__witharrows_draw_arrow:
          }
        \int_incr:N \l__witharrows_arrow_int
      }
    \__witharrows_draw_o_arrows_of_the_group:
    \group_end:
  }
\cs_new_protected:Npn \__witharrows_draw_arrow:
  {
    \group_begin:
    \prop_get:cnN
      { g__witharrows_arrow _\l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop }
      { options } \l_tmpa_tl
    \str_clear_new:N \l__witharrows_previous_key_str
    \exp_args:NNo \exp_args:No
    \__witharrows_keys_set: { \l_tmpa_tl , tikz = { xshift = \l__witharrows_xoffset_dim } }
    \bool_set_false:N \l__witharrows_initial_r_bool
    \bool_set_false:N \l__witharrows_final_r_bool
    \int_case:nn \l__witharrows_pos_arrow_int
      {
        0 { \bool_set_true:N \l__witharrows_final_r_bool }
        2 { \bool_set_true:N \l__witharrows_initial_r_bool }
        3
          {
            \bool_set_true:N \l__witharrows_initial_r_bool
            \bool_set_true:N \l__witharrows_final_r_bool
          }
      }
    \int_compare:nNnT \l__witharrows_pos_arrow_int = 5
      {
        \dim_set:Nn \l__witharrows_x_dim { - \c_max_dim }
        \__witharrows_update_x:nn \l__witharrows_initial_int \l__witharrows_final_int
      }
    \tl_set:Nx \l__witharrows_initial_tl
      { \int_use:N \l__witharrows_initial_int - \bool_if:NTF \l__witharrows_initial_r_bool rl }
    \tl_set:Nx \l__witharrows_final_tl
      { \int_use:N \l__witharrows_final_int - \bool_if:NTF \l__witharrows_final_r_bool rl }
    \prop_get:cnN
      { g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop }
      { label }
      \l_tmpa_tl
    \seq_if_in:NxTF \l__witharrows_first_arrows_seq
      { \int_use:N \l__witharrows_arrow_int }
      { \bool_set_true:N \l_tmpa_bool }
      { \bool_set_false:N \l_tmpa_bool }
    \seq_if_in:NxTF \l__witharrows_last_arrows_seq
      { \int_use:N \l__witharrows_arrow_int }
      { \bool_set_true:N \l_tmpb_bool }
      { \bool_set_false:N \l_tmpb_bool }
    \int_compare:nNnT \l__witharrows_pos_arrow_int = 5
      {
        \bool_set_true:N \l_tmpa_bool
        \bool_set_true:N \l_tmpb_bool
      }
    \dim_gzero_new:N \g__witharrows_x_initial_dim
    \dim_gzero_new:N \g__witharrows_x_final_dim
    \dim_gzero_new:N \g__witharrows_y_initial_dim
    \dim_gzero_new:N \g__witharrows_y_final_dim
    \pgfpicture
      \pgfrememberpicturepositiononpagetrue
      \pgfpointanchor { wa - \l__witharrows_prefix_str - \l__witharrows_initial_tl } { south }
      \dim_gset:Nn \g__witharrows_x_initial_dim \pgf@x
      \dim_gset:Nn \g__witharrows_y_initial_dim \pgf@y
      \pgfpointanchor { wa - \l__witharrows_prefix_str - \l__witharrows_final_tl } { north }
      \dim_gset:Nn \g__witharrows_x_final_dim \pgf@x
      \dim_gset:Nn \g__witharrows_y_final_dim \pgf@y
    \endpgfpicture
    \bool_lazy_and:nnTF
      {
        \dim_compare_p:nNn { \g__witharrows_y_initial_dim - \g__witharrows_y_final_dim }
                                > \l__witharrows_max_length_of_arrow_dim
      }
      { \int_compare_p:nNn { \l__witharrows_final_int - \l__witharrows_initial_int } = 1 }
      {
        \tl_gset:Nx \g_tmpa_tl
          {
            \int_compare:nNnTF \l__witharrows_pos_arrow_int < 5
              { \dim_use:N \g__witharrows_x_initial_dim }
              { \dim_use:N \l__witharrows_x_dim } ,
            \dim_eval:n
              {
                ( \g__witharrows_y_initial_dim + \g__witharrows_y_final_dim ) / 2
                + 0.5 \l__witharrows_max_length_of_arrow_dim
              }
          }
        \tl_gset:Nx \g_tmpb_tl
          {
            \int_compare:nNnTF \l__witharrows_pos_arrow_int < 5
              { \dim_use:N \g__witharrows_x_final_dim }
              { \dim_use:N \l__witharrows_x_dim } ,
            \dim_eval:n
              {
                ( \g__witharrows_y_initial_dim + \g__witharrows_y_final_dim ) / 2
                - 0.5 \l__witharrows_max_length_of_arrow_dim
              }
          }
      }
      {
        \tl_gset:Nx \g_tmpa_tl
          {
            \int_compare:nNnTF \l__witharrows_pos_arrow_int < 5
              { \dim_use:N \g__witharrows_x_initial_dim }
              { \dim_use:N \l__witharrows_x_dim } ,
            \bool_if:NTF \l_tmpa_bool
              { \dim_eval:n { \g__witharrows_y_initial_dim + \l__witharrows_start_adjust_dim } }
              { \dim_use:N \g__witharrows_y_initial_dim }
          }
        \tl_gset:Nx \g_tmpb_tl
          {
            \int_compare:nNnTF \l__witharrows_pos_arrow_int < 5
              { \dim_use:N \g__witharrows_x_final_dim }
              { \dim_use:N \l__witharrows_x_dim } ,
            \bool_if:NTF \l_tmpb_bool
              { \dim_eval:n { \g__witharrows_y_final_dim - \l__witharrows_end_adjust_dim } }
              { \dim_use:N \g__witharrows_y_final_dim }
          }
      }
    \bool_if:NF \l__witharrows_right_overlap_bool
      {
        \bool_if:NT \l__witharrows_in_WithArrows_bool
          {
            \pgfpicture
            \pgfrememberpicturepositiononpagetrue
            \pgfpointanchor { wa - \l__witharrows_prefix_str - 1 - r } { south }
            \int_compare:nNnTF \l__witharrows_pos_arrow_int < 5
              {
                \dim_set:Nn \l__witharrows_delta_x_dim
                  {
                    \pgf@x -
                    ( \dim_min:nn \g__witharrows_x_initial_dim \g__witharrows_x_final_dim )
                  }
              }
              { \dim_set:Nn \l__witharrows_delta_x_dim { \pgf@x - \l__witharrows_x_dim } }
            \endpgfpicture
          }
      }
    \__witharrows_draw_arrow:nno \g_tmpa_tl \g_tmpb_tl \l_tmpa_tl
    \group_end:
  }
\cs_new_protected:Npn \__witharrows_def_function_tmpa:n #1
  {
    \cs_set:Npn \__witharrows_tmpa:nnn ##1 ##2 ##3
      {
        \tikzpicture
        [
          __witharrows_standard ,
          every~path / .style = WithArrows / arrow
        ]
        \pgf@relevantforpicturesizetrue
          #1
        \dim_compare:nNnTF \pgf@picminx = { 16000 pt }
          { \dim_zero:N \l_tmpa_dim }
          { \dim_set:Nn \l_tmpa_dim { \pgf@picmaxx - \pgf@picminx } }
        \dim_add:Nn \l_tmpa_dim \l__witharrows_xoffset_dim
        \prop_gput:cnV
          { g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop }
          { width }
          \l_tmpa_dim
        \bool_if:NF \l__witharrows_right_overlap_bool
          {
            \bool_if:NT \l__witharrows_in_WithArrows_bool
              {
                \dim_gset:Nn \g__witharrows_overlap_x_dim
                  {
                    \dim_max:nn
                      \g__witharrows_overlap_x_dim
                      { \l_tmpa_dim - \l__witharrows_delta_x_dim }
                  }
              }
          }
        \pgfresetboundingbox
        \endtikzpicture
      }
  }
\cs_new_protected:Npn \__witharrows_draw_arrow:nnn #1 #2 #3
  {
    \bool_lazy_and:nnT \l__witharrows_wrap_lines_bool \l__witharrows_in_DispWithArrows_bool
      { \tl_set_eq:NN \l__witharrows_tikz_code_tl \c__witharrows_tikz_code_wrap_lines_tl }
    \exp_args:NV \__witharrows_def_function_tmpa:n \l__witharrows_tikz_code_tl
    \__witharrows_tmpa:nnn { #1 } { #2 } { #3 }
  }
\cs_generate_variant:Nn \__witharrows_draw_arrow:nnn { n n o }
\tl_const:Nn \c__witharrows_tikz_code_wrap_lines_tl
  {
    \draw ( #1 ) to node ( __witharrows_label ) { } ( #2 ) ;
    \pgfpointanchor { wa - \l__witharrows_prefix_str - __witharrows_label } { west }
    \dim_set:Nn \l_tmpa_dim
      { \g__witharrows_right_x_dim - \pgf@x - \pgfkeysvalueof { / pgf / inner~xsep } }
    \path \pgfextra { \tl_gset:Nx \g_tmpa_tl \tikz@text@width } ;
    \tl_if_empty:NF \g_tmpa_tl
      {
        \dim_set:Nn \l_tmpb_dim \g_tmpa_tl
        \dim_compare:nNnT \l_tmpb_dim < \l_tmpa_dim
          { \dim_set_eq:NN \l_tmpa_dim \l_tmpb_dim }
      }
    \dim_compare:nNnT \l_tmpa_dim > \c_zero_dim
      {
        \path ( __witharrows_label.west )
           node [ anchor = west , text~width = \dim_use:N \l_tmpa_dim ]
            { #3 } ;
      }
  }
\cs_new_protected:Npn \__witharrows_update_x:nn #1 #2
  {
    \dim_gset_eq:NN \g_tmpa_dim \l__witharrows_x_dim
    \pgfpicture
    \pgfrememberpicturepositiononpagetrue
    \int_step_inline:nnn { #1 } { #2 }
      {
        \pgfpointanchor { wa - \l__witharrows_prefix_str - ##1 - l } { center }
        \dim_gset:Nn \g_tmpa_dim { \dim_max:nn \g_tmpa_dim \pgf@x }
      }
    \endpgfpicture
    \dim_set_eq:NN \l__witharrows_x_dim \g_tmpa_dim
  }
\cs_new_protected:Npn \__witharrows_draw_o_arrows_of_the_group:
  {
    \seq_sort:Nn \l__witharrows_o_arrows_seq
      {
        \prop_get:cnN
          { g__witharrows_arrow _ \l__witharrows_prefix_str _ ##1 _ prop }
          { final } \l_tmpa_tl
        \prop_get:cnN
          { g__witharrows_arrow _ \l__witharrows_prefix_str _ ##2 _ prop }
          { final } \l_tmpb_tl
        \int_compare:nNnTF \l_tmpa_tl < \l_tmpb_tl
          \sort_return_same:
          {
            \int_compare:nNnTF \l_tmpa_tl > \l_tmpb_tl
              \sort_return_swapped:
              {
                \prop_get:cnN
                  { g__witharrows_arrow _ \l__witharrows_prefix_str _ ##1 _ prop }
                  { initial } \l_tmpa_tl
                \prop_get:cnN
                  { g__witharrows_arrow _ \l__witharrows_prefix_str _ ##2 _ prop }
                  { initial } \l_tmpb_tl
                \int_compare:nNnTF \l_tmpa_tl < \l_tmpb_tl
                  \sort_return_swapped:
                  \sort_return_same:
              }
          }
      }
    \seq_map_inline:Nn \l__witharrows_o_arrows_seq
      {
        \prop_get:cnN
          { g__witharrows_arrow _ \l__witharrows_prefix_str _ ##1 _ prop }
          { initial } \l_tmpa_tl
        \int_set:Nn \l__witharrows_initial_int \l_tmpa_tl
        \prop_get:cnN
          { g__witharrows_arrow _ \l__witharrows_prefix_str _ ##1 _ prop }
          { final } \l_tmpa_tl
        \int_set:Nn \l__witharrows_final_int \l_tmpa_tl
        \prop_get:cnN
          { g__witharrows_arrow _ \l__witharrows_prefix_str _ ##1 _ prop }
          { input-line } \l__witharrows_input_line_str
        \dim_gzero:N \g_tmpa_dim
        \bool_set_false:N \g_tmpa_bool
        \pgfpicture
        \pgfrememberpicturepositiononpagetrue
        \int_step_inline:nnn \l__witharrows_first_arrow_int \l__witharrows_last_arrow_int
          {
            \prop_get:cnN
              { g__witharrows_arrow _ \l__witharrows_prefix_str _ ####1 _ prop }
              { initial } \l_tmpa_tl
            \prop_get:cnN
              { g__witharrows_arrow _ \l__witharrows_prefix_str _ ####1 _ prop }
              { final } \l_tmpb_tl
            \prop_get:cnN
              { g__witharrows_arrow _ \l__witharrows_prefix_str _ ####1 _ prop }
              { status } \l__witharrows_status_arrow_str
            \bool_if:nT
              {
                ! \int_compare_p:n { ##1 = ####1 }
                && \int_compare_p:n { \l__witharrows_initial_int <= \l_tmpa_tl }
                && \int_compare_p:n { \l_tmpb_tl <= \l__witharrows_final_int }
                && ! \str_if_eq_p:Vn \l__witharrows_status_arrow_str { independent }
              }
              {
                \bool_gset_true:N \g_tmpa_bool
                \prop_get:cnN
                  { g__witharrows _ arrow _ \l__witharrows_prefix_str _ ####1 _ prop }
                  { width }
                  \l_tmpa_tl
                \dim_gset:Nn \g_tmpa_dim { \dim_max:nn \g_tmpa_dim \l_tmpa_tl }
              }
          }
        \endpgfpicture
        \bool_if:NTF \g_tmpa_bool
          {
            \int_set:Nn \l__witharrows_arrow_int { ##1 }
            \dim_set_eq:NN \l__witharrows_xoffset_dim \g_tmpa_dim
            \dim_add:Nn \l__witharrows_xoffset_dim \l__witharrows_xoffset_for_o_arrows_dim
            \__witharrows_draw_arrow:
          }
          { \__witharrows_error:n { o~arrow~with~no~arrow~under } }
      }
  }
\cs_new:Npn \WithArrowsLastEnv { \int_use:N \g__witharrows_last_env_int }
\keys_define:nn { WithArrows / Arrow / code-after }
  {
    tikz     .code:n =
      \tikzset { WithArrows / arrow / .append~style = { #1 } } ,
    tikz     .value_required:n  = true ,
    rr       .value_forbidden:n = true ,
    rr       .code:n            = \__witharrows_fix_pos_option:n 0 ,
    ll       .value_forbidden:n = true,
    ll       .code:n            = \__witharrows_fix_pos_option:n 1 ,
    rl       .value_forbidden:n = true ,
    rl       .code:n            = \__witharrows_fix_pos_option:n 2 ,
    lr       .value_forbidden:n = true ,
    lr       .code:n            = \__witharrows_fix_pos_option:n 3 ,
    v        .value_forbidden:n = true ,
    v        .code:n            = \__witharrows_fix_pos_option:n 4 ,
    tikz-code .tl_set:N          = \l__witharrows_tikz_code_tl ,
    tikz-code .value_required:n  = true ,
    xoffset  .dim_set:N         = \l__witharrows_xoffset_dim ,
    xoffset  .value_required:n  = true ,
    unknown .code:n  =
      \__witharrows_sort_seq:N \l__witharrows_options_Arrow_code_after_seq
      \__witharrows_error:n { Unknown~option~Arrow~in~code-after }
  }
\seq_new:N \l__witharrows_options_Arrow_code_after_seq
\__witharrows_set_seq_of_str_from_clist:Nn \l__witharrows_options_Arrow_code_after_seq
  { ll, lr, rl, rr, tikz, tikz-code, v, x, offset }
\cs_new_protected:Npn \__witharrows_Arrow_code_after
  {
    \peek_meaning:NTF [
      { \__witharrows_Arrow_code_after_i }
      { \__witharrows_Arrow_code_after_i [ ] }
  }
\cs_new_protected:Npn \__witharrows_Arrow_code_after_i [ #1 ] #2 #3 #4
  {
    \peek_meaning:NTF [
      { \__witharrows_Arrow_code_after_ii [ #1 ] { #2 } { #3 } { #4 } }
      { \__witharrows_Arrow_code_after_ii [ #1 ] { #2 } { #3 } { #4 } [ ] }
  }
\cs_new_protected:Npn \__witharrows_Arrow_code_after_ii [ #1 ] #2 #3 #4 [ #5 ]
  {
    \int_set:Nn \l__witharrows_pos_arrow_int 1
    \str_clear_new:N \l__witharrows_previous_key_str
    \group_begin:
      \keys_set:nn { WithArrows / Arrow / code-after }
        { #1, #5, tikz = { xshift = \l__witharrows_xoffset_dim } }
      \bool_set_false:N \l__witharrows_initial_r_bool
      \bool_set_false:N \l__witharrows_final_r_bool
      \int_case:nn \l__witharrows_pos_arrow_int
        {
          0
            {
              \bool_set_true:N \l__witharrows_initial_r_bool
              \bool_set_true:N \l__witharrows_final_r_bool
            }
          2 { \bool_set_true:N \l__witharrows_initial_r_bool }
          3 { \bool_set_true:N \l__witharrows_final_r_bool }
        }
      \tl_if_eq:nnTF { #2 } { #3 }
        { \__witharrows_error:nn { Both~lines~are~equal } { #2 } }
        {
          \cs_if_free:cTF { pgf@sh@ns@wa - \l__witharrows_prefix_str - #2 - l }
            { \__witharrows_error:nx { Wrong~line~in~Arrow } { #2 } }
            {
              \cs_if_free:cTF { pgf@sh@ns@wa - \l__witharrows_prefix_str - #3 - l }
                { \__witharrows_error:nx { Wrong~line~in~Arrow } { #3 }  }
                {
                  \int_compare:nNnTF \l__witharrows_pos_arrow_int = 4
                    {
                      \pgfpicture
                        \pgfrememberpicturepositiononpagetrue
                        \pgfpointanchor { wa - \l__witharrows_prefix_str - #2 - l }
                          { south }
                        \dim_set_eq:NN \l_tmpa_dim \pgf@x
                        \dim_set_eq:NN \l_tmpb_dim \pgf@y
                        \pgfpointanchor { wa - \l__witharrows_prefix_str - #3 - l }
                          { north }
                        \dim_set:Nn \l_tmpa_dim
                          { \dim_max:nn \l_tmpa_dim \pgf@x }
                        \tl_gset:Nx \g_tmpa_tl
                          { \dim_use:N \l_tmpa_dim , \dim_use:N \l_tmpb_dim }
                        \tl_gset:Nx \g_tmpb_tl
                          { \dim_use:N \l_tmpa_dim , \dim_use:N \pgf@y }
                      \endpgfpicture
                    }
                    {
                      \pgfpicture
                        \pgfrememberpicturepositiononpagetrue
                        \pgfpointanchor
                          {
                            wa - \l__witharrows_prefix_str -
                            #2 - \bool_if:NTF \l__witharrows_initial_r_bool r l
                          }
                          { south }
                        \tl_gset:Nx \g_tmpa_tl
                          { \dim_use:N \pgf@x , \dim_use:N \pgf@y }
                        \pgfpointanchor
                          {
                            wa - \l__witharrows_prefix_str -
                            #3 - \bool_if:NTF \l__witharrows_final_r_bool r l
                          }
                          { north }
                        \tl_gset:Nx \g_tmpb_tl
                          { \dim_use:N \pgf@x , \dim_use:N \pgf@y }
                      \endpgfpicture
                    }
                  \__witharrows_draw_arrow:nnn \g_tmpa_tl \g_tmpb_tl { #4 }
                }
            }
        }
    \group_end:
  }
\cs_new_protected:Npn \__witharrows_MultiArrow:nn #1 #2
  {
    \exp_args:Nnx
      \regex_match:nnTF
      { \A \d+ (\,\d+)* ( \, \.\.\. (\,\d+)+ )* \Z }
      { #1 }
      { \__witharrows_MultiArrow_i:nn { #1 } { #2 } }
      { \__witharrows_error:nx { Invalid~specification~for~MultiArrow } { #1 } }
  }
\cs_new_protected:Npn \__witharrows_MultiArrow_i:nn #1 #2
  {
    \foreach \x in { #1 }
      {
        \cs_if_free:cTF { pgf@sh@ns@wa - \l__witharrows_prefix_str - \x - l }
          { \__witharrows_error:nx { Wrong~line~specification~in~MultiArrow } \x }
          { \clist_gput_right:Nx \g_tmpa_clist \x }
      }
    \int_compare:nTF { \clist_count:N \g_tmpa_clist < 2 }
      { \__witharrows_error:n { Too~small~specification~for~MultiArrow } }
      {
        \clist_sort:Nn \g_tmpa_clist
          {
            \int_compare:nTF { ##1 > ##2 }
              \sort_return_swapped:
              \sort_return_same:
          }
        \clist_pop:NN \g_tmpa_clist \l_tmpa_tl
        \clist_reverse:N \g_tmpa_clist
        \clist_pop:NN \g_tmpa_clist \l_tmpb_tl
        \exp_args:NV \__witharrows_MultiArrow_i:n \g_tmpa_clist
        \tikzpicture
          [
            __witharrows_standard ,
            every~path / .style = { WithArrows / arrow }
          ]
          \draw [<->] ([xshift = \l__witharrows_xoffset_dim]\l_tmpa_tl-r.south)
                      -- ++(5mm,0)
                      -- node (__witharrows_label) {}
                         ([xshift = \l__witharrows_xoffset_dim+5mm]\l_tmpb_tl-r.south)
                      -- ([xshift = \l__witharrows_xoffset_dim]\l_tmpb_tl-r.south)  ;
          \pgfpointanchor { wa - \l__witharrows_prefix_str - __witharrows_label } { west }
          \dim_set:Nn \l_tmpa_dim { 20 cm }
          \path \pgfextra { \tl_gset:Nx \g_tmpa_tl \tikz@text@width } ;
          \tl_if_empty:NF \g_tmpa_tl { \dim_set:Nn \l_tmpa_dim \g_tmpa_tl }
          \bool_lazy_and:nnT \l__witharrows_wrap_lines_bool \l__witharrows_in_DispWithArrows_bool
            {
              \dim_set:Nn \l_tmpb_dim
                { \g__witharrows_right_x_dim - \pgf@x - 0.3333 em }
              \dim_compare:nNnT \l_tmpb_dim < \l_tmpa_dim
                { \dim_set_eq:NN \l_tmpa_dim \l_tmpb_dim }
            }
          \path (__witharrows_label.west)
           node [ anchor = west, text~width = \dim_use:N \l_tmpa_dim ] { #2 } ;
        \endtikzpicture
      }
  }
\cs_new_protected:Npn \__witharrows_MultiArrow_i:n #1
  {
        \tikzpicture
      [
        __witharrows_standard ,
        every~path / .style = { WithArrows / arrow }
      ]
      \foreach \k in { #1 }
        {
          \draw [ <- ]
            ( [xshift = \l__witharrows_xoffset_dim]\k-r.south ) -- ++(5mm,0) ;
        } % ;
        \endtikzpicture
  }
\bool_if:NTF \c__witharrows_messages_for_Overleaf_bool
  { \str_const:Nn \c__witharrows_available_keys_str { } }
  {
    \str_const:Nn \c__witharrows_available_keys_str
      { For~a~list~of~the~available~keys,~type~H~<return>. }
  }
\str_new:N \l_witharrows_body_str
\cs_new:Npn \__witharrows_potential_body_i:
  {
    \str_if_empty:NF \l_witharrows_body_str
      { \\ If~you~want~to~see~the~body~of~the~environment,~type~H~<return>. }
  }
\cs_new:Npn \__witharrows_potential_body_ii:
  {
    \str_if_empty:NTF \l_witharrows_body_str
      { No~further~help~available }
      {
        The~body~of~your~environment~was:\\
        \l_witharrows_body_str
      }
  }
\str_const:Nn \c__witharrows_option_ignored_str
  { If~you~go~on,~this~option~will~be~ignored. }
\str_const:Nn \c__witharrows_command_ignored_str
  { If~you~go~on,~this~command~will~be~ignored. }
\__witharrows_msg_new:nn { Bad~value~for~replace~brace~by }
  {
    Incorrect~value.\\
    Bad~value~for~the~option~'\l_keys_key_str'.~The~value~must~begin~
    with~an~extensible~left~delimiter.~The~possible~values~are:~.,
    \token_to_str:N \{,~(,~[,~\token_to_str:N \lbrace,~
    \token_to_str:N \lbrack,~\token_to_str:N \lgroup,~
    \token_to_str:N \langle,~\token_to_str:N \lmoustache,~
    \token_to_str:N \lfloor\ and~\token_to_str:N \lceil\
    (and~\token_to_str:N \lvert\ and~\token_to_str:N \lVert\
    if~amsmath~or~unicode-math~is~loaded~in~LaTeX).\\
    \c__witharrows_option_ignored_str
  }
\__witharrows_msg_new:nn { option~of~cr~negative }
  {
    Bad~value.\\
    The~argument~of~the~command~\token_to_str:N\\~
    should~be~positive~in~the~row~\int_use:N \g__witharrows_line_int\
    of~your~environment~\{\l__witharrows_type_env_str\}.\\
    \c__witharrows_option_ignored_str
  }
\__witharrows_msg_new:nn { omit~probably~used }
  {
    Strange~problem.\\
    Maybe~you~have~used~a~command~
    \token_to_str:N\omit\ in~the~line~\int_use:N \g__witharrows_line_int\
    (or~another~line)~of~your~environment~\{\l__witharrows_type_env_str\}.\\
    You~can~go~on~but~you~may~have~others~errors.
  }
\__witharrows_msg_new:nnn { Invalid~option~format }
  {
    Invalide~value.\\
    The~key~'format'~should~contain~only~letters~r,~c~and~l~and~
    must~not~be~empty.\\
    \c__witharrows_option_ignored_str
    \__witharrows_potential_body_i:
  }
  { \__witharrows_potential_body_ii: }
\__witharrows_msg_new:nnn { invalid~key~o }
  {
    Invalid~use~of~a~key.\\
    The~key~'o'~for~individual~arrows~can~be~used~only~in~mode~
    'group'~or~in~mode~'groups'.\\
    \c__witharrows_option_ignored_str
    \__witharrows_potential_body_i:
  }
  { \__witharrows_potential_body_ii: }
\__witharrows_msg_new:nnn { Value~for~a~key }
  {
    Misuse~of~a~key.\\
    The~key~'\l_keys_key_str'~should~be~used~without~value. \\
    However,~you~can~go~on~for~this~time.
    \__witharrows_potential_body_i:
  }
  { \__witharrows_potential_body_ii: }
\__witharrows_msg_new:nnn { Unknown~option~in~Arrow }
  {
    Unknown~option.\\
    The~key~'\l_keys_key_str'~is~unknown~for~the~command~
    \l__witharrows_string_Arrow_for_msg_str\ in~the~row~
    \int_use:N \g__witharrows_line_int\ of~your~environment~
    \{\l__witharrows_type_env_str\}. \l_tmpa_str \\
    \c__witharrows_option_ignored_str \\
    \c__witharrows_available_keys_str
  }
  {
    The~available~keys~are~(in~alphabetic~order):~
    \seq_use:Nnnn \l__witharrows_options_Arrow_seq {~and~} {,~} {~and~}.
  }
\__witharrows_msg_new:nnn { Unknown~option~WithArrows }
  {
    Unknown~option.\\
    The~key~'\l_keys_key_str'~is~unknown~in~\{\l__witharrows_type_env_str\}. \\
    \c__witharrows_option_ignored_str \\
    \c__witharrows_available_keys_str
  }
  {
    The~available~keys~are~(in~alphabetic~order):~
    \seq_use:Nnnn \l__witharrows_options_WithArrows_seq {~and~} {,~} {~and~}.
  }
\__witharrows_msg_new:nnn { Unknown~option~DispWithArrows }
  {
    Unknown~option.\\
    The~key~'\l_keys_key_str'~is~unknown~in~\{\l__witharrows_type_env_str\}. \\
    \c__witharrows_option_ignored_str \\
    \c__witharrows_available_keys_str
  }
  {
    The~available~keys~are~(in~alphabetic~order):~
    \seq_use:Nnnn \l__witharrows_options_DispWithArrows_seq {~and~} {,~} {~and~}.
  }
\__witharrows_msg_new:nnn { Unknown~option~WithArrowsOptions }
  {
    Unknown~option.\\
    The~key~'\l_keys_key_str'~is~unknown~in~
    \token_to_str:N \WithArrowsOptions. \\
    \c__witharrows_option_ignored_str \\
    \c__witharrows_available_keys_str
  }
  {
    The~available~keys~are~(in~alphabetic~order):~
    \seq_use:Nnnn \l__witharrows_options_WithArrowsOptions_seq {~and~} {,~} {~and~}.
  }
\__witharrows_msg_new:nnn { Unknown~option~Arrow~in~code-after }
  {
    Unknown~option.\\
    The~key~'\l_keys_key_str'~is~unknown~in~
    \token_to_str:N \Arrow\ in~code-after. \\
    \c__witharrows_option_ignored_str \\
    \c__witharrows_available_keys_str
  }
  {
    The~available~keys~are~(in~alphabetic~order):~
    \seq_use:Nnnn \l__witharrows_options_Arrow_code_after_seq {~and~} {,~} {~and~}.
  }
\__witharrows_msg_new:nnn { Too~much~columns~in~WithArrows }
  {
    Too~much~columns.\\
    Your~environment~\{\l__witharrows_type_env_str\}~has~\int_use:N
    \l__witharrows_nb_cols_int\ columns~and~you~try~to~use~one~more.~
    Maybe~you~have~forgotten~a~\c_backslash_str\c_backslash_str.~
    If~you~really~want~to~use~more~columns~(after~the~arrows)~you~should~use~
    the~option~'more-columns'~at~a~global~level~or~for~an~environment. \\
    However,~you~can~go~one~for~this~time.
    \__witharrows_potential_body_i:
  }
  { \__witharrows_potential_body_ii: }
\__witharrows_msg_new:nnn { Too~much~columns~in~DispWithArrows }
  {
    Too~much~columns.\\
    Your~environment~\{\l__witharrows_type_env_str\}~has~\int_use:N
    \l__witharrows_nb_cols_int\ columns~and~you~try~to~use~one~more.~
    Maybe~you~have~forgotten~a~\c_backslash_str\c_backslash_str\
    at~the~end~of~row~\int_use:N \g__witharrows_line_int. \\
    This~error~is~fatal.
    \__witharrows_potential_body_i:
  }
  { \__witharrows_potential_body_ii: }
\__witharrows_msg_new:nn { Negative~jump }
  {
    Incorrect~value.\\
    You~can't~use~a~negative~value~for~the~option~'jump'~of~command~
    \l__witharrows_string_Arrow_for_msg_str\
    in~the~row~\int_use:N \g__witharrows_line_int\
    of~your~environment~\{\l__witharrows_type_env_str\}.~
    You~can~create~an~arrow~going~backwards~with~the~option~'<-'~of~Tikz. \\
    \c__witharrows_option_ignored_str
  }
\__witharrows_msg_new:nn { new-group~without~groups }
  {
    Misuse~of~a~key.\\
    You~can't~use~the~option~'new-group'~for~the~command~
    \l__witharrows_string_Arrow_for_msg_str\
    because~you~are~not~in~'groups'~mode.~Try~to~use~the~option~
    'groups'~in~your~environment~\{\l__witharrows_type_env_str\}. \\
    \c__witharrows_option_ignored_str
  }
\__witharrows_msg_new:nnn
  { Too~few~lines~for~an~arrow }
  {
    Impossible~arrow.\\
    Line~\l__witharrows_input_line_str\
    :~an~arrow~specified~in~the~row~\int_use:N \l__witharrows_initial_int\
    of~your~environment~\{\l__witharrows_type_env_str\}~can't~be~drawn~
    because~it~arrives~after~the~last~row~of~the~environment. \\
    If~you~go~on,~this~arrow~will~be~ignored.
    \__witharrows_potential_body_i:
  }
  { \__witharrows_potential_body_ii: }
\__witharrows_msg_new:nn { o~arrow~with~no~arrow~under }
  {
    Problem~with~the~key~'o'.\\
    Line~\l__witharrows_input_line_str\
    :~there~is~no~arrow~'under'~your~arrow~of~type~'o'.\\
    If~you~go~on,~this~arrow~won't~be~drawn.
  }
\__witharrows_msg_new:nnn { WithArrows~outside~math~mode }
  {
    You~are~outside~math~mode.\\
    The~environment~\{\l__witharrows_type_env_str\}~should~be~used~only~in~math~mode~
    like~the~environment~\{aligned\}~of~amsmath. \\
    Nevertheless,~you~can~go~on.
    \__witharrows_potential_body_i:
  }
  { \__witharrows_potential_body_ii: }
\__witharrows_msg_new:nnn { DispWithArrows~in~math~mode }
  {
    You~are~in~math~mode.\\
    The~environment~\{\l__witharrows_type_env_str\}~should~be~used~only~outside~math~
    mode~like~the~environments~\{align\}~and~\{align*\}~of~amsmath. \\
    This~error~is~fatal.
    \__witharrows_potential_body_i:
  }
  { \__witharrows_potential_body_ii: }
\__witharrows_msg_new:nn { Incompatible~options~in~Arrow }
  {
    Incompatible~options.\\
    You~try~to~use~the~option~'\l_keys_key_str'~but~
    this~option~is~incompatible~or~redundant~with~the~option~
    '\l__witharrows_previous_key_str'~set~in~the~same~command~
    \l__witharrows_string_Arrow_for_msg_str. \\
    \c__witharrows_option_ignored_str
  }
\__witharrows_msg_new:nn { Incompatible~options a}
  {
    Incompatible~options.
    You~try~to~use~the~option~'\l_keys_key_str'~but~
    this~option~is~incompatible~or~redundant~with~the~option~
    '\l__witharrows_previous_key_str'~set~in~the~same~command~
    \bool_if:NT \l__witharrows_in_code_after_bool
      {
        \l__witharrows_string_Arrow_for_msg_str\
        in~the~code-after~of~your~environment~\{\l__witharrows_type_env_str\}
      }. \\
    \c__witharrows_option_ignored_str
  }
\__witharrows_msg_new:nnn { Arrow~not~in~last~column }
  {
    Bad~use~of~\l__witharrows_string_Arrow_for_msg_str.
    You~should~use~the~command~\l__witharrows_string_Arrow_for_msg_str\
    only~in~the~last~column~(column~\int_use:N\l__witharrows_nb_cols_int)~
    in~the~row~\int_use:N \g__witharrows_line_int\
    of~your~environment~\{\l__witharrows_type_env_str\}.\\
    However~you~can~go~on~for~this~time.
    \__witharrows_potential_body_i:
  }
  { \__witharrows_potential_body_ii: }
\__witharrows_msg_new:nn { Wrong~line~in~Arrow }
  {
    Wrong~line.\\
    The~specification~of~line~'#1'~you~use~in~the~command~
    \l__witharrows_string_Arrow_for_msg_str\
    in~the~'code-after'~of~\{\l__witharrows_type_env_str\}~doesn't~exist. \\
    \c__witharrows_option_ignored_str
  }
\__witharrows_msg_new:nn { Both~lines~are~equal }
  {
    Both~lines~are~equal.\\
    In~the~'code-after'~of~\{\l__witharrows_type_env_str\}~you~try~to~
    draw~an~arrow~going~to~itself~from~the~line~'#1'.~This~is~not~possible. \\
    \c__witharrows_option_ignored_str
  }
\__witharrows_msg_new:nn { Wrong~line~specification~in~MultiArrow }
  {
    Wrong~line~specification.\\
    The~specification~of~line~'#1'~doesn't~exist. \\
    If~you~go~on,~it~will~be~ignored~for~\token_to_str:N \MultiArrow.
  }
\__witharrows_msg_new:nn { Too~small~specification~for~MultiArrow }
  {
    Too~small~specification.\\
    The~specification~of~lines~you~gave~to~\token_to_str:N \MultiArrow\
    is~too~small:~you~need~at~least~two~lines. \\
    \c__witharrows_command_ignored_str
  }
\__witharrows_msg_new:nn { Not~allowed~in~DispWithArrows }
  {
    Forbidden~command.\\
    The~command~\token_to_str:N #1
    is~allowed~only~in~the~last~column~
    (column~\int_use:N\l__witharrows_nb_cols_int)~of~\{\l__witharrows_type_env_str\}. \\
    \c__witharrows_option_ignored_str
  }
\__witharrows_msg_new:nn { Not~allowed~in~WithArrows }
  {
    Forbidden~command.\\
    The~command~\token_to_str:N #1 is~not~allowed~in~\{\l__witharrows_type_env_str\}~
    (it's~allowed~in~the~last~column~of~\{DispWithArrows\}). \\
    \c__witharrows_option_ignored_str
  }
\__witharrows_msg_new:nn { Inexistent~v-node }
  {
    There~is~a~problem.\\
    Maybe~you~have~put~a~command~\token_to_str:N\cr\
    instead~of~a~command~\token_to_str:N\\~at~the~end~of~
    the~row~\l_tmpa_int\
    of~your~environment~\{\l__witharrows_type_env_str\}. \\
    This~error~is~fatal.
  }
\__witharrows_msg_new:nn { Option~xoffset~forbidden }
  {
    Incorrect~key.\\
    You~can't~use~the~option~'xoffset'~in~the~command~
    \l__witharrows_string_Arrow_for_msg_str\ in~the~row~\int_use:N \g__witharrows_line_int\
    of~your~environment~\{\l__witharrows_type_env_str\}~
    because~you~are~using~the~option~
    ' \int_compare:nNnTF \l__witharrows_pos_arrow_int = 7
        { group }
        { groups } '.~It's~possible~for~an~independent~arrow~or~if~there~is~
    only~one~arrow. \\
    \c__witharrows_option_ignored_str
  }
\__witharrows_msg_new:nnn { Duplicate~name }
  {
    Duplicate~name.\\
    The~name~'\l_keys_value_tl'~is~already~used~and~you~shouldn't~use~
    the~same~environment~name~twice.~You~can~go~on,~but,~
    maybe,~you~will~have~incorrect~results. \\
    For~a~list~of~the~names~already~used,~type~H~<return>. \\
    If~you~don't~want~to~see~this~message~again,~use~the~option~
    'allow-duplicate-names'.
  }
  {
    The~names~already~defined~in~this~document~are:~
    \seq_use:Nnnn \g__witharrows_names_seq { ,~ } { ,~ } { ~and~ }.
  }
\__witharrows_msg_new:nn { Invalid~specification~for~MultiArrow }
  {
    Invalid~specification.\\
    The~specification~of~rows~for~\token_to_str:N\MultiArrow\
    (i.e.~#1)~is~invalid. \\
    \c__witharrows_command_ignored_str
  }
\cs_new_protected:Npn \WithArrowsNewStyle #1 #2
  {
    \keys_if_exist:nnTF { WithArrows / Global } { #1 }
      { \__witharrows_error:nn { Key~already~defined } { #1 } }
      {
        \seq_clear:N \l_tmpa_seq
        \keyval_parse:NNn \__witharrows_valid_key:n \__witharrows_valid_key:nn { #2 }
        \seq_if_empty:NTF \l_tmpa_seq
          {
            \seq_put_right:Nx \l__witharrows_options_WithArrows_seq
              { \tl_to_str:n { #1 } }
            \seq_put_right:Nx \l__witharrows_options_DispWithArrows_seq
              { \tl_to_str:n { #1 } }
            \seq_put_right:Nx \l__witharrows_options_WithArrowsOptions_seq
              { \tl_to_str:N { #1 } }
            \cs_if_exist:NTF \keys_precompile:nnN
              {
                \keys_precompile:nnN
                  { WithArrows / WithArrowsOptions }
                  { #2 }
                  \l_tmpa_tl
                \__witharrows_key_define:nV { #1 } \l_tmpa_tl
              }
              {
                \keys_define:nn { WithArrows / Global }
                  {
                    #1 .code:n =
                     { \keys_set:nn { WithArrows / WithArrowsOptions } { #2 } }
                  }
              }
          }
          { \__witharrows_error:nn { Impossible~style } { #1 } }
      }
  }
\__witharrows_msg_new:nn { Impossible~style }
  {
    Impossible~style.\\
    It's~impossible~to~define~the~style~'#1'~
    because~it~contains~unknown~keys:~'
    \seq_use:Nnnn \l_tmpa_seq { '~and~' } { ',~'} { ',~and~}'.
  }
\cs_new_protected:Npn \__witharrows_valid_key:n #1
  {
    \keys_if_exist:nnF { WithArrows / Global } { #1 }
      { \seq_put_right:Nn \l_tmpa_seq { #1 } }
  }
\cs_new_protected:Npn \__witharrows_valid_key:nn #1 #2
  {
    \keys_if_exist:nnF { WithArrows / Global } { #1 }
      { \seq_put_right:Nn \l_tmpa_seq { #1 } }
  }
\cs_new_protected:Npn \__witharrows_key_define:nn #1 #2
  { \keys_define:nn { WithArrows / Global } { #1 .code:n = #2 } }
\cs_generate_variant:Nn \__witharrows_key_define:nn { n V }
\__witharrows_msg_new:nn { Key~already~defined }
  {
    Key~already~define.\\
    The~key~'#1'~is~already~defined. \\
    If~you~go~on,~your~instruction~\token_to_str:N\WithArrowsNewStyle\
    will~be~ignored.
  }
\keys_define:nn { WithArrows / up-and-down }
  {
    radius .dim_set:N = \l__witharrows_up_and_down_radius_dim ,
    radius .value_required:n = true ,
    width .code:n =
      \str_case:nnF { #1 }
        {
          { min } { \dim_zero:N \l__witharrows_arrow_width_dim }
          { max } { \dim_set_eq:NN \l__witharrows_arrow_width_dim \c_max_dim }
        }
        { \dim_set:Nn \l__witharrows_arrow_width_dim { #1 } } ,
    width .value_required:n = true ,
    unknown .code:n = \__witharrows_error:n { Option~unknown~for~up-and-down }
  }
\__witharrows_msg_new:nn { Option~unknown~for~up-and-down }
  {
    Unknown~option.\\
    The~option~'\l_keys_key_str'~is~unknown.~\c__witharrows_option_ignored_str
  }
\tl_const:Nn \c__witharrows_tikz_code_up_tl
  {
    \dim_case:nnF \l__witharrows_arrow_width_dim
      {
        \c_max_dim
          {
            \draw [ rounded~corners = \l__witharrows_up_and_down_radius_dim ]
              let \p1 = ( #1 ) , \p2 = ( #2 )
              in (\p1) -- node { #3 } (\x2,\y1) -- (\p2) ;
          }
        \c_zero_dim
          {
            \path node
              {
                \hbox_gset:Nn \g_tmpa_box { #3 }
                \dim_gset:Nn \g_tmpa_dim
                  { \box_wd:N \g_tmpa_box + \l__witharrows_up_and_down_radius_dim }
              } ;
            \draw
              let \p1 = ( #1 ) , \p2 = ( #2 )
              in (\x2-\g_tmpa_dim,\y1)
                 -- node { \box_use:N \g_tmpa_box }
                 (\x2-\l__witharrows_up_and_down_radius_dim,\y1)
                 [ rounded~corners = \l__witharrows_up_and_down_radius_dim ]
                 -| (\p2) ;
          }
      }
      {
        \draw
          let \p1 = ( #1 ) , \p2 = ( #2 )
          in (\x2 - \l__witharrows_arrow_width_dim - \l__witharrows_up_and_down_radius_dim,\y1)
             -- node { #3 } (\x2-\l__witharrows_up_and_down_radius_dim,\y1)
             [ rounded~corners = \l__witharrows_up_and_down_radius_dim ]
             -| (\p2) ;
      }
  }
\tl_const:Nn \c__witharrows_tikz_code_down_tl
  {
    \dim_case:nnF \l__witharrows_arrow_width_dim
      {
        \c_max_dim
          {
            \draw [ rounded~corners = \l__witharrows_up_and_down_radius_dim ]
              let \p1 = ( #1 ) , \p2 = ( #2 )
              in (\p1) -- (\x1,\y2) -- node { #3 } (\p2) ;
          }
        \c_zero_dim
          {
            \path node
              {
                \hbox_gset:Nn \g_tmpa_box { #3 }
                \dim_gset:Nn \g_tmpa_dim
                  { \box_wd:N \g_tmpa_box + \l__witharrows_up_and_down_radius_dim }
              } ;
            \draw
              let \p1 = ( #1 ) , \p2 = ( #2 )
              in (\p1)
                 { [ rounded~corners = \l__witharrows_up_and_down_radius_dim ] -- (\x1,\y2) }
                 -- (\x1-\l__witharrows_up_and_down_radius_dim,\y2)
                 -- node { \box_use:N \g_tmpa_box } (\x1-\g_tmpa_dim,\y2)
                 -- ++ (-2mm,0) ;
          }
      }
      {
        \draw
          let \p1 = ( #1 ) , \p2 = ( #2 )
          in (\p1)
             { [ rounded~corners = \l__witharrows_up_and_down_radius_dim ] -- (\x1,\y2) }
             -- (\x1-\l__witharrows_up_and_down_radius_dim,\y2)
             -- node { #3 }
                (\x1 - \l__witharrows_arrow_width_dim - \l__witharrows_up_and_down_radius_dim,\y2)
             -- ++ (-2mm,0) ;
      }
  }
\keys_define:nn { WithArrows / Arrow / FirstPass }
  {
    up   .code:n = \__witharrows_set_independent_bis: ,
    down .code:n = \__witharrows_set_independent_bis: ,
    up   .default:n = NoValue ,
    down .default:n = NoValue
  }
\keys_define:nn { WithArrows / Arrow / SecondPass }
  {
    up .code:n =
      \str_if_empty:NT \l__witharrows_previous_key_str
        {
          \str_set:Nn \l__witharrows_previous_key_str { up }
          \cs_if_exist:cTF { tikz@library@calc@loaded }
            {
              \keys_set:nV { WithArrows / up-and-down } \l_keys_value_tl
              \int_set:Nn \l__witharrows_pos_arrow_int 1
              \bool_set_false:N \l__witharrows_wrap_lines_bool
              \tl_set_eq:NN \l__witharrows_tikz_code_tl \c__witharrows_tikz_code_up_tl
            }
            { \__witharrows_error:n { calc~not~loaded } }
        } ,
    down .code:n =
      \str_if_empty:NT \l__witharrows_previous_key_str
        {
          \str_set:Nn \l__witharrows_previous_key_str { down }
          \cs_if_exist:cTF { tikz@library@calc@loaded }
            {
              \keys_set:nV { WithArrows / up-and-down } \l_keys_value_tl
              \int_set:Nn \l__witharrows_pos_arrow_int 1
              \bool_set_false:N \l__witharrows_wrap_lines_bool
              \tl_set_eq:NN \l__witharrows_tikz_code_tl \c__witharrows_tikz_code_down_tl
            }
            { \__witharrows_error:n { calc~not~loaded } }
        }
  }
\seq_put_right:Nn \l__witharrows_options_Arrow_seq { down }
\seq_put_right:Nn \l__witharrows_options_Arrow_seq { up }
\__witharrows_msg_new:nn { calc~not~loaded }
  {
    calc~not~loaded.\\
    You~can't~use~the~option~'\l_keys_key_str'~because~you~don't~have~loaded~the~
    Tikz~library~'calc'.You~should~add~'\token_to_str:N\usetikzlibrary{calc}'~
    ~in~the~preamble~of~your~document. \\
    \c__witharrows_option_ignored_str
  }
\catcode `\@ = 12
\ExplSyntaxOff
\endinput
%%
%% End of file `witharrows.tex'.
