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.sty222
1 files changed, 204 insertions, 18 deletions
diff --git a/Master/texmf-dist/tex/latex/witharrows/witharrows.sty b/Master/texmf-dist/tex/latex/witharrows/witharrows.sty
index 734bd4b0386..81837e0a9af 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.6.1}
-\def\myfiledate{2018/05/18}
+\def\myfileversion{1.7}
+\def\myfiledate{2018/07/18}
\RequirePackage{tikz}
\usetikzlibrary{arrows.meta,bending}
\RequirePackage{l3keys2e}
@@ -96,6 +96,7 @@
{\cs_set_protected:Npn \spread@equation
{\openup\jot
\cs_set_protected:Npn \spread@equation {}}}
+\bool_new:N \l__wa_in_witharrows_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
@@ -113,13 +114,27 @@
\seq_new:N \g__wa_line_bis_int_seq
\int_new:N \g__wa_line_bis_int
\tl_new:N \l__wa_name_tl
+\bool_new:N \l__wa_notag_bool
+\tl_new:N \l__wa_tag_tl
+\bool_new:N \l__wa_tag_star_bool
+\tl_new:N \l__wa_label_tl
+\cs_set:Nn \__wa_label:n {\tl_set:Nn \l__wa_label_tl {#1}}
+\bool_new:N \l__wa_fleqn_bool
+\dim_new:N \l__wa_mathindent_dim
+\dim_set:Nn \l__wa_mathindent_dim {25pt}
\int_set:Nn \l__wa_level_int 1
\keys_define:nn {WithArrows/GlobalOrEnv}
- { t .code:n = \int_set:Nn \l__wa_pos_env_int 0,
+ { t .code:n = {\bool_if:NTF \l__wa_in_witharrows_bool
+ {\int_set:Nn \l__wa_pos_env_int 0}
+ {\msg_error:nn {witharrows} {Option~will~be~ignored}}},
t .value_forbidden:n = true,
- c .code:n = \int_set:Nn \l__wa_pos_env_int 1,
+ c .code:n = {\bool_if:NTF \l__wa_in_witharrows_bool
+ {\int_set:Nn \l__wa_pos_env_int 1}
+ {\msg_error:nn {witharrows} {Option~will~be~ignored}}},
c .value_forbidden:n = true,
- b .code:n = \int_set:Nn \l__wa_pos_env_int 2,
+ b .code:n = {\bool_if:NTF \l__wa_in_witharrows_bool
+ {\int_set:Nn \l__wa_pos_env_int 2}
+ {\msg_error:nn {witharrows} {Option~will~be~ignored}}},
b .value_forbidden:n = true,
ygap .dim_set:N = \l__wa_ygap_dim,
ygap .value_required:n = true,
@@ -129,7 +144,7 @@
ystart .initial:n = 0.4 ex,
MoreColumns .code:n = { \msg_redirect_name:nnn
{witharrows}
- {Third~column~in~an~environment}
+ {Third~column~in~an~environment~{WithArrows}}
{none} },
MoreColumns .value_forbidden:n = true,
AllowLineWithoutAmpersand .code:n = { \msg_redirect_name:nnn
@@ -173,6 +188,23 @@
{\msg_error:nn {witharrows} {Option~will~be~ignored}}
{\tl_set:Nn \l__wa_name_tl {#1}}} ,
name .value_required:n = true,
+ fleqn .code:n = {\bool_if:NTF \l__wa_in_witharrows_bool
+ {\msg_error:nn {witharrows} {Option~will~be~ignored}}
+ {\tl_if_eq:nnTF {#1} {true}
+ {\bool_set_true:N \l__wa_fleqn_bool}
+ {\bool_set_false:N \l__wa_fleqn_bool}}},
+ fleqn .default:n = true,
+ mathindent .code:n = {\bool_if:NTF \l__wa_in_witharrows_bool
+ {\msg_error:nn {witharrows} {Option~will~be~ignored}}
+ {\dim_set:Nn \l__wa_mathindent_dim {#1}}},
+ mathindent .value_required:n = true,
+ notag .code:n = {\bool_if:NTF \l__wa_in_witharrows_bool
+ {\msg_error:nn {witharrows} {Option~will~be~ignored}}
+ {\tl_if_eq:nnTF {#1} {true}
+ {\bool_set_true:N \l__wa_notag_bool}
+ {\bool_set_false:N \l__wa_notag_bool}}},
+ notag .default:n = true,
+ nonumber .meta:n = notag,
unknown .code:n = \msg_error:nn {witharrows} {Option~unknown}
}
\keys_define:nn {WithArrows/General}
@@ -249,7 +281,7 @@
{\tl_set:Nn \l_tmpa_tl {Arrow}
\msg_error:nn {witharrows} {Arrow~in~first~column}
\__wa_Arrow}
-\NewDocumentEnvironment {WithArrows} {O{}}
+\cs_new_protected:Nn \__wa_pre_environment:n
{ \seq_gput_right:NV \g__wa_arrow_int_seq \g__wa_arrow_int
\int_gzero:N \g__wa_arrow_int
\seq_gput_right:NV \g__wa_line_int_seq \g__wa_line_int
@@ -261,10 +293,6 @@
\seq_pop_right:NN \l_tmpa_seq \l_tmpa_tl
\str_clear_new:N \l__wa_prefix_str
\str_set:Nx \l__wa_prefix_str {\seq_use:Nnnn \l_tmpa_seq {-} {-} {-}}
- \reverse_if:N \if_mode_math:
- \msg_error:nn {witharrows}
- {{WithArrows}~used~outside~math~mode}
- \fi:
\cs_set_eq:NN \\ \__wa_cr:
\dim_zero:N \mathsurround
\int_zero_new:N \l__wa_initial_int
@@ -279,7 +307,26 @@
\keys_set:nV {WithArrows/GlobalOrEnv} \l_tmpa_tl
\bool_if:NT \g__wa_footnote_bool {\begin{savenotes}}
\l__wa_code_before_tl
- \cs_set_eq:cN \l__wa_CommandName_tl \__wa_Arrow
+ \cs_set_eq:cN \l__wa_CommandName_tl \__wa_Arrow}
+\NewDocumentEnvironment {WithArrows} {O{}}
+ { \bool_set_true:N \l__wa_in_witharrows_bool
+ \reverse_if:N \if_mode_math:
+ \msg_error:nn {witharrows}
+ {{WithArrows}~used~outside~math~mode}
+ \fi:
+ \cs_set:Npn \notag {\msg_error:nnn {witharrows}
+ {Command~not~allowed~in~{WithArrows}}
+ {\notag}}
+ \cs_set:Npn \nonumber {\msg_error:nnn {witharrows}
+ {Command~not~allowed~in~{WithArrows}}
+ {\nonumber}}
+ \cs_set:Npn \tag ##1 {\msg_error:nnn {witharrows}
+ {Command~not~allowed~in~{WithArrows}}
+ {\tag}}
+ \cs_set:Npn \label ##1 {\msg_error:nnn {witharrows}
+ {Command~not~allowed~in~{WithArrows}}
+ {\label}}
+ \__wa_pre_environment:n {#1}
\int_case:nn \l__wa_pos_env_int
{0 {\vtop}
1 {\vcenter}
@@ -314,14 +361,16 @@
\bool_if:NT \l__wa_shownodenames_bool
{\hbox_overlap_right:n {\small wa-\l__wa_prefix_str
-\int_use:N\g__wa_line_int}}
- && \msg_error:nn {witharrows} {Third~column~in~an~environment}
+ && \msg_error:nn {witharrows} {Third~column~in~an~environment~{WithArrows}}
$\bool_if:NT \l__wa_displaystyle_bool \displaystyle {##}$
\cr
}
{\crcr
\egroup
\egroup
- \int_compare:nNnT \g__wa_line_bis_int < \g__wa_line_int
+ \__wa_post_environment:}
+\cs_new_protected:Nn \__wa_post_environment:
+ {\int_compare:nNnT \g__wa_line_bis_int < \g__wa_line_int
{\msg_error:nn {witharrows} {All~lines~must~have~an~ampersand}}
\int_compare:nNnT \g__wa_arrow_int > 0
{\int_compare:nNnTF \l__wa_pos_arrows_int > 5
@@ -347,16 +396,128 @@
\seq_gpop_right:NN \g__wa_line_bis_int_seq \l_tmpa_tl
\int_gset:Nn \g__wa_line_bis_int {\l_tmpa_tl}
}
-\cs_set_protected:Nn \__wa_cr:
+\cs_new_protected:Nn \__wa_cr:
{\scan_stop:
\group_align_safe_begin:
\peek_meaning_remove:NTF * \__wa_cr_i: \__wa_cr_i:}
-\cs_set_protected:Nn \__wa_cr_i:
+\cs_new_protected:Nn \__wa_cr_i:
{\peek_meaning:NTF [ {\__wa_cr_ii:} {\__wa_cr_ii:[\c_zero_dim]} }
\cs_new_protected:Npn \__wa_cr_ii:[#1]
{\group_align_safe_end:
+ \bool_if:NF \l__wa_in_witharrows_bool
+ {\bool_if:NTF \l__wa_notag_bool
+ {&}
+ {
+ \tl_if_empty:NT \l__wa_tag_tl
+ {\int_gincr:N \c@equation}
+ \cs_gset:Npx \g_tmpa_tl
+ {\tl_if_empty:NTF \l__wa_tag_tl
+ \theequation
+ \l__wa_tag_tl}
+ \tl_if_empty:NF \l__wa_label_tl
+ {
+ \cs_set_eq:NN \@currentlabel \g_tmpa_tl
+ \cs_if_exist:NT \hyper@refstepcounter
+ {\cs_set:Npn \This@name {equation}
+ \hyper@refstepcounter{equation}}
+ \__wa_old_label {\l__wa_label_tl}}
+ \bool_gset_eq:NN \g_tmpa_bool \l__wa_tag_star_bool
+ & \cs_set_eq:NN \theequation \g_tmpa_tl
+ \bool_if:NT \g_tmpa_bool {\cs_set:Npn \tagform@ {}}
+ \hbox_overlap_left:n \@eqnnum
+ }}
\cr\noalign{\skip_vertical:n {#1 + \l__wa_interline_skip}
\scan_stop:}}
+\NewDocumentEnvironment {DispWithArrows} {O{}}
+ {
+ \cs_if_exist_use:N \intertext@
+ \if_mode_math:
+ \msg_error:nn {witharrows}
+ {{DispWithArrows}~used~in~math~mode}
+ \fi:
+ \bool_set_false:N \l__wa_in_witharrows_bool
+ \__wa_pre_environment:n {#1}
+ \begin{displaymath}
+ \vcenter \bgroup
+ \spread@equation
+ \bool_if:NTF \l__wa_fleqn_bool
+ {\tabskip = \c_zero_skip}
+ {\tabskip = 0 pt plus 1000 pt minus 1000 pt}
+ \cs_if_exist:NTF \ltx@label
+ {\cs_set_eq:NN \__wa_old_label \ltx@label}
+ {\cs_set_eq:NN \__wa_old_label \label}
+ \cs_set:Npn \notag {\msg_error:nnn {witharrows}
+ {Command~not~allowed~in~{DispWithArrows}}
+ {\notag}}
+ \cs_set:Npn \nonumber {\msg_error:nnn {witharrows}
+ {Command~not~allowed~in~{DispWithArrows}}
+ {\nonumber}}
+ \cs_set:Npn \tag ##1 {\msg_error:nnn {witharrows}
+ {Command~not~allowed~in~{DispWithArrows}}
+ {\tag}}
+ \cs_set:Npn \label ##1 {\msg_error:nnn {witharrows}
+ {Command~not~allowed~in~{DispWithArrows}}
+ {\label}}
+ \halign to \displaywidth \bgroup
+ \int_gincr:N \g__wa_line_int
+ \cs_set_eq:cN \l__wa_CommandName_tl \__wa_Arrow_first_column:
+ \strut
+ \bool_if:NT \l__wa_fleqn_bool
+ {\hspace{\l__wa_mathindent_dim}}
+ \hfil
+ $\bool_if:NT \l__wa_displaystyle_bool \displaystyle {##}$
+ \tabskip = \c_zero_skip
+ &
+ \cs_set:Npn \notag {\bool_set_true:N \l__wa_notag_bool}
+ \cs_set_eq:NN \nonumber \notag
+ \cs_set_eq:NN \tag \__wa_tag
+ \cs_set_eq:NN \label \__wa_label:n
+ $\bool_if:NT \l__wa_displaystyle_bool \displaystyle {{}##}$
+ \tabskip = 0 pt plus 1000 pt minus 1000 pt
+ \int_gincr:N \g__wa_line_bis_int
+ \tl_if_empty:NTF \l__wa_name_tl
+ {\tikz [remember~picture,overlay]
+ \node [__wa_node_style,
+ name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-l] {} ;}
+ {\tikz [remember~picture,overlay]
+ \node [__wa_node_style,
+ name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-l,
+ alias = \l__wa_name_tl-\int_use:N\g__wa_line_int-l] {} ;}
+ \hfil
+ \tl_if_empty:NTF \l__wa_name_tl
+ {\tikz [remember~picture,overlay]
+ \node [__wa_node_style,
+ name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-r] {} ;}
+ {\tikz [remember~picture,overlay]
+ \node [__wa_node_style,
+ name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-r,
+ alias = \l__wa_name_tl-\int_use:N\g__wa_line_int-r] {} ;}
+ \bool_if:NT \l__wa_shownodenames_bool
+ {\hbox_overlap_right:n {\small wa-\l__wa_prefix_str
+ -\int_use:N\g__wa_line_int}}
+ & ##
+ \tabskip = \c_zero_skip
+ && \msg_error:nn {witharrows} {Third~column~in~an~environment~{DispWithArrows}}
+ \iffalse ## \fi
+ \cr}
+ {\\
+ \egroup
+ \egroup
+ \end{displaymath}
+ \__wa_post_environment:
+ \ignorespacesafterend
+ }
+\NewDocumentCommand \__wa_tag {sm}
+ {\bool_set_false:N \l__wa_notag_bool
+ \tl_set:Nn \l__wa_tag_tl {#2}
+ \bool_set:Nn \l__wa_tag_star_bool {#1}
+ \bool_if:nT {#1 && ! \cs_if_exist_p:N \tagform@}
+ { \msg_error:nn {witharrows} {tag*~without~amsmath} }
+ }
+\NewDocumentEnvironment {DispWithArrows*} {}
+ {\WithArrowsOptions{notag}
+ \DispWithArrows}
+ {\endDispWithArrows}
\cs_new_protected:Nn \__wa_draw_arrows:
{ \group_begin:
\int_zero_new:N \l__wa_first_arrow_of_group_int
@@ -573,13 +734,17 @@
{\draw[<-] ($(\k-r.south)+(\l__wa_xoffset_dim,0)$) -- ++(5mm,0) ;} ;
\end{tikzpicture}}
\msg_new:nnn {witharrows}
- {Third~column~in~an~environment}
+ {Third~column~in~an~environment~{WithArrows}}
{By~default,~an~environment~\{WithArrows\}~can~only~have~two~columns.~
Maybe~you~have~forgotten~a~\str_use:N \c_backslash_str
\str_use:N \c_backslash_str.~If~you~really~want~more~than~two~columns,~
you~should~use~the~option~"MoreColumns"~at~a~global~level~or~for~
an~environment.~However,~you~can~go~one~for~this~time.}
\msg_new:nnn {witharrows}
+ {Third~column~in~an~environment~{DispWithArrows}}
+ {An~environment~\{DispWithArrows\}~or~\{DispWithArrows*\}~can~only~have~two~columns.~
+ If~you~go~on,~you~may~have~an~incorrect~output.}
+\msg_new:nnn {witharrows}
{The~option~"jump"~must~be~non~negative}
{You~can't~use~a~strictly~negative~value~for~the~option~"jump"~of~command~
\token_to_str:N\Arrow.~ You~can~create~an~arrow~going~backwards~with~
@@ -595,6 +760,10 @@
{The~environment~\{WithArrows\}~should~be~used~only~in~math~mode.~
Nevertheless,~you~can~go~on.}
\msg_new:nnn {witharrows}
+ {{DispWithArrows}~used~in~math~mode}
+ {The~environment~\{DispWithArrows\}~should~be~used~only~outside~math~mode.~
+ If~you~go~on,~you~will~have~other~errors.}
+\msg_new:nnn {witharrows}
{Two~options~are~incompatible}
{You~try~to~use~the~option~"\tl_use:N\l_keys_key_tl"~but~
this~option~is~incompatible~or~redundant~with~the~option~"
@@ -620,7 +789,7 @@
have~an~error~if~one~of~your~arrows~needs~an~PGF~node~absent~by~lack~of~ampersand.~
If~you~don't~want~to~see~this~message~again,~you~can~use~the~option~
AllowLineWithoutAmpersand.}
- {Morevoer, the~ampersand~can~be~implicit~
+ {Moreover, the~ampersand~can~be~implicit~
(e.g.~if~you~use~\token_to_str:N\MoveEqLeft\ of~mathtools).}
\msg_new:nnn {witharrows}
{Option~incompatible~with~"group(s)"}
@@ -670,6 +839,23 @@
{A~PGF~node~necessary~to~draw~an~arrow~doesn't~exist~
because~you~didn't~put~an~ampersand~in~the~corresponding~line.~
If~you~go~on,~the~arrow~will~be~ignored.}
+\msg_new:nnn {witharrows}
+ {tag*~without~amsmath}
+ {We~can't~use~\token_to_str:N\tag*~because~you~haven't~load~amsmath~
+ (or~mathtools).~If~you~go~on,~the~command~\token_to_str:N\tag\
+ will~be~used~instead.}
+\msg_new:nnn {witharrows}
+ {Command~not~allowed~in~{DispWithArrows}}
+ {The~command~\token_to_str:N #1
+ is~not~allowed~in~the~first~column~of~\{DispWithArrows\}~but~
+ only~in~the~second~column~(and,~of~course,~in~the~
+ environments~of~amsmath).~If~you~go~on,~this~command~will~be~ignored.}
+\msg_new:nnn {witharrows}
+ {Command~not~allowed~in~{WithArrows}}
+ {The~command~\token_to_str:N #1
+ is~not~allowed~in~\{WithArrows\}~but~is~allowed~in~the~second~
+ column~of~\{DispWithArrows\}~(and,~of~course,~in~the~
+ environments~of~amsmath).~If~you~go~on,~this~command~will~be~ignored.}
\endinput
%%
%% End of file `witharrows.sty'.