summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/spath3/tikzlibraryspath3.code.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/spath3/tikzlibraryspath3.code.tex')
-rw-r--r--Master/texmf-dist/tex/latex/spath3/tikzlibraryspath3.code.tex1039
1 files changed, 800 insertions, 239 deletions
diff --git a/Master/texmf-dist/tex/latex/spath3/tikzlibraryspath3.code.tex b/Master/texmf-dist/tex/latex/spath3/tikzlibraryspath3.code.tex
index 9c1c158e52a..bd81706e3b9 100644
--- a/Master/texmf-dist/tex/latex/spath3/tikzlibraryspath3.code.tex
+++ b/Master/texmf-dist/tex/latex/spath3/tikzlibraryspath3.code.tex
@@ -25,7 +25,10 @@
\seq_new:N \g__spath_tmpb_seq
\bool_new:N \l__spath_draft_bool
\msg_new:nnn { spath3 } { missing soft path } { Soft~ path~ #1~ doesn't~ exist }
-\msg_new:nnn { spath3 } { empty soft path } { Soft~ path~ #1~ is~ empty }
+\msg_new:nnnn { spath3 } { empty soft path } { Soft~ path~ #1~ is~ empty}
+{If~ it~ was~ defined~ inside~ a~ group,~ try~ using~ "save~ global". }
+\msg_new:nnn { spath3 } { load intersections }
+{ You~ need~ to~ load~ the~ "intersections"~ library~ to~ work~ with~ intersections }
\tl_set:Nn \l__spath_prefix_tl {tikz@intersect@path@name@}
\tl_set:Nn \l__spath_suffix_tl {}
\tl_new:N \g__spath_tikzfinish_tl
@@ -68,6 +71,59 @@
\tl_set_eq:NN #1 \g__spath_output_tl
\tl_gclear:N \g__spath_output_tl
}
+\cs_set_eq:NN \__spath_tikzset:n \tikzset
+\cs_generate_variant:Nn \__spath_tikzset:n {V, v}
+\bool_new:N \l__spath_reverse_bool
+\bool_new:N \l__spath_weld_bool
+\bool_new:N \l__spath_move_bool
+\bool_new:N \l__spath_global_bool
+\tl_new:N \l__spath_joinpath_tl
+\tl_new:N \l__spath_transformation_tl
+
+\cs_new_protected_nopar:Npn \__spath_set_bool:Nn #1#2
+{
+ \tl_if_eq:nnTF {#2}{false}
+ {
+ \bool_set_false:N #1
+ }
+ {
+ \bool_set_true:N #1
+ }
+}
+\tikzset {
+ spath/join/.is~ family,
+ spath/join/.cd,
+ reverse/.code = {
+ \__spath_set_bool:Nn \l__spath_reverse_bool {#1}
+ },
+ reverse/.default = true,
+ weld/.code = {
+ \__spath_set_bool:Nn \l__spath_weld_bool {#1}
+ },
+ weld/.default = true,
+ no~ weld/.code = {
+ \__spath_set_bool:Nn \l__spath_weld_bool {#1}
+ \bool_set:Nn \l__spath_weld_bool {! \l__spath_weld_bool}
+ },
+ no~ weld/.default = true,
+ move/.code = {
+ \__spath_set_bool:Nn \l__spath_move_bool {#1}
+ },
+ move/.default = true,
+ no~ move/.code = {
+ \__spath_set_bool:Nn \l__spath_move_bool {#1}
+ \bool_set:Nn \l__spath_move_bool {! \l__spath_move_bool}
+ },
+ no~ move/.default = true,
+ global/.code = {
+ \__spath_set_bool:Nn \l__spath_global_bool {#1}
+ },
+ global/.default = true,
+ transform/.store~in=\l__spath_transformation_tl,
+ .unknown/.code = {
+ \tl_set_eq:NN \l__spath_joinpath_tl \pgfkeyscurrentname
+ }
+}
\cs_set_eq:NN \getComponentOf \clist_item:Nn
\tikzset{
spath/.is~family,
@@ -95,6 +151,15 @@
\l__spath_tmpa_tl
}
},
+ save~ global/.code={
+ \tikz@addmode{
+ \spath_get_current_path:N \l__spath_tmpa_tl
+ \spath_bake_round:NV \l__spath_tmpa_tl \l__spath_tmpa_tl
+ \spath_gsave_path:cV
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ \l__spath_tmpa_tl
+ }
+ },
clone/.code~ 2~ args={
\tl_if_exist:cTF
{\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl}
@@ -123,15 +188,6 @@
\msg_warning:nnn { spath3 } { missing soft path } { #2 }
}
},
- save~ global/.code={
- \tikz@addmode{
- \spath_get_current_path:N \l__spath_tmpa_tl
- \spath_bake_round:NV \l__spath_tmpa_tl \l__spath_tmpa_tl
- \spath_gsave_path:cV
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- \l__spath_tmpa_tl
- }
- },
save~ to~ aux/.code={
\tl_if_exist:cTF
{\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
@@ -143,67 +199,134 @@
\msg_warning:nnn { spath3 } { missing soft path } { #1 }
}
},
- restore/.code={
+ export~ to~ svg/.code={
\tl_if_exist:cTF
{\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
{
- \tl_if_empty:cTF
+ \spath_export_to_svg:nv {#1}
{\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- {
- \tl_clear:N \l__spath_tmpa_tl
- \tl_put_right:NV \l__spath_tmpa_tl \c_spath_moveto_tl
- \tl_put_right:Nn \l__spath_tmpa_tl {{0pt}{0pt}}
- \spath_set_current_path:V \l__spath_tmpa_tl
- \spath_set_tikz_data:V \l__spath_tmpa_tl
- \msg_warning:nnn { spath3 } { empty soft path } { #1 }
- }
- {
- \spath_set_current_path:c
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- \spath_set_tikz_data:v
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- }
}
{
- \tl_clear:N \l__spath_tmpa_tl
- \tl_put_right:NV \l__spath_tmpa_tl \c_spath_moveto_tl
- \tl_put_right:Nn \l__spath_tmpa_tl {{0pt}{0pt}}
- \spath_set_current_path:V \l__spath_tmpa_tl
- \spath_set_tikz_data:V \l__spath_tmpa_tl
\msg_warning:nnn { spath3 } { missing soft path } { #1 }
}
},
- restore~ reverse/.code={
+ use/.code={
+ \bool_set_false:N \l__spath_reverse_bool
+ \bool_set_false:N \l__spath_weld_bool
+ \bool_set_false:N \l__spath_move_bool
+ \tl_clear:N \l__spath_joinpath_tl
+ \tl_clear:N \l__spath_transformation_tl
+ \tikzset{
+ spath/join/.cd,
+ #1
+ }
+
\tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
{
- \tl_if_empty:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ \tl_use:N \l__spath_prefix_tl
+ \tl_use:N \l__spath_joinpath_tl
+ \tl_use:N \l__spath_suffix_tl
+ }
+ {
+ \tl_if_empty:cT
+ {
+ \tl_use:N \l__spath_prefix_tl
+ \tl_use:N \l__spath_joinpath_tl
+ \tl_use:N \l__spath_suffix_tl
+ }
{
- \tl_clear:N \l__spath_tmpa_tl
- \tl_put_right:NV \l__spath_tmpa_tl \c_spath_moveto_tl
- \tl_put_right:Nn \l__spath_tmpa_tl {{0pt}{0pt}}
- \spath_set_current_path:V \l__spath_tmpa_tl
- \spath_set_tikz_data:V \l__spath_tmpa_tl
\msg_warning:nnn { spath3 } { empty soft path } { #1 }
}
+ \tl_set_eq:Nc \l__spath_joinpath_tl
{
- \spath_reverse:Nv
- \l__spath_reverse_tl
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- \spath_set_current_path:N \l__spath_reverse_tl
- \spath_set_tikz_data:V \l__spath_reverse_tl
+ \tl_use:N \l__spath_prefix_tl
+ \tl_use:N \l__spath_joinpath_tl
+ \tl_use:N \l__spath_suffix_tl
+ }
+ \spath_get_current_path:N \l__spath_current_tl
+
+ \bool_if:NT \l__spath_reverse_bool
+ {
+ \spath_reverse:N \l__spath_joinpath_tl
}
+
+ \tl_if_empty:NF \l__spath_transformation_tl
+ {
+ \group_begin:
+ \pgftransformreset
+ \__spath_tikzset:V \l__spath_transformation_tl
+ \pgfgettransform \l__spath_tmpa_tl
+ \tl_gset:Nn \g__spath_smuggle_tl
+ {
+ \spath_transform:Nnnnnnn
+ \l__spath_joinpath_tl
+ }
+ \tl_gput_right:NV \g__spath_smuggle_tl \l__spath_tmpa_tl
+ \group_end:
+ \tl_use:N \g__spath_smuggle_tl
+ }
+
+ \bool_if:NT \l__spath_move_bool
+ {
+ \tl_if_empty:NTF \l__spath_current_tl
+ {
+ \tl_set:Nn \l__spath_tmpc_tl { {0pt} {0pt} }
+ }
+ {
+ \spath_finalpoint:NV
+ \l__spath_tmpc_tl
+ \l__spath_current_tl
+ }
+ \spath_translate_to:NV \l__spath_joinpath_tl \l__spath_tmpc_tl
+ }
+
+ \tl_if_empty:NTF \l__spath_current_tl
+ {
+ \tl_if_empty:NTF \l__spath_joinpath_tl
+ {
+ \tl_set_eq:NN \l__spath_current_tl \c_spath_moveto_tl
+ \tl_put_right:Nn \l__spath_current_tl {{0pt}{0pt}}
+ }
+ {
+ \tl_set_eq:NN \l__spath_current_tl \l__spath_joinpath_tl
+ }
+ }
+ {
+
+ \tl_clear:N \l__spath_tmpa_tl
+ \tl_set:Nn \l__spath_tmpa_tl {spath_}
+
+ \tl_put_right:Nn \l__spath_tmpa_tl {append}
+
+ \bool_if:NT \l__spath_weld_bool
+ {
+ \tl_put_right:Nn \l__spath_tmpa_tl {_no_move}
+ }
+ \tl_put_right:Nn \l__spath_tmpa_tl {:NV}
+
+ \use:c {\tl_use:N \l__spath_tmpa_tl }
+ \l__spath_current_tl
+ \l__spath_joinpath_tl
+ }
+
+ \spath_set_current_path:N \l__spath_current_tl
+ \spath_set_tikz_data:V \l__spath_joinpath_tl
}
{
- \tl_clear:N \l__spath_tmpa_tl
- \tl_put_right:NV \l__spath_tmpa_tl \c_spath_moveto_tl
- \tl_put_right:Nn \l__spath_tmpa_tl {{0pt}{0pt}}
- \spath_set_current_path:V \l__spath_tmpa_tl
- \spath_set_tikz_data:V \l__spath_tmpa_tl
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ \msg_warning:nnx
+ { spath3 }
+ { missing soft path }
+ {\tl_use:N \l__spath_joinpath_tl }
}
},
+ restore/.style={/tikz/spath/use={#1}},
+ restore~ reverse/.style={/tikz/spath/use={reverse, #1}},
+ append/.style={/tikz/spath/use={move, weld, #1}},
+ append~ no~ move/.style={/tikz/spath/use={weld, #1}},
+ append~ reverse/.style={/tikz/spath/use={move, weld, reverse, #1}},
+ append~ reverse~ no~ move/.style={/tikz/spath/use={weld, reverse, #1}},
+ insert/.style={/tikz/spath/use={#1}},
+ insert~ reverse/.style={/tikz/spath/use={reverse, #1}},
show~current~path/.code={
\tikz@addmode{
\pgfsyssoftpath@getcurrentpath\l__spath_tmpa_tl
@@ -230,37 +353,94 @@
\msg_warning:nnn { spath3 } { missing soft path } { #1 }
}
},
- append/.code={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- {
- \spath_get_current_path:N \l__spath_current_tl
- \spath_finalpoint:NV \l__spath_tmpa_tl \l__spath_current_tl
- \tl_set_eq:Nc
- \l__spath_tmpb_tl
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- \spath_translate_to:NV \l__spath_tmpb_tl \l__spath_tmpa_tl
- \spath_append_no_move:NV \l__spath_current_tl \l__spath_tmpb_tl
- \spath_set_current_path:N \l__spath_current_tl
- \spath_set_tikz_data:V \l__spath_tmpb_tl
- }
- {
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
- },
join~ with/.code~ 2~ args={
\tl_if_exist:cTF
{\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
{
+ \bool_set_false:N \l__spath_reverse_bool
+ \bool_set_false:N \l__spath_weld_bool
+ \bool_set_false:N \l__spath_move_bool
+ \bool_set_false:N \l__spath_global_bool
+ \tl_clear:N \l__spath_joinpath_tl
+ \tl_clear:N \l__spath_transformation_tl
+ \tikzset{
+ spath/join/.cd,
+ #2
+ }
+
\tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl}
{
- \spath_append:cv
+ \tl_use:N \l__spath_prefix_tl
+ \tl_use:N \l__spath_joinpath_tl
+ \tl_use:N \l__spath_suffix_tl
+ }
+ {
+ \tl_set_eq:Nc \l__spath_joinpath_tl
+ {
+ \tl_use:N \l__spath_prefix_tl
+ \tl_use:N \l__spath_joinpath_tl
+ \tl_use:N \l__spath_suffix_tl
+ }
+
+ \bool_if:NT \l__spath_reverse_bool
+ {
+ \spath_reverse:N \l__spath_joinpath_tl
+ }
+
+ \tl_if_empty:NF \l__spath_transformation_tl
+ {
+ \group_begin:
+ \pgftransformreset
+ \__spath_tikzset:V \l__spath_transformation_tl
+ \pgfgettransform \l__spath_tmpa_tl
+ \tl_gset:Nn \g__spath_smuggle_tl
+ {
+ \spath_transform:Nnnnnnn
+ \l__spath_joinpath_tl
+ }
+ \tl_gput_right:NV \g__spath_smuggle_tl \l__spath_tmpa_tl
+ \group_end:
+ \tl_use:N \g__spath_smuggle_tl
+ }
+
+ \bool_if:NT \l__spath_move_bool
+ {
+ \spath_finalpoint:Nv
+ \l__spath_tmpc_tl
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ \spath_translate_to:NV \l__spath_joinpath_tl \l__spath_tmpc_tl
+ }
+
+ \tl_clear:N \l__spath_tmpa_tl
+ \tl_set:Nn \l__spath_tmpa_tl {spath_}
+
+ \bool_if:NT \l__spath_global_bool
+ {
+ \tl_put_right:Nn \l__spath_tmpa_tl {g}
+ }
+
+ \tl_put_right:Nn \l__spath_tmpa_tl {append}
+
+ \bool_if:NT \l__spath_weld_bool
+ {
+ \tl_put_right:Nn \l__spath_tmpa_tl {_no_move}
+ }
+ \tl_put_right:Nn \l__spath_tmpa_tl {:cV}
+
+ \cs_if_exist:cF {\tl_use:N \l__spath_tmpa_tl}
+ {
+ \tl_show:N \l__spath_tmpa_tl
+ }
+
+ \use:c {\tl_use:N \l__spath_tmpa_tl }
{\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl}
+ \l__spath_joinpath_tl
}
{
- \msg_warning:nnn { spath3 } { missing soft path } { #2 }
+ \msg_warning:nnx
+ { spath3 }
+ { missing soft path }
+ {\tl_use:N \l__spath_joinpath_tl }
}
}
{
@@ -311,88 +491,6 @@
\msg_warning:nnn { spath3 } { missing soft path } { #1 }
}
},
- append~ reverse/.code={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- {
- \spath_reverse:Nv
- \l__spath_reverse_tl
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- \spath_get_current_path:N \l__spath_current_tl
- \spath_finalpoint:NV \l__spath_tmpa_tl \l__spath_current_tl
- \spath_translate_to:NV \l__spath_reverse_tl \l__spath_tmpa_tl
- \spath_append_no_move:NV \l__spath_current_tl \l__spath_reverse_tl
- \spath_set_current_path:N \l__spath_current_tl
- \spath_set_tikz_data:V \l__spath_reverse_tl
- }
- {
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
- },
- insert/.code={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- {
- \spath_get_current_path:N \l__spath_current_tl
- \spath_append:Nv
- \l__spath_current_tl
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- \spath_set_current_path:N \l__spath_current_tl
- \spath_set_tikz_data:v
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- }
- {
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
- },
- insert~ reverse/.code={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- {
- \spath_reverse:Nv
- \l__spath_reverse_tl
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- \spath_get_current_path:N \l__spath_current_tl
- \spath_append:NV \l__spath_current_tl \l__spath_reverse_tl
- \spath_set_current_path:N \l__spath_current_tl
- \spath_set_tikz_data:V \l__spath_reverse_tl
- }
- {
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
- },
- append~ no~ move/.code={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- {
- \spath_get_current_path:N \l__spath_current_tl
- \spath_append_no_move:Nv
- \l__spath_current_tl
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- \spath_set_current_path:N \l__spath_current_tl
- \spath_set_tikz_data:v
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- }
- {
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
- },
- append~ reverse~ no~ move/.code={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- {
- \spath_reverse:Nv
- \l__spath_reverse_tl
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- \spath_get_current_path:N \l__spath_current_tl
- \spath_append_no_move:NV \l__spath_current_tl \l__spath_reverse_tl
- \spath_set_current_path:N \l__spath_current_tl
- \spath_set_tikz_data:V \l__spath_reverse_tl
- }
- {
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
- },
span/.code ~n~ args={3}{
\tl_if_exist:cTF
{\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
@@ -488,30 +586,89 @@
\tl_if_exist:cTF
{\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
{
+ \tl_if_head_is_group:nTF {#2}
+ {
+ \tl_set:Nx \l__spath_tmpc_tl { \tl_item:nn {#2} {1} }
+ \tl_set:Nx \l__spath_tmpd_tl { \tl_item:nn {#2} {2} }
+ }
+ {
+ \tl_set:Nn \l__spath_tmpc_tl {#2}
+ \tl_clear:N \l__spath_tmpd_tl
+ }
\tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl}
{
- \spath_spot_weld_components:c
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ \tl_use:N \l__spath_prefix_tl
+ \tl_use:N \l__spath_tmpc_tl
+ \tl_use:N \l__spath_suffix_tl
+ }
+ {
+ \tl_if_empty:NT \l__spath_tmpd_tl
+ {
+ \spath_spot_weld_components:c
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ }
\spath_components_to_seq:Nv
\l__spath_tmpa_seq
{\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ \seq_gclear:N \g__spath_tmpa_seq
+
+ \tl_if_empty:NTF \l__spath_tmpd_tl
+ {
+ \int_step_inline:nnnn {1}{1} {\seq_count:N \l__spath_tmpa_seq}
+ {
+ \seq_gput_right:Nn \g__spath_tmpa_seq {##1}
+ }
+ }
+ {
+ \foreach \l__spath_tmpa_tl in \l__spath_tmpd_tl
+ {
+ \seq_gput_right:NV \g__spath_tmpa_seq \l__spath_tmpa_tl
+ }
+ \seq_gsort:Nn \g__spath_tmpa_seq
+ {
+ \int_compare:nNnTF {##1} < {##2}
+ { \sort_return_same: }
+ { \sort_return_swapped: }
+ }
+ }
+
\seq_pop_left:NN \l__spath_tmpa_seq \l__spath_tmpa_tl
+ \seq_gpop_left:NN \g__spath_tmpa_seq \l__spath_tmpb_tl
- \seq_map_inline:Nn \l__spath_tmpa_seq
+ \seq_map_indexed_inline:Nn \l__spath_tmpa_seq
{
- \spath_splice_between:Nvn \l__spath_tmpa_tl
- {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl}
- {##1}
+ \int_compare:nTF
+ {
+ ##1 == \l__spath_tmpb_tl
+ }
+ {
+ \seq_gpop_left:NNF \g__spath_tmpa_seq \l__spath_tmpb_tl
+ {
+ \tl_set:Nn \l__spath_tmpb_tl {-1}
+ }
+ \spath_splice_between:Nvn \l__spath_tmpa_tl
+ {
+ \tl_use:N \l__spath_prefix_tl
+ \tl_use:N \l__spath_tmpc_tl
+ \tl_use:N \l__spath_suffix_tl
+ }
+ {##2}
+ }
+ {
+ \tl_put_right:Nn \l__spath_tmpa_tl {##2}
+ }
}
\tl_set_eq:cN
{\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
\l__spath_tmpa_tl
}
{
- \msg_warning:nnn { spath3 } { missing soft path } { #2 }
+ \msg_warning:nnx
+ { spath3 }
+ { missing soft path }
+ { \tl_use:N \l__spath_tmpc_tl }
}
}
{
@@ -522,30 +679,319 @@
\tl_if_exist:cTF
{\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
{
+ \tl_if_head_is_group:nTF {#2}
+ {
+ \tl_set:Nx \l__spath_tmpc_tl { \tl_item:nn {#2} {1} }
+ \tl_set:Nx \l__spath_tmpd_tl { \tl_item:nn {#2} {2} }
+ }
+ {
+ \tl_set:Nn \l__spath_tmpc_tl {#2}
+ \tl_clear:N \l__spath_tmpd_tl
+ }
\tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl}
{
- \spath_spot_gweld_components:c
+ \tl_use:N \l__spath_prefix_tl
+ \tl_use:N \l__spath_tmpc_tl
+ \tl_use:N \l__spath_suffix_tl
+ }
+ {
+ \tl_if_empty:NT \l__spath_tmpd_tl
+ {
+ \spath_spot_weld_components:c
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ }
+
+ \spath_components_to_seq:Nv
+ \l__spath_tmpa_seq
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+
+ \seq_gclear:N \g__spath_tmpa_seq
+
+ \tl_if_empty:NTF \l__spath_tmpd_tl
+ {
+ \int_step_inline:nnnn {1}{1} {\seq_count:N \l__spath_tmpa_seq}
+ {
+ \seq_gput_right:Nn \g__spath_tmpa_seq {##1}
+ }
+ }
+ {
+ \foreach \l__spath_tmpa_tl in \l__spath_tmpd_tl
+ {
+ \seq_gput_right:NV \g__spath_tmpa_seq \l__spath_tmpa_tl
+ }
+ \seq_gsort:Nn \g__spath_tmpa_seq
+ {
+ \int_compare:nNnTF {##1} < {##2}
+ { \sort_return_same: }
+ { \sort_return_swapped: }
+ }
+ }
+
+ \seq_pop_left:NN \l__spath_tmpa_seq \l__spath_tmpa_tl
+ \seq_gpop_left:NN \g__spath_tmpa_seq \l__spath_tmpb_tl
+
+ \seq_map_indexed_inline:Nn \l__spath_tmpa_seq
+ {
+ \int_compare:nTF
+ {
+ ##1 == \l__spath_tmpb_tl
+ }
+ {
+ \seq_gpop_left:NNF \g__spath_tmpa_seq \l__spath_tmpb_tl
+ {
+ \tl_set:Nn \l__spath_tmpb_tl {-1}
+ }
+ \spath_splice_between:Nvn \l__spath_tmpa_tl
+ {
+ \tl_use:N \l__spath_prefix_tl
+ \tl_use:N \l__spath_tmpc_tl
+ \tl_use:N \l__spath_suffix_tl
+ }
+ {##2}
+ }
+ {
+ \tl_put_right:Nn \l__spath_tmpa_tl {##2}
+ }
+ }
+ \tl_gset_eq:cN
{\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ \l__spath_tmpa_tl
+ }
+ {
+ \msg_warning:nnx
+ { spath3 }
+ { missing soft path }
+ { \tl_use:N \l__spath_tmpc_tl }
+ }
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
+ },
+ join~ components~ upright~ with/.code~2~args={
+ \tl_if_exist:cTF
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ {
+ \tl_if_head_is_group:nTF {#2}
+ {
+ \tl_set:Nx \l__spath_tmpc_tl { \tl_item:nn {#2} {1} }
+ \tl_set:Nx \l__spath_tmpd_tl { \tl_item:nn {#2} {2} }
+ }
+ {
+ \tl_set:Nn \l__spath_tmpc_tl {#2}
+ \tl_clear:N \l__spath_tmpd_tl
+ }
+ \tl_if_exist:cTF
+ {
+ \tl_use:N \l__spath_prefix_tl
+ \tl_use:N \l__spath_tmpc_tl
+ \tl_use:N \l__spath_suffix_tl
+ }
+ {
+ \tl_if_empty:NT \l__spath_tmpd_tl
+ {
+ \spath_spot_weld_components:c
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ }
\spath_components_to_seq:Nv
\l__spath_tmpa_seq
{\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ \seq_gclear:N \g__spath_tmpa_seq
+
+ \tl_if_empty:NTF \l__spath_tmpd_tl
+ {
+ \int_step_inline:nnnn {1}{1} {\seq_count:N \l__spath_tmpa_seq}
+ {
+ \seq_gput_right:Nn \g__spath_tmpa_seq {##1}
+ }
+ }
+ {
+ \foreach \l__spath_tmpa_tl in \l__spath_tmpd_tl
+ {
+ \seq_gput_right:NV \g__spath_tmpa_seq \l__spath_tmpa_tl
+ }
+ \seq_gsort:Nn \g__spath_tmpa_seq
+ {
+ \int_compare:nNnTF {##1} < {##2}
+ { \sort_return_same: }
+ { \sort_return_swapped: }
+ }
+ }
+
\seq_pop_left:NN \l__spath_tmpa_seq \l__spath_tmpa_tl
+ \seq_gpop_left:NN \g__spath_tmpa_seq \l__spath_tmpb_tl
- \seq_map_inline:Nn \l__spath_tmpa_seq
+ \tl_set_eq:Nc \l__spath_tmpc_tl
{
- \spath_gsplice_between:Nvn \l__spath_tmpa_tl
- {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl}
- {##1}
+ \tl_use:N \l__spath_prefix_tl
+ \tl_use:N \l__spath_tmpc_tl
+ \tl_use:N \l__spath_suffix_tl
+ }
+ \spath_transform:NVnnnnnn \l__spath_tmpd_tl \l__spath_tmpc_tl {1}{0}{0}{-1}{0pt}{0pt}
+
+ \seq_map_indexed_inline:Nn \l__spath_tmpa_seq
+ {
+ \int_compare:nTF
+ {
+ ##1 == \l__spath_tmpb_tl
+ }
+ {
+ \seq_gpop_left:NNF \g__spath_tmpa_seq \l__spath_tmpb_tl
+ {
+ \tl_set:Nn \l__spath_tmpb_tl {-1}
+ }
+ \spath_finalpoint:NV \l__spath_tmpe_tl \l__spath_tmpa_tl
+ \spath_initialpoint:Nn \l__spath_tmpf_tl {##2}
+
+ \dim_compare:nTF
+ {
+ \tl_item:Nn \l__spath_tmpe_tl {1}
+ >
+ \tl_item:Nn \l__spath_tmpf_tl {1}
+ }
+ {
+ \spath_splice_between:NVn
+ \l__spath_tmpa_tl
+ \l__spath_tmpd_tl
+ {##2}
+ }
+ {
+ \spath_splice_between:NVn
+ \l__spath_tmpa_tl
+ \l__spath_tmpc_tl
+ {##2}
+ }
+ }
+ {
+ \tl_put_right:Nn \l__spath_tmpa_tl {##2}
+ }
}
\tl_set_eq:cN
{\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
\l__spath_tmpa_tl
}
{
- \msg_warning:nnn { spath3 } { missing soft path } { #2 }
+ \msg_warning:nnx
+ { spath3 }
+ { missing soft path }
+ { \tl_use:N \l__spath_tmpc_tl }
+ }
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
+ },
+ join~ components~ globally~ upright~ with/.code~2~args={
+ \tl_if_exist:cTF
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ {
+ \tl_if_head_is_group:nTF {#2}
+ {
+ \tl_set:Nx \l__spath_tmpc_tl { \tl_item:nn {#2} {1} }
+ \tl_set:Nx \l__spath_tmpd_tl { \tl_item:nn {#2} {2} }
+ }
+ {
+ \tl_set:Nn \l__spath_tmpc_tl {#2}
+ \tl_clear:N \l__spath_tmpd_tl
+ }
+ \tl_if_exist:cTF
+ {
+ \tl_use:N \l__spath_prefix_tl
+ \tl_use:N \l__spath_tmpc_tl
+ \tl_use:N \l__spath_suffix_tl
+ }
+ {
+ \tl_if_empty:NT \l__spath_tmpd_tl
+ {
+ \spath_spot_weld_components:c
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ }
+
+ \spath_components_to_seq:Nv
+ \l__spath_tmpa_seq
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+
+ \seq_gclear:N \g__spath_tmpa_seq
+
+ \tl_if_empty:NTF \l__spath_tmpd_tl
+ {
+ \int_step_inline:nnnn {1}{1} {\seq_count:N \l__spath_tmpa_seq}
+ {
+ \seq_gput_right:Nn \g__spath_tmpa_seq {##1}
+ }
+ }
+ {
+ \foreach \l__spath_tmpa_tl in \l__spath_tmpd_tl
+ {
+ \seq_gput_right:NV \g__spath_tmpa_seq \l__spath_tmpa_tl
+ }
+ \seq_gsort:Nn \g__spath_tmpa_seq
+ {
+ \int_compare:nNnTF {##1} < {##2}
+ { \sort_return_same: }
+ { \sort_return_swapped: }
+ }
+ }
+
+ \seq_pop_left:NN \l__spath_tmpa_seq \l__spath_tmpa_tl
+ \seq_gpop_left:NN \g__spath_tmpa_seq \l__spath_tmpb_tl
+
+ \tl_set_eq:Nc \l__spath_tmpc_tl
+ {
+ \tl_use:N \l__spath_prefix_tl
+ \tl_use:N \l__spath_tmpc_tl
+ \tl_use:N \l__spath_suffix_tl
+ }
+ \spath_transform:NVnnnnnn \l__spath_tmpd_tl \l__spath_tmpc_tl {1}{0}{0}{-1}{0pt}{0pt}
+
+ \seq_map_indexed_inline:Nn \l__spath_tmpa_seq
+ {
+ \int_compare:nTF
+ {
+ ##1 == \l__spath_tmpb_tl
+ }
+ {
+ \seq_gpop_left:NNF \g__spath_tmpa_seq \l__spath_tmpb_tl
+ {
+ \tl_set:Nn \l__spath_tmpb_tl {-1}
+ }
+ \spath_finalpoint:NV \l__spath_tmpe_tl \l__spath_tmpa_tl
+ \spath_initialpoint:Nn \l__spath_tmpf_tl {##2}
+
+ \dim_compare:nTF
+ {
+ \tl_item:Nn \l__spath_tmpe_tl {1}
+ >
+ \tl_item:Nn \l__spath_tmpf_tl {1}
+ }
+ {
+ \spath_splice_between:NVn
+ \l__spath_tmpa_tl
+ \l__spath_tmpd_tl
+ {##2}
+ }
+ {
+ \spath_splice_between:NVn
+ \l__spath_tmpa_tl
+ \l__spath_tmpc_tl
+ {##2}
+ }
+ }
+ {
+ \tl_put_right:Nn \l__spath_tmpa_tl {##2}
+ }
+ }
+ \tl_gset_eq:cN
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ \l__spath_tmpa_tl
+ }
+ {
+ \msg_warning:nnx
+ { spath3 }
+ { missing soft path }
+ { \tl_use:N \l__spath_tmpc_tl }
}
}
{
@@ -726,17 +1172,6 @@
\msg_warning:nnn { spath3 } { missing soft path } { #1 }
}
},
- export~ to~ svg/.code={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- {
- \spath_export_to_svg:nv {#1}
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- }
- {
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
- },
transform/.code~ 2~ args={
\tl_if_exist:cTF
{\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
@@ -781,100 +1216,154 @@
},
split~ at~ intersections~ with/.code~ n~ args={2}{
\tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ {
+ tikz@library@intersections@loaded
+ }
{
\tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl}
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
{
- \spath_split_path_at_intersections:cv
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ \tl_if_exist:cTF
{\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl}
+ {
+ \spath_split_path_at_intersections:cv
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl}
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #2 }
+ }
}
{
- \msg_warning:nnn { spath3 } { missing soft path } { #2 }
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
}
}
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ \msg_warning:nn { spath3 } { load intersections }
}
},
split~ globally~ at~ intersections~ with/.code~ n~ args={2}{
\tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
{
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl}
+ tikz@library@intersections@loaded
+ }
+ {
+ \tl_if_exist:cTF
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
{
- \spath_gsplit_path_at_intersections:cv
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ \tl_if_exist:cTF
{\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl}
+ {
+ \spath_gsplit_path_at_intersections:cv
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl}
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #2 }
+ }
}
{
- \msg_warning:nnn { spath3 } { missing soft path } { #2 }
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
}
}
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ \msg_warning:nn { spath3 } { load intersections }
}
},
split~ at~ intersections/.code~ n~ args={2}{
\tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ {
+ tikz@library@intersections@loaded
+ }
{
\tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl}
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
{
- \spath_split_at_intersections:cc
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ \tl_if_exist:cTF
{\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl}
+ {
+ \spath_split_at_intersections:cc
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl}
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #2 }
+ }
}
{
- \msg_warning:nnn { spath3 } { missing soft path } { #2 }
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
}
}
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ \msg_warning:nn { spath3 } { load intersections }
}
},
split~ globally~ at~ intersections/.code~ n~ args={2}{
\tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ {
+ tikz@library@intersections@loaded
+ }
{
\tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl}
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
{
- \spath_gsplit_at_intersections:cc
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ \tl_if_exist:cTF
{\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl}
+ {
+ \spath_gsplit_at_intersections:cc
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl}
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #2 }
+ }
}
{
- \msg_warning:nnn { spath3 } { missing soft path } { #2 }
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
}
}
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ \msg_warning:nn { spath3 } { load intersections }
}
},
split~ at~ self~ intersections/.code={
\tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
{
- \spath_split_at_self_intersections:c
+ tikz@library@intersections@loaded
+ }
+ {
+ \tl_if_exist:cTF
{\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ {
+ \spath_split_at_self_intersections:c
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
}
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ \msg_warning:nn { spath3 } { load intersections }
}
},
split~ globally~ at~ self~ intersections/.code={
\tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
{
- \spath_gsplit_at_self_intersections:c
+ tikz@library@intersections@loaded
+ }
+ {
+ \tl_if_exist:cTF
{\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ {
+ \spath_gsplit_at_self_intersections:c
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
}
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ \msg_warning:nn { spath3 } { load intersections }
}
},
get~ components~ of/.code~ 2~ args={
@@ -966,40 +1455,64 @@
\msg_warning:nnn { spath3 } { missing soft path } { #1 }
}
},
- insert~ gaps~ after~ components/.code~ n~ args={3}{
+ insert~ gaps~ after~ components/.code~ 2~ args={
\tl_if_exist:cTF
{\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
{
\group_begin:
+ \tl_if_head_is_group:nTF {#2}
+ {
+ \tl_set:Nx \l__spath_tmpc_tl { \tl_item:nn {#2} {1} }
+ \tl_set:Nx \l__spath_tmpd_tl { \tl_item:nn {#2} {2} }
+ }
+ {
+ \tl_set:Nn \l__spath_tmpc_tl {#2}
+ \tl_clear:N \l__spath_tmpd_tl
+ }
\seq_gclear:N \g__spath_tmpa_seq
\seq_gclear:N \g__spath_tmpb_seq
\spath_numberofcomponents:Nv \l__spath_tmpa_int
{\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- \foreach \l__spath_tmpa_tl in {#3}
+
+ \spath_components_to_seq:Nv
+ \l__spath_tmpa_seq
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+
+ \tl_if_empty:NTF \l__spath_tmpd_tl
{
- \seq_gput_right:NV \g__spath_tmpa_seq \l__spath_tmpa_tl
- \seq_gput_right:Nx
- \g__spath_tmpb_seq
- {\int_eval:n
- {
- \int_mod:nn { \l__spath_tmpa_tl }{ \l__spath_tmpa_int } + 1
+ \int_step_inline:nnnn {1}{1} { \l__spath_tmpa_int - 1 }
+ {
+ \seq_gput_right:Nn \g__spath_tmpa_seq {##1}
+ \seq_gput_right:Nx
+ \g__spath_tmpb_seq
+ {\int_eval:n {##1 + 1}}
+ }
+ }
+ {
+ \foreach \l__spath_tmpa_tl in \l__spath_tmpd_tl
+ {
+ \seq_gput_right:NV \g__spath_tmpa_seq \l__spath_tmpa_tl
+ \seq_gput_right:Nx
+ \g__spath_tmpb_seq
+ {\int_eval:n
+ {
+ \int_mod:nn { \l__spath_tmpa_tl }{ \l__spath_tmpa_int } + 1
+ }
}
}
}
- \spath_components_to_seq:Nv
- \l__spath_tmpa_seq
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+
\seq_clear:N \l__spath_tmpb_seq
\seq_map_indexed_inline:Nn \l__spath_tmpa_seq
{
\tl_set:Nn \l__spath_tmpa_tl {##2}
\seq_if_in:NnT \g__spath_tmpa_seq {##1}
{
- \spath_shorten_at_end:Nn \l__spath_tmpa_tl {#2/2}
+ \spath_shorten_at_end:Nn \l__spath_tmpa_tl {\l__spath_tmpc_tl/2}
}
\seq_if_in:NnT \g__spath_tmpb_seq {##1}
{
- \spath_shorten_at_start:Nn \l__spath_tmpa_tl {#2/2}
+ \spath_shorten_at_start:Nn \l__spath_tmpa_tl {\l__spath_tmpc_tl/2}
}
\seq_put_right:NV \l__spath_tmpb_seq \l__spath_tmpa_tl
}
@@ -1014,41 +1527,64 @@
\msg_warning:nnn { spath3 } { missing soft path } { #1 }
}
},
- insert~ gaps~ globally~ after~ components/.code~ n~ args={3}{
+ insert~ gaps~ globally~ after~ components/.code~ 2~ args={
\tl_if_exist:cTF
{\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
{
\group_begin:
+ \tl_if_head_is_group:nTF {#2}
+ {
+ \tl_set:Nx \l__spath_tmpc_tl { \tl_item:nn {#2} {1} }
+ \tl_set:Nx \l__spath_tmpd_tl { \tl_item:nn {#2} {2} }
+ }
+ {
+ \tl_set:Nn \l__spath_tmpc_tl {#2}
+ \tl_clear:N \l__spath_tmpd_tl
+ }
\seq_gclear:N \g__spath_tmpa_seq
\seq_gclear:N \g__spath_tmpb_seq
\spath_numberofcomponents:Nv \l__spath_tmpa_int
{\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- \foreach \l__spath_tmpa_tl in {#3}
+
+ \spath_components_to_seq:Nv
+ \l__spath_tmpa_seq
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+
+ \tl_if_empty:NTF \l__spath_tmpd_tl
{
- \seq_gput_right:NV \g__spath_tmpa_seq \l__spath_tmpa_tl
- \seq_gput_right:Nx
- \g__spath_tmpb_seq
+ \int_step_inline:nnnn {1}{1} { \l__spath_tmpa_int - 1 }
{
- \int_eval:n
- {
- \int_mod:nn { \l__spath_tmpa_tl }{ \l__spath_tmpa_int } + 1
+ \seq_gput_right:Nn \g__spath_tmpa_seq {##1}
+ \seq_gput_right:Nx
+ \g__spath_tmpb_seq
+ {\int_eval:n {##1 + 1}}
+ }
+ }
+ {
+ \foreach \l__spath_tmpa_tl in \l__spath_tmpd_tl
+ {
+ \seq_gput_right:NV \g__spath_tmpa_seq \l__spath_tmpa_tl
+ \seq_gput_right:Nx
+ \g__spath_tmpb_seq
+ {\int_eval:n
+ {
+ \int_mod:nn { \l__spath_tmpa_tl }{ \l__spath_tmpa_int } + 1
+ }
}
}
}
- \spath_components_to_seq:Nv
- \l__spath_tmpa_seq
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+
\seq_clear:N \l__spath_tmpb_seq
\seq_map_indexed_inline:Nn \l__spath_tmpa_seq
{
\tl_set:Nn \l__spath_tmpa_tl {##2}
\seq_if_in:NnT \g__spath_tmpa_seq {##1}
{
- \spath_shorten_at_end:Nn \l__spath_tmpa_tl {#2/2}
+ \spath_shorten_at_end:Nn \l__spath_tmpa_tl {\l__spath_tmpc_tl/2}
}
\seq_if_in:NnT \g__spath_tmpb_seq {##1}
{
- \spath_shorten_at_start:Nn \l__spath_tmpa_tl {#2/2}
+ \spath_shorten_at_start:Nn \l__spath_tmpa_tl {\l__spath_tmpc_tl/2}
}
\seq_put_right:NV \l__spath_tmpb_seq \l__spath_tmpa_tl
}
@@ -1135,6 +1671,28 @@
\msg_warning:nnn { spath3 } { missing soft path } { #1 }
}
},
+ replace~ lines/.code={
+ \tl_if_exist:cTF
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ {
+ \spath_replace_lines:c
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
+ },
+ replace~ lines~ globally/.code={
+ \tl_if_exist:cTF
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ {
+ \spath_greplace_lines:c
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
+ },
remove~ components/.code~ 2~ args={
\tl_if_exist:cTF
{\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
@@ -1403,7 +1961,10 @@
}
}
{
- \msg_warning:nnx { spath3 } { missing soft path } { \tl_use:N \l__spath_tmpa_tl }
+ \msg_warning:nnx
+ { spath3 }
+ { missing soft path }
+ { \tl_use:N \l__spath_tmpa_tl }
\tl_gset_eq:NN \g__spath_smuggle_tl \pgfpointorigin
}
\group_end: