summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/witharrows/witharrows.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/witharrows/witharrows.sty')
-rw-r--r--Master/texmf-dist/tex/latex/witharrows/witharrows.sty588
1 files changed, 320 insertions, 268 deletions
diff --git a/Master/texmf-dist/tex/latex/witharrows/witharrows.sty b/Master/texmf-dist/tex/latex/witharrows/witharrows.sty
index 291cd84469e..795d67b973b 100644
--- a/Master/texmf-dist/tex/latex/witharrows/witharrows.sty
+++ b/Master/texmf-dist/tex/latex/witharrows/witharrows.sty
@@ -18,8 +18,8 @@
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%%
-\def\myfileversion{1.16}
-\def\myfiledate{2019/03/11}
+\def\myfileversion{1.17}
+\def\myfiledate{2019/07/09}
\RequirePackage{tikz}
\usetikzlibrary{arrows.meta,bending}
\RequirePackage{expl3}[2019/02/15]
@@ -99,6 +99,8 @@
\cs_new_protected:Npn \__wa_error:n { \msg_error:nn { witharrows } }
\cs_new_protected:Npn \__wa_error:nn { \msg_error:nnn { witharrows } }
\cs_generate_variant:Nn \__wa_error:nn { n x }
+\cs_generate_variant:Nn \tl_put_right:Nn { N v }
+\cs_generate_variant:Nn \seq_set_split:Nnn { N x x }
\AtBeginDocument
{
\clist_map_inline:nn
@@ -137,7 +139,6 @@
\sort_return_same:
}
}
-\cs_generate_variant:Nn \seq_set_split:Nnn { N x x }
\cs_new_protected:Npn \__wa_save:N #1
{
\seq_set_split:Nxx \l_tmpa_seq
@@ -191,14 +192,14 @@
\tikzset
{
WithArrows / arrow / .style =
- {
- align = left ,
- auto = left ,
- font = \small \itshape ,
- WithArrows / arrow / tips ,
- bend~left = 45 ,
- ->
- }
+ {
+ align = left ,
+ auto = left ,
+ font = \small \itshape ,
+ WithArrows / arrow / tips ,
+ bend~left = 45 ,
+ ->
+ }
}
\AtBeginDocument
{
@@ -211,9 +212,11 @@
}
}
}
+\newtoks \__wa_parameter_token
+\__wa_parameter_token = { # }
\bool_new:N \l__wa_in_WithArrows_bool
\bool_new:N \l__wa_in_DispWithArrows_bool
-\bool_new:N \l__wa_in_CodeAfter_bool
+\bool_new:N \l__wa_in_code_after_bool
\seq_new:N \g__wa_position_in_the_tree_seq
\seq_gput_right:Nn \g__wa_position_in_the_tree_seq 1
\int_new:N \g__wa_last_env_int
@@ -224,12 +227,33 @@
\int_new:N \g__wa_arrow_int
\seq_new:N \g__wa_line_int_seq
\int_new:N \g__wa_line_int
+\seq_new:N \g__wa_col_int_seq
+\int_new:N \g__wa_col_int
\clist_new:N \l__wa_tags_clist
\clist_set:Nn \l__wa_tags_clist { all }
-\str_set:Nn \l__wa_CommandName_str { Arrow }
+\cs_new_protected:Npn \__wa_test_if_to_tag:
+ {
+ \clist_if_in:NVT \l__wa_tags_clist \g__wa_line_int
+ { \clist_set:Nn \l__wa_tags_clist { all } }
+ }
+\str_new:N \l__wa_command_name_str
+\str_set:Nn \l__wa_command_name_str { Arrow }
+\str_new:N \l__wa_string_Arrow_for_msg_str
\str_set:Nx \l__wa_string_Arrow_for_msg_str { \token_to_str:N \Arrow }
\seq_new:N \g__wa_names_seq
\bool_new:N \l__wa_sbwi_bool
+\bool_new:N \l__wa_in_first_columns_bool
+\bool_new:N \l__wa_tag_star_bool
+\bool_new:N \l__wa_tag_next_line_bool
+\bool_new:N \l__wa_qedhere_bool
+\bool_new:N \l__wa_new_group_bool
+\bool_new:N \l__wa_initial_r_bool
+\bool_new:N \l__wa_final_r_bool
+\tl_new:N \l__wa_initial_tl
+\tl_new:N \l__wa_final_tl
+\int_new:N \l__wa_nb_of_columns_int
+\bool_new:N \l__wa_last_col_bool
+\str_new:N \l__wa_format_str
\cs_new_protected:Npn \__wa_eval_if_allowed:n #1
{
\str_if_empty:NTF \l__wa_previous_key_str
@@ -250,16 +274,17 @@
ystart .value_required:n = true ,
ystart .initial:n = 0.4 ex ,
more-columns .code:n =
- \__wa_msg_redirect_name:nn { Third~column~in~WithArrows } { none } ,
+ \__wa_msg_redirect_name:nn { Too~much~columns~in~WithArrows } { none } ,
more-columns .value_forbidden:n = true,
- CommandName .code:n =
- \str_set:Nn \l__wa_CommandName_str { #1 }
+ command-name .code:n =
+ \str_set:Nn \l__wa_command_name_str { #1 }
\str_set:Nx \l__wa_string_Arrow_for_msg_str
{ \c_backslash_str Arrow~alias~\c_backslash_str #1 } ,
- CommandName .value_required:n = true ,
- TikzCode .tl_set:N = \l__wa_tikz_code_tl,
- TikzCode .initial:n = \draw~(#1)~to~node{#3}~(#2)~; ,
- TikzCode .value_required:n = true ,
+ command-name .value_required:n = true ,
+ tikz-code .tl_set:N = \l__wa_tikz_code_tl,
+ tikz-code .initial:n = \draw~(#1)~to~node{#3}~(#2)~; ,
+ tikz-code .value_required:n = true ,
+ TikzCode .meta:n = { tikz-code = #1 } ,
displaystyle .bool_set:N = \l__wa_displaystyle_bool ,
displaystyle .default:n = true ,
show-nodes .code:n =
@@ -370,10 +395,28 @@
{ \seq_gput_left:Nn \g__wa_names_seq { #1 } }
\str_set:Nn \l__wa_name_str { #1 } ,
name .value_required:n = true ,
- CodeBefore .code:n = \tl_put_right:Nn \l__wa_code_before_tl { #1 } ,
- CodeBefore .value_required:n = true,
- CodeAfter .code:n = \tl_put_right:Nn \l__wa_code_after_tl { #1 } ,
- CodeAfter .value_required:n = true
+ code-before .code:n = \tl_put_right:Nn \l__wa_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__wa_code_after_tl { #1 } ,
+ code-after .value_required:n = true ,
+ CodeAfter .meta:n = { code-after = #1 } ,
+ format .code:n = \__wa_set_option_format:n { #1 },
+ format .value_required:n = true ,
+ }
+\cs_new_protected:Npn \__wa_set_option_format:n #1
+ {
+ \bool_set_true:N \l_tmpa_bool
+ \str_map_inline:nn { #1 }
+ {
+ \str_if_in:nnF {rcl} { ##1 }
+ {
+ \bool_set_false:N \l_tmpa_bool
+ \__wa_error:n { Invalid~option~format }
+ \str_map_break:
+ }
+ }
+ \bool_if:NT \l_tmpa_bool { \tl_set:Nn \l__wa_format_str { #1 } }
}
\keys_define:nn { WithArrows }
{
@@ -396,32 +439,34 @@
WithArrows / DispWithArrowsSpecific
}
}
+\seq_new:N \l__wa_options_WithArrows_seq
+\seq_set_from_clist:Nn \l__wa_options_WithArrows_seq
+ {
+ adjust, b, c, code-after, code-before, command-name, displaystyle, end-adjust,
+ format, group, groups, i, interline, jot, ll, lr, more-columns, name,
+ no-arrows, rl, rr, show-node-names, show-nodes, start-adjust, t, tikz,
+ tikz-code, xoffset, ygap, ystart
+ }
\keys_define:nn { WithArrows / WithArrows }
{
unknown .code:n =
\__wa_sort_seq:N \l__wa_options_WithArrows_seq
\__wa_error:n { Unknown~option~WithArrows }
}
-\seq_set_from_clist:Nn \l__wa_options_WithArrows_seq
- {
- adjust, b, c, CodeAfter, CodeBefore, CommandName, displaystyle, end-adjust,
- group, groups, i, interline, jot, ll, lr, more-columns, name, no-arrows, rl,
- rr, show-node-names, show-nodes, start-adjust, t, tikz, TikzCode, xoffset,
- ygap, ystart
- }
\keys_define:nn { WithArrows / DispWithArrows }
{
unknown .code:n =
\__wa_sort_seq:N \l__wa_options_DispWithArrows_seq
\__wa_error:n { Unknown~option~DispWithArrows }
}
+\seq_new:N \l__wa_options_DispWithArrows_seq
\seq_set_from_clist:Nn \l__wa_options_DispWithArrows_seq
{
- allow-multiple-labels, CodeAfter, CodeBefore, CommandName, TikzCode, adjust,
- displaystyle, end-adjust, fleqn, group, groups, i, interline, jot, ll, lr,
- mathindent, name, no-arrows, nonumber, notag, rl, rr, show-node-names,
- show-nodes, start-adjust, tagged-lines, tikz, wrap-lines, xoffset, ygap,
- ystart
+ allow-multiple-labels, code-after, code-before, command-name, tikz-code, adjust,
+ displaystyle, end-adjust, fleqn, group, format, groups, i, interline, jot,
+ ll, lr, mathindent, name, no-arrows, nonumber, notag, rl, rr,
+ show-node-names, show-nodes, start-adjust, tagged-lines, tikz, wrap-lines,
+ xoffset, ygap, ystart
}
\keys_define:nn { WithArrows / WithArrowsOptions }
{
@@ -432,10 +477,11 @@
\__wa_sort_seq:N \l__wa_options_WithArrowsOptions_seq
\__wa_error:n { Unknown~option~WithArrowsOptions }
}
+\seq_new:N \l__wa_options_WithArrowsOptions_seq
\seq_set_from_clist:Nn \l__wa_options_WithArrowsOptions_seq
{
- allow-duplicate-names, allow-multiple-labels, b, c, CommandName,
- more-columns, TikzCode, adjust, displaystyle, end-adjust, fleqn, group,
+ allow-duplicate-names, allow-multiple-labels, b, c, command-name,
+ more-columns, tikz-code, adjust, displaystyle, end-adjust, fleqn, group,
groups, i, interline, jot, ll, lr, mathindent, no-arrows, nonumber, notag,
rl, rr, show-node-names, show-nodes, standard-behaviour-with-items,
start-adjust, t, tagged-lines, tikz, wrap-lines, xoffset, ygap, ystart
@@ -473,8 +519,8 @@
\int_compare:nTF { \l__wa_pos_arrow_int = 6 }
{ \str_set:Nn \l__wa_status_arrow_str { new-group } }
{ \__wa_error:n { new-group~without~groups } } ,
- TikzCode .code:n = \prg_do_nothing: ,
- TikzCode .value_required:n = true ,
+ tikz-code .code:n = \prg_do_nothing: ,
+ tikz-code .value_required:n = true ,
tikz .code:n = \prg_do_nothing: ,
tikz .value_required:n = true ,
xoffset .code:n =
@@ -491,9 +537,10 @@
\__wa_sort_seq:N \l__wa_options_Arrow_seq
\__wa_error:n { Unknown~option~in~Arrow }
}
+\seq_new:N \l__wa_options_Arrow_seq
\seq_set_from_clist:Nn \l__wa_options_Arrow_seq
{
- adjust, end-adjust, i, jump, ll, lr, rl, rr, start-adjust, tikz, TikzCode,
+ adjust, end-adjust, i, jump, ll, lr, rl, rr, start-adjust, tikz, tikz-code,
xoffset
}
\cs_new_protected:Npn \__wa_fix_pos_arrow:n #1
@@ -506,8 +553,8 @@
}
\keys_define:nn {WithArrows / Arrow / SecondPass }
{
- TikzCode .tl_set:N = \l__wa_tikz_code_tl ,
- TikzCode .initial:n = \draw~(#1)~to~node{#3}~(#2)~; ,
+ tikz-code .tl_set:N = \l__wa_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 = \__wa_fix_pos_arrow:n 3 ,
@@ -547,9 +594,9 @@
{ g__wa_arrow _ \l__wa_prefix_str _ \int_use:N \g__wa_arrow_int _ prop }
\l_tmpa_prop
}
-\cs_new_protected:Npn \__wa_Arrow_first_column:
- { \__wa_error:n { Arrow~in~first~column } \__wa_Arrow }
-\cs_new_protected:Npn \__wa_pre_environment:n #1
+\cs_new_protected:Npn \__wa_Arrow_first_columns:
+ { \__wa_error:n { Arrow~not~in~last~column } \__wa_Arrow }
+\cs_new_protected:Npn \__wa_pre_halign:n #1
{
\str_clear_new:N \l__wa_type_env_str
\str_set:NV \l__wa_type_env_str \@currenvir
@@ -563,6 +610,8 @@
\int_gzero:N \g__wa_arrow_int
\seq_gput_right:NV \g__wa_line_int_seq \g__wa_line_int
\int_gzero:N \g__wa_line_int
+ \seq_gput_right:NV \g__wa_col_int_seq \g__wa_col_int
+ \int_gzero:N \g__wa_col_int
\seq_gput_right:Nn \g__wa_position_in_the_tree_seq 1
\seq_set_eq:NN \l_tmpa_seq \g__wa_position_in_the_tree_seq
\seq_pop_right:NN \l_tmpa_seq \l_tmpa_tl
@@ -576,7 +625,8 @@
\int_zero_new:N \l__wa_pos_of_arrow_int
\int_zero_new:N \l__wa_jump_int
\int_set:Nn \l__wa_jump_int \c_one_int
- \bool_set_false:N \l__wa_in_first_column_bool
+ \str_set:Nn \l__wa_format_str { rl }
+ \bool_set_true:N \l__wa_last_col_bool
\seq_clear_new:N \l__wa_labels_seq
\bool_set_false:N \l__wa_tag_next_line_bool
\skip_zero:N \l__wa_interline_skip
@@ -587,9 +637,13 @@
{ \keys_set:nn { WithArrows / WithArrows } { #1 } }
\bool_if:NT \l__wa_in_DispWithArrows_bool
{ \keys_set:nn { WithArrows / DispWithArrows } { #1 } }
+ \cs_set_eq:cN \l__wa_command_name_str \__wa_Arrow_first_columns:
+ \int_set:Nn \l__wa_nb_of_columns_int { \str_count:N \l__wa_format_str }
+ \seq_clear_new:N \l__wa_format_seq
+ \seq_set_split:NnV \l__wa_format_seq { } \l__wa_format_str
\bool_if:NT \g__wa_footnote_bool { \begin { savenotes } }
\l__wa_code_before_tl
- \cs_set_eq:cN \l__wa_CommandName_str \__wa_Arrow
+ \spread@equation
\cs_set_eq:NN \notag \__wa_notag:
\cs_set_eq:NN \nonumber \__wa_notag:
\cs_set_eq:NN \tag \__wa_tag
@@ -597,31 +651,63 @@
\cs_set_eq:NN \label \__wa_label:n
\cs_set_eq:NN \tagnextline \__wa_tagnextline:
}
-\NewDocumentEnvironment { WithArrows } { ! O { } }
+\cs_new_protected:Npn \__wa_construct_halign:
+ {
+ \seq_pop_right:NNTF \l__wa_format_seq \l__wa_type_col_str
+ {
+ \use:x
+ {
+ \bool_set_false:N \l__wa_last_col_bool
+ \__wa_construct_halign:
+ \bool_if:NT \l__wa_last_col_bool
+ {
+ \cs_set_eq:cN { \l__wa_command_name_str } \__wa_Arrow
+ \bool_if:NT \l__wa_in_DispWithArrows_bool
+ {
+ \__wa_test_if_to_tag:
+ \bool_if:NT \c__wa_amsthm_loaded_bool \__wa_set_qedhere:
+ }
+ }
+ \str_if_eq:VnT \l__wa_type_col_str { c } \hfil
+ \str_if_eq:VnT \l__wa_type_col_str { r } \hfill
+ \int_gincr:N \g__wa_col_int
+ $ % $
+ {
+ { }
+ \bool_if:NT \l__wa_displaystyle_bool \displaystyle
+ ####
+ }
+ $ % $
+ \bool_if:NTF \l__wa_last_col_bool
+ { \__wa_construct_nodes: }
+ {
+ \str_if_eq:VnT \l__wa_type_col_str { l } \hfil
+ \str_if_eq:VnT \l__wa_type_col_str { c } \hfil
+ \bool_if:NT \l__wa_in_DispWithArrows_bool { \tabskip = \c_zero_skip }
+ &
+ }
+ }
+ }
+ {
+ \bool_if:NTF \l__wa_in_WithArrows_bool
+ {
+ \ialign
+ \bgroup
+ }
+ {
+ \halign to
+ \bool_if:NTF \l__wa_inlabel_bool \linewidth \displaywidth
+ \bgroup
+ \bool_if:NT \l__wa_fleqn_bool
+ { \skip_horizontal:N \l__wa_mathindent_dim }
+ }
+ \int_gincr:N \g__wa_line_int
+ \int_gzero:N \g__wa_col_int
+ \strut
+ }
+ }
+\cs_new_protected:Npn \__wa_construct_nodes:
{
- \bool_set_true:N \l__wa_in_WithArrows_bool
- \bool_set_false:N \l__wa_in_DispWithArrows_bool
- \__wa_pre_environment:n { #1 }
- \if_mode_math: \else:
- \__wa_error:n { WithArrows~outside~math~mode }
- \fi:
- \int_case:nn \l__wa_pos_env_int { 0 \vtop 1 \vcenter 2 \vbox }
- \bgroup
- \spread@equation
- \ialign \bgroup
- \int_gincr:N \g__wa_line_int
- \cs_set_eq:cN \l__wa_CommandName_str \__wa_Arrow_first_column:
- \bool_set_true:N \l__wa_in_first_column_bool
- \strut \hfil
- $
- \bool_if:NT \l__wa_displaystyle_bool \displaystyle
- { ## }
- $
- &
- $
- \bool_if:NT \l__wa_displaystyle_bool \displaystyle
- { { } ## }
- $
\tikz [ remember~picture , overlay ]
\node
[
@@ -652,10 +738,22 @@
\bool_if:NT \l__wa_show_node_names_bool
{
\hbox_overlap_right:n
- { \small wa - \l__wa_prefix_str - \int_use:N \g__wa_line_int }
+ { \small wa - \l__wa_prefix_str - \int_use:N \g__wa_line_int - r }
}
+ }
+\NewDocumentEnvironment { WithArrows } { ! O { } }
+ {
+ \bool_set_true:N \l__wa_in_WithArrows_bool
+ \bool_set_false:N \l__wa_in_DispWithArrows_bool
+ \__wa_pre_halign:n { #1 }
+ \if_mode_math: \else:
+ \__wa_error:n { WithArrows~outside~math~mode }
+ \fi:
+ \int_case:nn \l__wa_pos_env_int { 0 \vtop 1 \vcenter 2 \vbox }
+ \bgroup
+ \__wa_construct_halign:
&&
- \__wa_error:n { Third~column~in~WithArrows }
+ \__wa_error:n { Too~much~columns~in~WithArrows }
$
\bool_if:NT \l__wa_displaystyle_bool \displaystyle
{ ## }
@@ -666,10 +764,10 @@
\\
\egroup
\egroup
- \__wa_post_environment:
+ \__wa_post_halign:
\bool_if:NT \g__wa_footnote_bool { \end { savenotes } }
}
-\cs_new_protected:Npn \__wa_post_environment:
+\cs_new_protected:Npn \__wa_post_halign:
{
\cs_set:Npn \WithArrowsRightX { \g__wa_right_x_dim }
\int_compare:nNnT \g__wa_arrow_int > 0 \__wa_scan_arrows:
@@ -677,8 +775,8 @@
\tikzset { every~picture / .style = __wa_standard }
\cs_set:Npn \WithArrowsNbLines { \int_use:N \g__wa_line_int }
\cs_set_eq:NN \MultiArrow \__wa_MultiArrow:nn
- \cs_set_eq:cN \l__wa_CommandName_str \__wa_Arrow_code_after
- \bool_set_true:N \l__wa_in_CodeAfter_bool
+ \cs_set_eq:cN \l__wa_command_name_str \__wa_Arrow_code_after
+ \bool_set_true:N \l__wa_in_code_after_bool
\l__wa_code_after_tl
\group_end:
\seq_gpop_right:NN \g__wa_position_in_the_tree_seq \l_tmpa_tl
@@ -691,11 +789,13 @@
\int_gset:Nn \g__wa_arrow_int \l_tmpa_tl
\seq_gpop_right:NN \g__wa_line_int_seq \l_tmpa_tl
\int_gset:Nn \g__wa_line_int \l_tmpa_tl
+ \seq_gpop_right:NN \g__wa_col_int_seq \l_tmpa_tl
+ \int_gset:Nn \g__wa_col_int \l_tmpa_tl
}
\cs_new_protected:Npn \__wa_cr:
{
\scan_stop:
- \bool_if:NT \l__wa_in_first_column_bool { & { } }
+ \prg_replicate:nn { \l__wa_nb_of_columns_int - \g__wa_col_int } { & { } }
\group_align_safe_begin:
\peek_meaning_remove:NTF * \__wa_cr_i: \__wa_cr_i:
}
@@ -779,81 +879,6 @@
}
\cr \noalign { \skip_vertical:n { #1 + \l__wa_interline_skip } \scan_stop: }
}
-\cs_new_protected:Npn \__wa_if_in_second_col_of_disp:Nn #1 #2
- {
- \bool_if:NTF \l__wa_in_WithArrows_bool
- { \__wa_error:nn { Not~allowed~in~WithArrows } { #1 } }
- {
- \bool_if:NTF \l__wa_in_first_column_bool
- { \__wa_error:nn { Not~allowed~in~DispWithArrows } { #1 } }
- { #2 }
- }
- }
-\cs_new_protected:Npn \__wa_notag:
- { \__wa_if_in_second_col_of_disp:Nn \notag { \clist_clear:N \l__wa_tags_clist } }
-\NewDocumentCommand \__wa_tag { s m }
- {
- \__wa_if_in_second_col_of_disp:Nn \tag
- {
- \tl_if_empty:NF \l__wa_tag_tl
- { \__wa_error:nn { Multiple~tags } { #2 } }
- \clist_set:Nn \l__wa_tags_clist { all }
- \bool_if:nT \c__wa_mathtools_loaded_bool
- {
- \MH_if_boolean:nT { show_only_refs }
- {
- \MH_if_boolean:nF { show_manual_tags }
- { \clist_clear:N \l__wa_tags_clist }
- }
- }
- \tl_set:Nn \l__wa_tag_tl { #2 }
- \bool_set:Nn \l__wa_tag_star_bool { #1 }
- \bool_if:nT { #1 && ! \bool_if_p:N \c__wa_amsmath_loaded_bool }
- { \__wa_error:n { tag*~without~amsmath } }
- }
- }
-\cs_new_protected:Npn \__wa_label:n #1
- {
- \__wa_if_in_second_col_of_disp:Nn \label
- {
- \seq_if_empty:NF \l__wa_labels_seq
- {
- \bool_if:NTF \c__wa_cleveref_loaded_bool
- { \__wa_error:n { Multiple~labels~with~cleveref } }
- { \__wa_error:n { Multiple~labels } }
- }
- \seq_put_right:Nn \l__wa_labels_seq { #1 }
- \bool_if:nT \c__wa_mathtools_loaded_bool
- {
- \MH_if_boolean:nT { show_only_refs }
- {
- \cs_if_exist:cTF { MT_r_#1 }
- { \clist_set:Nn \l__wa_tags_clist { all } }
- { \clist_clear:N \l__wa_tags_clist }
- }
- }
- \bool_if:nT \c__wa_autonum_loaded_bool
- {
- \cs_if_exist:cTF { autonum@#1Referenced }
- { \clist_set:Nn \l__wa_tags_clist { all } }
- { \clist_clear:N \l__wa_tags_clist }
- }
- }
- }
-\cs_new_protected:Npn \__wa_tagnextline:
- {
- \__wa_if_in_second_col_of_disp:Nn \tagnextline
- { \bool_set_true:N \l__wa_tag_next_line_bool }
- }
-\cs_new_protected:Npn \__wa_qedhere: { \bool_set_true:N \l__wa_qedhere_bool }
-\cs_new_protected:Npn \__wa_qedhere_i:
- {
- \group_begin:
- \cs_set_eq:NN \qed \qedsymbol
- \cs_set_eq:NN \qed@elt \setQED@elt
- \QED@stack \relax \relax
- \group_end:
- }
\bool_new:N \l__wa_inlabel_bool
\NewDocumentEnvironment { DispWithArrows } { ! O { } }
{
@@ -868,7 +893,7 @@
\bool_if:NT \c__wa_typedref_loaded_bool { \str_set:Nn \sr@name { equation } }
\bool_if:NT \c__wa_amsmath_loaded_bool \intertext@
\bool_set_true:N \l__wa_in_DispWithArrows_bool
- \__wa_pre_environment:n { #1 }
+ \__wa_pre_halign:n { #1 }
\bool_if:NF \l__wa_sbwi_bool
{
\if@inlabel
@@ -890,71 +915,17 @@
\fi:
$$
}
- \bool_if:NTF \l__wa_inlabel_bool \vtop \vcenter \bgroup
- \spread@equation
+ \vtop \bgroup
\bool_if:NTF \l__wa_fleqn_bool
{ \tabskip = \c_zero_skip }
{ \tabskip = 0 pt plus 1000 pt minus 1000 pt }
- \halign to \bool_if:NTF \l__wa_inlabel_bool \linewidth \displaywidth
- \bgroup
- \int_gincr:N \g__wa_line_int
- \cs_set_eq:cN \l__wa_CommandName_str \__wa_Arrow_first_column:
- \bool_set_true:N \l__wa_in_first_column_bool
- \strut
- \bool_if:NT \l__wa_fleqn_bool { \skip_horizontal:n \l__wa_mathindent_dim }
- \hfil
- $
- \bool_if:NT \l__wa_displaystyle_bool \displaystyle
- { ## }
- $
- \tabskip = \c_zero_skip
- &
- \clist_if_in:NVT \l__wa_tags_clist \g__wa_line_int
- { \clist_set:Nn \l__wa_tags_clist { all } }
- \bool_if:NT \c__wa_amsthm_loaded_bool
- { \cs_set_eq:NN \qedhere \__wa_qedhere: }
- $
- \bool_if:NT \l__wa_displaystyle_bool \displaystyle
- { { } ## }
- $
+ \__wa_construct_halign:
\tabskip = 0 pt plus 1000 pt minus 1000 pt
- \tikz [ remember~picture , overlay ]
- \node
- [
- node~contents = { } ,
- __wa_node_style ,
- name = wa - \l__wa_prefix_str - \int_use:N \g__wa_line_int - l ,
- alias =
- {
- \str_if_empty:NF \l__wa_name_str
- { \l__wa_name_str - \int_use:N \g__wa_line_int - l }
- }
- ]
- ;
- \hfil
- \tikz [ remember~picture , overlay ]
- \node
- [
- node~contents = { } ,
- __wa_node_style ,
- name = wa - \l__wa_prefix_str - \int_use:N \g__wa_line_int - r ,
- alias =
- {
- \str_if_empty:NF \l__wa_name_str
- { \l__wa_name_str - \int_use:N \g__wa_line_int - r }
- }
- ]
- ;
- \bool_if:NT \l__wa_show_node_names_bool
- {
- \hbox_overlap_right:n
- { \small wa - \l__wa_prefix_str - \int_use:N \g__wa_line_int }
- }
&
$ ## $
\tabskip = \c_zero_skip
&&
- \__wa_error:n { Third~column~in~DispWithArrows }
+ \__wa_error:n { Too~much~columns~in~DispWithArrows }
\bool_if:nT \c_false_bool { ## }
\cr
}
@@ -964,30 +935,28 @@
\\
\egroup
\egroup
- \bool_if:NT \l__wa_in_DispWithArrows_bool
- {
- \dim_gzero_new:N \g__wa_right_x_dim
- \dim_gset_eq:NN \g__wa_right_x_dim \c_max_dim
- \begin { tikzpicture } [ __wa_standard ]
- \int_step_variable:nNn \g__wa_line_int \l_tmpa_int
+ \dim_gzero_new:N \g__wa_right_x_dim
+ \dim_gset_eq:NN \g__wa_right_x_dim \c_max_dim
+ \begin { tikzpicture } [ __wa_standard ]
+ \int_step_variable:nNn \g__wa_line_int \l_tmpa_int
+ {
+ \cs_if_free:cTF
+ { pgf@sh@ns@wa - \l__wa_prefix_str - \l_tmpa_int - v }
+ { \__wa_error:n { Inexistent~v-node } }
{
- \cs_if_free:cTF
- { pgf@sh@ns@wa - \l__wa_prefix_str - \l_tmpa_int - v }
- { \__wa_error:n { Inexistent~v-node } }
- {
- \tikz@parse@node\pgfutil@firstofone ( \l_tmpa_int - v )
- \dim_set:Nn \l_tmpa_dim \pgf@x
- \dim_compare:nNnT \l_tmpa_dim < \g__wa_right_x_dim
- { \dim_gset:Nn \g__wa_right_x_dim \l_tmpa_dim }
- }
+ \tikz@parse@node\pgfutil@firstofone ( \l_tmpa_int - v )
+ \dim_set:Nn \l_tmpa_dim \pgf@x
+ \dim_compare:nNnT \l_tmpa_dim < \g__wa_right_x_dim
+ { \dim_gset:Nn \g__wa_right_x_dim \l_tmpa_dim }
}
- \end { tikzpicture }
- }
- \__wa_post_environment:
+ }
+ \end { tikzpicture }
+ \__wa_post_halign:
\bool_if:nT \c__wa_mathtools_loaded_bool
{ \MH_if_boolean:nT { show_only_refs } \MT_showonlyrefs_true: }
\bool_if:NTF \l__wa_inlabel_bool
- { $ % $
+ {
+ $ % $
\skip_vertical:N \belowdisplayskip
}
{ $$ }
@@ -1000,6 +969,82 @@
\DispWithArrows
}
\endDispWithArrows
+\cs_new_protected:Npn \__wa_if_in_last_col_of_disp:Nn #1 #2
+ {
+ \bool_if:NTF \l__wa_in_WithArrows_bool
+ { \__wa_error:nn { Not~allowed~in~WithArrows } { #1 } }
+ {
+ \int_compare:nNnTF \g__wa_col_int < \l__wa_nb_of_columns_int
+ { \__wa_error:nn { Not~allowed~in~DispWithArrows } { #1 } }
+ { #2 }
+ }
+ }
+\cs_new_protected:Npn \__wa_notag:
+ { \__wa_if_in_last_col_of_disp:Nn \notag { \clist_clear:N \l__wa_tags_clist } }
+\NewDocumentCommand \__wa_tag { s m }
+ {
+ \__wa_if_in_last_col_of_disp:Nn \tag
+ {
+ \tl_if_empty:NF \l__wa_tag_tl
+ { \__wa_error:nn { Multiple~tags } { #2 } }
+ \clist_set:Nn \l__wa_tags_clist { all }
+ \bool_if:nT \c__wa_mathtools_loaded_bool
+ {
+ \MH_if_boolean:nT { show_only_refs }
+ {
+ \MH_if_boolean:nF { show_manual_tags }
+ { \clist_clear:N \l__wa_tags_clist }
+ }
+ }
+ \tl_set:Nn \l__wa_tag_tl { #2 }
+ \bool_set:Nn \l__wa_tag_star_bool { #1 }
+ \bool_if:nT { #1 && ! \bool_if_p:N \c__wa_amsmath_loaded_bool }
+ { \__wa_error:n { tag*~without~amsmath } }
+ }
+ }
+\cs_new_protected:Npn \__wa_label:n #1
+ {
+ \__wa_if_in_last_col_of_disp:Nn \label
+ {
+ \seq_if_empty:NF \l__wa_labels_seq
+ {
+ \bool_if:NTF \c__wa_cleveref_loaded_bool
+ { \__wa_error:n { Multiple~labels~with~cleveref } }
+ { \__wa_error:n { Multiple~labels } }
+ }
+ \seq_put_right:Nn \l__wa_labels_seq { #1 }
+ \bool_if:nT \c__wa_mathtools_loaded_bool
+ {
+ \MH_if_boolean:nT { show_only_refs }
+ {
+ \cs_if_exist:cTF { MT_r_#1 }
+ { \clist_set:Nn \l__wa_tags_clist { all } }
+ { \clist_clear:N \l__wa_tags_clist }
+ }
+ }
+ \bool_if:nT \c__wa_autonum_loaded_bool
+ {
+ \cs_if_exist:cTF { autonum@#1Referenced }
+ { \clist_set:Nn \l__wa_tags_clist { all } }
+ { \clist_clear:N \l__wa_tags_clist }
+ }
+ }
+ }
+\cs_new_protected:Npn \__wa_tagnextline:
+ {
+ \__wa_if_in_last_col_of_disp:Nn \tagnextline
+ { \bool_set_true:N \l__wa_tag_next_line_bool }
+ }
+\cs_new_protected:Npn \__wa_qedhere: { \bool_set_true:N \l__wa_qedhere_bool }
+\cs_new_protected:Npn \__wa_set_qedhere: { \cs_set_eq:NN \qedhere \__wa_qedhere: }
+\cs_new_protected:Npn \__wa_qedhere_i:
+ {
+ \group_begin:
+ \cs_set_eq:NN \qed \qedsymbol
+ \cs_set_eq:NN \qed@elt \setQED@elt
+ \QED@stack \relax \relax
+ \group_end:
+ }
\cs_new_protected:Npn \__wa_scan_arrows:
{
\group_begin:
@@ -1265,7 +1310,7 @@
}
}
\cs_new:Npn \WithArrowsLastEnv { \int_use:N \g__wa_last_env_int }
-\keys_define:nn { WithArrows / Arrow / CodeAfter }
+\keys_define:nn { WithArrows / Arrow / code-after }
{
tikz .code:n =
\tikzset { WithArrows / arrow / .append~style = { #1 } } ,
@@ -1280,22 +1325,23 @@
lr .code:n = \__wa_fix_pos_option:n 3 ,
v .value_forbidden:n = true ,
v .code:n = \__wa_fix_pos_option:n 4 ,
- TikzCode .tl_set:N = \l__wa_tikz_code_tl ,
- TikzCode .value_required:n = true ,
+ tikz-code .tl_set:N = \l__wa_tikz_code_tl ,
+ tikz-code .value_required:n = true ,
xoffset .dim_set:N = \l__wa_xoffset_dim ,
xoffset .value_required:n = true ,
unknown .code:n =
- \__wa_sort_seq:N \l__wa_options_Arrow_CodeAfter_seq
- \__wa_error:n { Unknown~option~Arrow~in~CodeAfter }
+ \__wa_sort_seq:N \l__wa_options_Arrow_code_after_seq
+ \__wa_error:n { Unknown~option~Arrow~in~code-after }
}
-\seq_set_from_clist:Nn \l__wa_options_Arrow_CodeAfter_seq
- { ll, lr, rl, rr, tikz, TikzCode, v, x, offset }
+\seq_new:N \l__wa_options_Arrow_code_after_seq
+\seq_set_from_clist:Nn \l__wa_options_Arrow_code_after_seq
+ { ll, lr, rl, rr, tikz, tikz-code, v, x, offset }
\NewDocumentCommand \__wa_Arrow_code_after { O { } m m m ! O { } }
{
\int_set:Nn \l__wa_pos_arrow_int 1
\str_clear_new:N \l__wa_previous_key_str
\group_begin:
- \keys_set:nn { WithArrows / Arrow / CodeAfter }
+ \keys_set:nn { WithArrows / Arrow / code-after }
{ #1, #5, tikz = { xshift = \l__wa_xoffset_dim } }
\bool_set_false:N \l__wa_initial_r_bool
\bool_set_false:N \l__wa_final_r_bool
@@ -1388,7 +1434,7 @@
\bool_if:nT { \l__wa_wrap_lines_bool && \l__wa_in_DispWithArrows_bool }
{
\dim_set:Nn \l_tmpb_dim
- { \g__wa_right_x_dim - \pgf@x - 0.3333 em }
+ { \g__wa_right_x_dim - \pgf@x - 0.3333 em }
\dim_compare:nNnT \l_tmpb_dim < \l_tmpa_dim
{ \dim_set_eq:NN \l_tmpa_dim \l_tmpb_dim }
}
@@ -1413,6 +1459,13 @@
}
\str_const:Nn \c__wa_option_ignored_str
{ If~you~go~on,~this~option~will~be~ignored. }
+\str_const:Nn \c__wa_command_ignored_str
+ { If~you~go~on,~this~command~will~be~ignored. }
+\__wa_msg_new:nn { Invalid~option~format }
+ {
+ The~option~'format'~should~contain~only~letters~r,~c~and~l.\\
+ \c__wa_option_ignored_str
+ }
\__wa_msg_new:nn { Value~for~a~key }
{
The~key~'\l_keys_key_tl'~should~be~used~without~value. \\
@@ -1462,30 +1515,31 @@
The~available~keys~are~(in~alphabetic~order):~
\seq_use:Nnnn \l__wa_options_WithArrowsOptions_seq {~and~} {,~} {~and~}.
}
-\__wa_msg_new:nnn { Unknown~option~Arrow~in~CodeAfter }
+\__wa_msg_new:nnn { Unknown~option~Arrow~in~code-after }
{
The~option~'\l_keys_key_tl'~is~unknown~in~
\token_to_str:N \Arrow\
- in~\token_to_str:N \CodeAfter. \\
+ in~\token_to_str:N \code-after. \\
\c__wa_option_ignored_str \\
For~a~list~of~the~available~keys,~type~H~<return>.
}
{
The~available~keys~are~(in~alphabetic~order):~
- \seq_use:Nnnn \l__wa_options_Arrow_CodeAfter_seq {~and~} {,~} {~and~}.
+ \seq_use:Nnnn \l__wa_options_Arrow_code_after_seq {~and~} {,~} {~and~}.
}
-\__wa_msg_new:nn { Third~column~in~WithArrows }
+\__wa_msg_new:nn { Too~much~columns~in~WithArrows }
{
- By~default,~an~environment~\{\l__wa_type_env_str\}~can~only~have~
- two~columns.~Maybe~you~have~forgotten~a~
- \c_backslash_str\c_backslash_str.~If~you~really~want~more~than~
- two~columns,~you~should~use~the~option~'more-columns'~at~a~global~
- level~or~for~an~environment. \\
+ Your~environment~\{\l__wa_type_env_str\}~has~\int_use:N
+ \l__wa_nb_of_columns_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.
}
-\__wa_msg_new:nn { Third~column~in~DispWithArrows }
+\__wa_msg_new:nn { Too~much~columns~in~DispWithArrows }
{
- An~environment~\{\l__wa_type_env_str\}~can~only~have~two~columns.~
+ Your~environment~\{\l__wa_type_env_str\}~has~\int_use:N
+ \l__wa_nb_of_columns_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__wa_line_int. \\
If~you~go~on,~you~may~have~other~errors.
@@ -1539,32 +1593,31 @@
{ You~try~to~use~the~option~'\l_keys_key_tl'~but~
this~option~is~incompatible~or~redundant~with~the~option~
'\l__wa_previous_key_str'~set~in~the~same~command~
- \bool_if:NT \l__wa_in_CodeAfter_bool
+ \bool_if:NT \l__wa_in_code_after_bool
{
\l__wa_string_Arrow_for_msg_str\
- in~the~CodeAfter~of~your~environment~\{\l__wa_type_env_str\}
+ in~the~code-after~of~your~environment~\{\l__wa_type_env_str\}
}. \\
\c__wa_option_ignored_str
}
-\__wa_msg_new:nn { Arrow~in~first~column }
+\__wa_msg_new:nn { Arrow~not~in~last~column }
{
- You~should~not~use~the~command~\l__wa_string_Arrow_for_msg_str\
- in~the~first~column~of~your~environment~\{\l__wa_type_env_str\}~
- but~only~in~the~second~column. \\
+ You~should~use~the~command~\l__wa_string_Arrow_for_msg_str\
+ only~in~the~last~column~of~your~environment~\{\l__wa_type_env_str\}.\\
However~you~can~go~on~for~this~time.
}
\__wa_msg_new:nn { Wrong~line~in~Arrow }
{
The~specification~of~line~'#1'~you~use~in~the~command~
\l__wa_string_Arrow_for_msg_str\
- in~the~'CodeAfter'~of~\{\l__wa_type_env_str\}~doesn't~exist. \\
- If~you~go~on,~this~command~will~be~ignored.
+ in~the~'code-after'~of~\{\l__wa_type_env_str\}~doesn't~exist. \\
+ \c__wa_option_ignored_str
}
\__wa_msg_new:nn { Both~lines~are~equal }
{
- In~the~'CodeAfter'~of~\{\l__wa_type_env_str\}~you~try~to~
+ In~the~'code-after'~of~\{\l__wa_type_env_str\}~you~try~to~
draw~an~arrow~going~to~it~self~from~the~line~'#1'.~This~is~not~possible. \\
- If~you~go~on,~this~command~will~be~ignored.
+ \c__wa_option_ignored_str
}
\__wa_msg_new:nn { Wrong~line~specification~in~MultiArrow }
{
@@ -1575,7 +1628,7 @@
{
The~specification~of~lines~you~gave~to~\token_to_str:N \MultiArrow\
is~too~small:~you~need~at~least~two~lines. \\
- If~you~go~on,~this~command~will~be~ignored.
+ \c__wa_option_ignored_str
}
\__wa_msg_new:nn { tag*~without~amsmath }
{
@@ -1587,15 +1640,14 @@
\__wa_msg_new:nn { Not~allowed~in~DispWithArrows }
{
The~command~\token_to_str:N #1
- is~not~allowed~in~the~first~column~of~\{\l__wa_type_env_str\}~but~
- only~in~the~second~column. \\
- If~you~go~on,~this~command~will~be~ignored.
+ is~allowed~only~in~the~last~columnm~of~\{\l__wa_type_env_str\}. \\
+ \c__wa_option_ignored_str
}
\__wa_msg_new:nn { Not~allowed~in~WithArrows }
{
The~command~\token_to_str:N #1 is~not~allowed~in~\{\l__wa_type_env_str\}~
- (it's~allowed~in~the~second~column~of~\{DispWithArrows\}). \\
- If~you~go~on,~this~command~will~be~ignored.
+ (it's~allowed~in~the~last~column~of~\{DispWithArrows\}). \\
+ \c__wa_option_ignored_str
}
\__wa_msg_new:nn { Multiple~tags }
{
@@ -1752,7 +1804,7 @@
{
You~can't~use~the~option~'\l_keys_key_tl'~because~you~don't~have~loaded~the~
Tikz~library~'calc'.You~should~add~'\token_to_str:N\usetikzlibrary{calc}'
- ~in~your~preamble. \\
+ ~in~the~preamble~of~your~document. \\
\c__wa_option_ignored_str
}
\__wa_msg_new:nnn { Duplicate~name }