summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-06-22 20:51:58 +0000
committerKarl Berry <karl@freefriends.org>2020-06-22 20:51:58 +0000
commit17704765562fe7fb37c673221b8798a23fce1e30 (patch)
tree13e76558d43be395341c18d35670ea446ea3c31f /Master/texmf-dist/tex/generic
parent72f942a238cb172eea71c1d955e21fac7fd8575d (diff)
witharrows (22jun20)
git-svn-id: svn://tug.org/texlive/trunk@55625 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic')
-rw-r--r--Master/texmf-dist/tex/generic/witharrows/witharrows.sty248
1 files changed, 187 insertions, 61 deletions
diff --git a/Master/texmf-dist/tex/generic/witharrows/witharrows.sty b/Master/texmf-dist/tex/generic/witharrows/witharrows.sty
index 2798b9ff33f..1a7286bca41 100644
--- a/Master/texmf-dist/tex/generic/witharrows/witharrows.sty
+++ b/Master/texmf-dist/tex/generic/witharrows/witharrows.sty
@@ -18,10 +18,9 @@
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%%
-\def\myfileversion{2.4}
-\def\myfiledate{2020/03/31}
+\def\myfileversion{2.5}
+\def\myfiledate{2020/06/22}
\RequirePackage{tikz}
-\RequirePackage{expl3}[2020/02/08]
\usetikzlibrary{arrows.meta,bending}
\RequirePackage{l3keys2e}
\ProvidesExplPackage
@@ -38,6 +37,7 @@
\cs_if_exist:NF \l_keys_key_str
{ \msg_error:nn { witharrows } { expl3~too~old } }
\RequirePackage { xparse } [ 2019-01-01 ]
+\RequirePackage { varwidth }
\bool_new:N \g__witharrows_footnotehyper_bool
\bool_new:N \g__witharrows_footnote_bool
\cs_new_protected:Npn \__witharrows_msg_new:nn { \msg_new:nnn { witharrows } }
@@ -118,7 +118,7 @@
\clist_map_inline:nn
{
amsmath, amsthm, autonum, cleveref, hyperref, mathtools, showlabels,
- typedref, unicode-math, varwidth
+ typedref, unicode-math
}
{
\bool_new:c { c__witharrows_#1_loaded_bool }
@@ -290,6 +290,9 @@
\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 }
\cs_new_protected:Npn \__witharrows_eval_if_allowed:n #1
{
\str_if_empty:NTF \l__witharrows_previous_key_str
@@ -548,6 +551,8 @@
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 }
@@ -559,7 +564,7 @@
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,
- ygap, ystart,
+ xoffset-for-o-arrows, ygap, ystart,
allow-multiple-labels, nonumber, notag, standard-behaviour-with-items,
tagged-lines
}
@@ -595,11 +600,22 @@
rl .default:n = NoValue ,
lr .default:n = NoValue ,
i .default:n = NoValue ,
- new-group .value_forbidden:n = true,
+ 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: ,
@@ -624,8 +640,8 @@
\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, rl, rr, start-adjust, tikz, tikz-code,
- xoffset
+ 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
{
@@ -646,6 +662,7 @@
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
{
@@ -681,6 +698,7 @@
\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
@@ -1003,12 +1021,12 @@
\__witharrows_restore:N \l__witharrows_qedhere_bool
\bool_if:NT \l__witharrows_qedhere_bool
{ \hbox_overlap_left:n \__witharrows_qedhere_i: }
- \pgfpicture
- \pgfrememberpicturepositiononpagetrue
- \pgfcoordinate
- { wa - \l__witharrows_prefix_str - \int_use:N \g__witharrows_line_int - v }
- \pgfpointorigin
- \endpgfpicture
+ \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
@@ -1025,7 +1043,7 @@
}
\cs_new_protected:Npn \__witharrows_analyze_end:Nn #1 #2
{
- \exp_args:NV \str_if_eq:nnT \l__witharrows_type_env_str { #2 }
+ \str_if_eq:VnT \l__witharrows_type_env_str { #2 }
{
\__witharrows_error:n { newline~at~the~end~of~env }
\group_begin:
@@ -1179,7 +1197,9 @@
{ 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 }
+ \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 }
}
@@ -1323,15 +1343,18 @@
\int_compare:nNnF \l__witharrows_pos_arrow_int = 8
{ \__witharrows_error:n { Too~few~lines~for~an~arrow } }
}
- \__witharrows_code_for_possible_arrow:
+ \__witharrows_treat_an_arrow_in_scan:
\int_incr:N \l__witharrows_arrow_int
}
- \bool_lazy_and:nnT
- { \bool_not_p:n { \int_compare_p:nNn \l__witharrows_pos_arrow_int = 7 } }
- { \int_compare_p:nNn \l__witharrows_first_arrow_of_group_int > 0 }
+ \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_code_for_possible_arrow:
+\cs_new_protected:Npn \__witharrows_treat_an_arrow_in_scan:
{
\bool_lazy_and:nnT
{ \int_compare_p:nNn \l__witharrows_arrow_int > 1 }
@@ -1370,8 +1393,7 @@
{ \dim_set:Nn \l__witharrows_x_dim { - \c_max_dim } }
}
{
- \bool_if:nF
- { \str_if_eq_p:Vn \l__witharrows_status_arrow_str { independent } }
+ \str_if_eq:VnF \l__witharrows_status_arrow_str { independent }
{
\int_compare:nT
{ \l__witharrows_initial_int = \l__witharrows_first_line_of_group_int }
@@ -1388,7 +1410,7 @@
}
}
}
- \bool_if:nF { \str_if_eq_p:Vn \l__witharrows_status_arrow_str { independent } }
+ \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 }
@@ -1415,12 +1437,21 @@
{ 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
- \int_compare:nT { \l__witharrows_final_int <= \g__witharrows_line_int } \__witharrows_draw_arrows_i:
+ \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_arrows_i:
+\cs_new_protected:Npn \__witharrows_draw_arrow:
{
\group_begin:
\prop_get:cnN
@@ -1538,18 +1569,28 @@
\cs_set:Npn \__witharrows_tmpa:nnn ##1 ##2 ##3
{
\begin{tikzpicture}
- [
- __witharrows_standard ,
- every~path / .style = WithArrows / arrow
- ]
+ [
+ __witharrows_standard ,
+ every~path / .style = WithArrows / arrow
+ ]
+ \pgf@relevantforpicturesizetrue
#1
+ \dim_compare:nNnTF \pgf@picminx = { 16000 pt }
+ { \dim_set_eq:NN \l_tmpa_dim \c_zero_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
+ \pgfresetboundingbox
\end{tikzpicture}
}
}
\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 }
+ { \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 }
}
@@ -1570,8 +1611,12 @@
\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 } ;
+ node [ anchor = west ]
+ {
+ \begin { varwidth } { \l_tmpa_dim }
+ #3
+ \end { varwidth }
+ } ;
}
}
\cs_new_protected:Npn \__witharrows_update_x:nn #1 #2
@@ -1587,6 +1632,89 @@
\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 } }
+ }
+ }
\NewExpandableDocumentCommand \WithArrowsLastEnv { }
{ \int_use:N \g__witharrows_last_env_int }
\keys_define:nn { WithArrows / Arrow / code-after }
@@ -1809,6 +1937,12 @@
must~not~be~empty.\\
\c__witharrows_option_ignored_str
}
+\__witharrows_msg_new:nn { invalid~key~o }
+ {
+ The~key~'o'~for~individual~arrows~can~be~used~only~in~mode~
+ 'group'~or~in~mode~'groups'.\\
+ \c__witharrows_option_ignored_str
+ }
\__witharrows_msg_new:nn { Value~for~a~key }
{
The~key~'\l_keys_key_str'~should~be~used~without~value. \\
@@ -1907,11 +2041,17 @@
{ Too~few~lines~for~an~arrow }
{
Line~\l__witharrows_input_line_str\
- :~an~arrow~specified~in~the~row~\int_use:N \l__witharrows_initial_int\
+ :~an~arrow~specifiead~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_msg_new:nn { o~arrow~with~no~arrow~under }
+ {
+ 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:nn { WithArrows~outside~math~mode }
{
The~environment~\{\l__witharrows_type_env_str\}~should~be~used~only~in~math~mode~
@@ -1921,7 +2061,7 @@
\__witharrows_msg_new:nn { DispWithArrows~in~math~mode }
{
The~environment~\{\l__witharrows_type_env_str\}~should~be~used~only~outside~math~
- mode~like~the~environment~\{align\}~of~amsmath. \\
+ mode~like~the~environments~\{align\}~and~\{align*\}~of~amsmath. \\
This~error~is~fatal.
}
\__witharrows_msg_new:nn { Incompatible~options~in~Arrow }
@@ -2212,45 +2352,31 @@
\str_if_empty:NT \l__witharrows_previous_key_str
{
\str_set:Nn \l__witharrows_previous_key_str { up }
- \bool_if:NTF \c__witharrows_varwidth_loaded_bool
+ \cs_if_exist:cTF { tikz@library@calc@loaded }
{
- \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 } }
+ \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 { varwidth~not~loaded } }
+ { \__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 }
- \bool_if:NTF \c__witharrows_varwidth_loaded_bool
+ \cs_if_exist:cTF { tikz@library@calc@loaded }
{
- \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 } }
+ \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 { varwidth~not~loaded } }
+ { \__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 { varwidth~not~loaded }
- {
- You~can't~use~the~option~'\l_keys_key_str'~because~
- you~don't~have~loaded~the~package~'varwidth'. \\
- \c__witharrows_option_ignored_str
- }
\__witharrows_msg_new:nn { calc~not~loaded }
{
You~can't~use~the~option~'\l_keys_key_str'~because~you~don't~have~loaded~the~