summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/spath3/tikzlibraryspath3.code.tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-02-06 22:29:38 +0000
committerKarl Berry <karl@freefriends.org>2021-02-06 22:29:38 +0000
commita6cd75438fbcaade92377c09f1656838f98d34bd (patch)
treef7cad776e85704cc9b2df0d48f7a0e17f7d74a66 /Master/texmf-dist/tex/latex/spath3/tikzlibraryspath3.code.tex
parent1a26369eaf03943c7c533a207e4dea7922cd3336 (diff)
spath3 (6feb21)
git-svn-id: svn://tug.org/texlive/trunk@57639 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/spath3/tikzlibraryspath3.code.tex')
-rw-r--r--Master/texmf-dist/tex/latex/spath3/tikzlibraryspath3.code.tex960
1 files changed, 906 insertions, 54 deletions
diff --git a/Master/texmf-dist/tex/latex/spath3/tikzlibraryspath3.code.tex b/Master/texmf-dist/tex/latex/spath3/tikzlibraryspath3.code.tex
index 32d0d9fea08..9c1c158e52a 100644
--- a/Master/texmf-dist/tex/latex/spath3/tikzlibraryspath3.code.tex
+++ b/Master/texmf-dist/tex/latex/spath3/tikzlibraryspath3.code.tex
@@ -24,6 +24,8 @@
\seq_new:N \g__spath_tmpa_seq
\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 }
\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
@@ -53,6 +55,20 @@
}
}
\cs_generate_variant:Nn \spath_gsave_path:Nn {cn, NV, cV}
+\cs_new_protected_nopar:Npn \__spath_process_tikz_point:Nn #1#2
+{
+ \group_begin:
+ \use:c {tikz@scan@one@point} \use:n #2 \scan_stop:
+ \tl_gset:Nx \g__spath_output_tl
+ {
+ { \dim_use:c {pgf@x} }
+ { \dim_use:c {pgf@y} }
+ }
+ \group_end:
+ \tl_set_eq:NN #1 \g__spath_output_tl
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_set_eq:NN \getComponentOf \clist_item:Nn
\tikzset{
spath/.is~family,
spath/.cd,
@@ -74,11 +90,14 @@
\tikz@addmode{
\spath_get_current_path:N \l__spath_tmpa_tl
\spath_bake_round:NV \l__spath_tmpa_tl \l__spath_tmpa_tl
- \spath_save_path:cV {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} \l__spath_tmpa_tl
+ \spath_save_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:cT {\tl_use:N \l__spath_prefix_tl #2 \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}
{
\tl_clear_new:c
{\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
@@ -86,9 +105,13 @@
{\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 }
+ }
},
clone~ global/.code~ 2~ args={
- \tl_if_exist:cT {\tl_use:N \l__spath_prefix_tl #2 \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}
{
\tl_gclear_new:c
{\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
@@ -96,6 +119,9 @@
{\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 }
+ }
},
save~ global/.code={
\tikz@addmode{
@@ -107,19 +133,75 @@
}
},
save~ to~ aux/.code={
- \tl_if_exist:cT {\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 #1 \tl_use:N \l__spath_suffix_tl}
{
\spath_save_to_aux:c
{\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
}
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
},
restore/.code={
- \tl_if_exist:cT {\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 #1 \tl_use:N \l__spath_suffix_tl}
{
- \spath_set_current_path:c
+ \tl_if_empty:cTF
{\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- \spath_set_tikz_coords:v
+ {
+ \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={
+ \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_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_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_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 }
}
},
show~current~path/.code={
@@ -130,73 +212,142 @@
}
},
show/.code={
- \tl_if_exist:cT {\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 #1 \tl_use:N \l__spath_suffix_tl}
{
- \iow_term:n {---~ soft~ path~ #1~ ---}
- \spath_show:v {\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}
+ {
+ \msg_warning:nnn { spath3 } { empty soft path } { #1 }
+ }
+ {
+ \iow_term:n {---~ soft~ path~ #1~ ---}
+ \spath_show: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/.code={
- \tl_if_exist:cT {\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 #1 \tl_use:N \l__spath_suffix_tl}
{
\spath_get_current_path:N \l__spath_current_tl
- \spath_weld:Nv
- \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_coords:V \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:cT {\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 #1 \tl_use:N \l__spath_suffix_tl}
{
- \tl_if_exist:cT {\tl_use:N \l__spath_prefix_tl #2 \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_append: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 } { #1 }
}
},
spot~ weld/.code={
- \tl_if_exist:cT {\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 #1 \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}
}
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
+ },
+ spot~ weld~ globally/.code={
+ \tl_if_exist:cTF
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ {
+ \spath_spot_gweld_components:c
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
},
reverse/.code={
- \tl_if_exist:cT {\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 #1 \tl_use:N \l__spath_suffix_tl}
{
\spath_reverse:c
{\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
}
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
+ },
+ reverse~ globally/.code={
+ \tl_if_exist:cTF
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ {
+ \spath_reverse:c
+ {\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/.code={
- \tl_if_exist:cT {\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 #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_weld:NV \l__spath_current_tl \l__spath_reverse_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_coords:V \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:cT {\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 #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_coords:V \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:cT {\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 #1 \tl_use:N \l__spath_suffix_tl}
{
\spath_reverse:Nv
\l__spath_reverse_tl
@@ -204,48 +355,391 @@
\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_coords:V \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}
+ {
+ \__spath_process_tikz_point:Nn \l__spath_tmpa_tl {#2}
+ \__spath_process_tikz_point:Nn \l__spath_tmpb_tl {#3}
+ \spath_span:cVV
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ \l__spath_tmpa_tl \l__spath_tmpb_tl
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
+ },
+ span~ global/.code ~n~ args={3}{
+ \tl_if_exist:cTF
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ {
+ \__spath_process_tikz_point:Nn \l__spath_tmpa_tl {#2}
+ \__spath_process_tikz_point:Nn \l__spath_tmpb_tl {#3}
+ \spath_gspan:cVV
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ \l__spath_tmpa_tl \l__spath_tmpb_tl
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
+ },
+ to/.style={
+ to~path={
+ [
+ spath/span={#1}{(\tikztostart)}{(\tikztotarget)},
+ spath/append~no~move={#1},
+ ]
+ \tikztonodes
+ }
+ },
+ splice/.code ~n~ args={3}{
+ \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}
+ {
+ \tl_if_exist:cTF
+ {\tl_use:N \l__spath_prefix_tl #3 \tl_use:N \l__spath_suffix_tl}
+ {
+ \spath_splice_between:cvv
+ {\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}
+ {\tl_use:N \l__spath_prefix_tl #3 \tl_use:N \l__spath_suffix_tl}
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #3 }
+ }
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #2 }
+ }
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
+ },
+ splice~ global/.code ~n~ args={3}{
+ \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}
+ {
+ \tl_if_exist:cTF
+ {\tl_use:N \l__spath_prefix_tl #3 \tl_use:N \l__spath_suffix_tl}
+ {
+ \spath_gsplice_between:cvv
+ {\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}
+ {\tl_use:N \l__spath_prefix_tl #3 \tl_use:N \l__spath_suffix_tl}
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #3 }
+ }
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #2 }
+ }
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
+ },
+ join~ components~ 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_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}
+
+ \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_pop_left:NN \l__spath_tmpa_seq \l__spath_tmpa_tl
+
+ \seq_map_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}
+ }
+ \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:nnn { spath3 } { missing soft path } { #1 }
+ }
+ },
+ join~ components~ globally~ 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_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 #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_pop_left:NN \l__spath_tmpa_seq \l__spath_tmpa_tl
+
+ \seq_map_inline:Nn \l__spath_tmpa_seq
+ {
+ \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_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:nnn { spath3 } { missing soft path } { #1 }
+ }
+ },
+ close/.code={
+ \tl_if_exist:cTF
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ {
+ \spath_close:c
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
+ },
+ close~ globally/.code={
+ \tl_if_exist:cTF
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ {
+ \spath_gclose:c
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
+ },
+ close~ 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_exist:cTF
+ {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl}
+ {
+ \spath_close_with: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 } { #1 }
+ }
+ },
+ close~ globally~ 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_exist:cTF
+ {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl}
+ {
+ \spath_gclose_with: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 } { #1 }
}
},
shorten~ at~ end/.code~ 2~ args={
- \tl_if_exist:cT {\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 #1 \tl_use:N \l__spath_suffix_tl}
{
\spath_shorten_at_end:cn
{\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} {#2}
}
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
},
shorten~ at~ start/.code~ 2~ args ={
- \tl_if_exist:cT {\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 #1 \tl_use:N \l__spath_suffix_tl}
{
\spath_shorten_at_start:cn
{\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} {#2}
}
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
},
shorten~ at~ both~ ends/.code~ 2~ args={
- \tl_if_exist:cT {\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 #1 \tl_use:N \l__spath_suffix_tl}
{
\spath_shorten_at_end:cn
{\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} {#2}
\spath_shorten_at_start:cn
{\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} {#2}
}
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
+ },
+ shorten~ globally~ at~ end/.code~ 2~ args={
+ \tl_if_exist:cTF
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ {
+ \spath_gshorten_at_end:cn
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} {#2}
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
+ },
+ shorten~ globally~ at~ start/.code~ 2~ args ={
+ \tl_if_exist:cTF
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ {
+ \spath_gshorten_at_start:cn
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} {#2}
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
+ },
+ shorten~ globally~ at~ both~ ends/.code~ 2~ args={
+ \tl_if_exist:cTF
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ {
+ \spath_shorten_at_end:cn
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} {#2}
+ \spath_shorten_at_start:cn
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} {#2}
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
},
translate/.code~ n~ args={3}{
- \tl_if_exist:cT {\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 #1 \tl_use:N \l__spath_suffix_tl}
{
\spath_translate:cnn
{\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}{#2}{#3}
}
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
+ },
+ translate~ globally/.code~ n~ args={3}{
+ \tl_if_exist:cTF
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ {
+ \spath_gtranslate:cnn
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}{#2}{#3}
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
+ },
+ normalise/.code={
+ \tl_if_exist:cTF
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ {
+ \spath_normalise:c
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
+ },
+ normalise~ globally/.code={
+ \tl_if_exist:cTF
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ {
+ \spath_gnormalise:c
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
},
export~ to~ svg/.code={
- \tl_if_exist:cT {\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 #1 \tl_use:N \l__spath_suffix_tl}
{
- \spath_export_to_svg:c
+ \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:cT {\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 #1 \tl_use:N \l__spath_suffix_tl}
{
\group_begin:
\pgftransformreset
@@ -260,9 +754,13 @@
\group_end:
\tl_use:N \g__spath_smuggle_tl
}
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
},
- transform~global/.code~ 2~ args={
- \tl_if_exist:cT {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ transform~globally/.code~ 2~ args={
+ \tl_if_exist:cTF
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
{
\group_begin:
\pgftransformreset
@@ -277,27 +775,111 @@
\group_end:
\tl_use:N \g__spath_smuggle_tl
}
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
+ },
+ 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}
+ {
+ \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 } { #1 }
+ }
+ },
+ 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}
+ {
+ \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 } { #1 }
+ }
},
split~ at~ intersections/.code~ n~ args={2}{
- \tl_if_exist:cT {\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 #1 \tl_use:N \l__spath_suffix_tl}
{
- \tl_if_exist:cT {\tl_use:N \l__spath_prefix_tl #2 \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 } { #1 }
+ }
+ },
+ 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}
+ {
+ \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 } { #1 }
}
},
split~ at~ self~ intersections/.code={
- \tl_if_exist:cT {\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 #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 }
+ }
+ },
+ 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
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
},
get~ components~ of/.code~ 2~ args={
- \tl_if_exist:cT {\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 #1 \tl_use:N \l__spath_suffix_tl}
{
\clist_clear_new:N #2
\spath_components_to_seq:Nv
@@ -306,16 +888,58 @@
\seq_map_inline:Nn \l__spath_tmpa_seq
{
\tl_new:c
- {\tl_use:N \l__spath_prefix_tl anonymous_\int_use:N \g__spath_anon_int \tl_use:N \l__spath_suffix_tl}
+ {
+ \tl_use:N \l__spath_prefix_tl
+ anonymous_\int_use:N \g__spath_anon_int
+ \tl_use:N \l__spath_suffix_tl
+ }
\tl_set:cn
- {\tl_use:N \l__spath_prefix_tl anonymous_\int_use:N \g__spath_anon_int \tl_use:N \l__spath_suffix_tl} {##1}
+ {
+ \tl_use:N \l__spath_prefix_tl
+ anonymous_\int_use:N \g__spath_anon_int
+ \tl_use:N \l__spath_suffix_tl
+ } {##1}
\clist_put_right:Nx #2 {anonymous_\int_use:N \g__spath_anon_int}
\int_gincr:N \g__spath_anon_int
}
}
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
+ },
+ get~ components~ of~ globally/.code~ 2~ args={
+ \tl_if_exist:cTF
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ {
+ \clist_gclear_new:N #2
+ \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_map_inline:Nn \l__spath_tmpa_seq
+ {
+ \tl_new:c
+ {
+ \tl_use:N \l__spath_prefix_tl
+ anonymous_\int_use:N \g__spath_anon_int
+ \tl_use:N \l__spath_suffix_tl
+ }
+ \tl_gset:cn
+ {
+ \tl_use:N \l__spath_prefix_tl
+ anonymous_\int_use:N \g__spath_anon_int
+ \tl_use:N \l__spath_suffix_tl
+ } {##1}
+ \clist_gput_right:Nx #2 {anonymous_\int_use:N \g__spath_anon_int}
+ \int_gincr:N \g__spath_anon_int
+ }
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
},
render~ components/.code={
- \tl_if_exist:cT {\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 #1 \tl_use:N \l__spath_suffix_tl}
{
\group_begin:
\spath_components_to_seq:Nv
@@ -338,17 +962,29 @@
}
\group_end:
}
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
},
insert~ gaps~ after~ components/.code~ n~ args={3}{
- \tl_if_exist:cT {\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 #1 \tl_use:N \l__spath_suffix_tl}
{
\group_begin:
\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}
{
\seq_gput_right:NV \g__spath_tmpa_seq \l__spath_tmpa_tl
- \seq_gput_right:Nx \g__spath_tmpb_seq {\int_eval:n { \l__spath_tmpa_tl + 1 }}
+ \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
@@ -374,9 +1010,62 @@
\g__spath_output_tl
\tl_gclear:N \g__spath_output_tl
}
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
+ },
+ insert~ gaps~ globally~ after~ components/.code~ n~ args={3}{
+ \tl_if_exist:cTF
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ {
+ \group_begin:
+ \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}
+ {
+ \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}
+ }
+ \seq_if_in:NnT \g__spath_tmpb_seq {##1}
+ {
+ \spath_shorten_at_start:Nn \l__spath_tmpa_tl {#2/2}
+ }
+ \seq_put_right:NV \l__spath_tmpb_seq \l__spath_tmpa_tl
+ }
+ \tl_gset:Nx \g__spath_output_tl {\seq_use:Nn \l__spath_tmpb_seq {} }
+ \group_end:
+ \tl_gset_eq:cN
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ \g__spath_output_tl
+ \tl_gclear:N \g__spath_output_tl
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
},
join~ components/.code~ 2~ args={
- \tl_if_exist:cT {\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 #1 \tl_use:N \l__spath_suffix_tl}
{
\seq_gclear:N \g__spath_tmpa_seq
\foreach \l__spath_tmpa_tl in {#2}
@@ -395,13 +1084,144 @@
{\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}{##1}
}
}
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
+ },
+ join~ components~ globally/.code~ 2~ args={
+ \tl_if_exist:cTF
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ {
+ \seq_gclear:N \g__spath_tmpa_seq
+ \foreach \l__spath_tmpa_tl in {#2}
+ {
+ \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_map_inline:Nn \g__spath_tmpa_seq
+ {
+ \spath_gjoin_component:cn
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}{##1}
+ }
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
},
remove~ empty~ components/.code={
- \tl_if_exist:cT {\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 #1 \tl_use:N \l__spath_suffix_tl}
{
\spath_remove_empty_components: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~ empty~ components~ globally/.code={
+ \tl_if_exist:cTF
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ {
+ \spath_gremove_empty_components: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}
+ {
+ \seq_gclear:N \g__spath_tmpa_seq
+ \foreach \l__spath_tmpa_tl in {#2}
+ {
+ \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: }
+ }
+ \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_gpop_left:NNF \g__spath_tmpa_seq \l__spath_tmpa_tl
+ {
+ \tl_clear:N \l__spath_tmpa_tl
+ }
+ \seq_clear:N \l__spath_tmpb_seq
+ \seq_map_indexed_inline:Nn \l__spath_tmpa_seq
+ {
+ \tl_set:Nn \l__spath_tmpb_tl {##1}
+ \tl_if_eq:NNTF \l__spath_tmpb_tl \l__spath_tmpa_tl
+ {
+ \seq_gpop_left:NNF \g__spath_tmpa_seq \l__spath_tmpa_tl
+ {
+ \tl_clear:N \l__spath_tmpa_tl
+ }
+ }
+ {
+ \seq_put_right:Nn \l__spath_tmpb_seq {##2}
+ }
+ }
+ \tl_set:cx {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ {\seq_use:Nn \l__spath_tmpb_seq {} }
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
+ },
+ remove~ components~ globally/.code~ 2~ args={
+ \tl_if_exist:cTF
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ {
+ \seq_gclear:N \g__spath_tmpa_seq
+ \foreach \l__spath_tmpa_tl in {#2}
+ {
+ \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: }
+ }
+ \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_gpop_left:NNF \g__spath_tmpa_seq \l__spath_tmpa_tl
+ {
+ \tl_clear:N \l__spath_tmpa_tl
+ }
+ \seq_clear:N \l__spath_tmpb_seq
+ \seq_map_indexed_inline:Nn \l__spath_tmpa_seq
+ {
+ \tl_set:Nn \l__spath_tmpb_tl {##1}
+ \tl_if_eq:NNTF \l__spath_tmpb_tl \l__spath_tmpa_tl
+ {
+ \seq_gpop_left:NNF \g__spath_tmpa_seq \l__spath_tmpa_tl
+ {
+ \tl_clear:N \l__spath_tmpa_tl
+ }
+ }
+ {
+ \seq_put_right:Nn \l__spath_tmpb_seq {##2}
+ }
+ }
+ \tl_gset:cx {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ {\seq_use:Nn \l__spath_tmpb_seq {} }
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
},
draft~ mode/.is~ choice,
draft~ mode/true/.code={
@@ -413,11 +1233,29 @@
maybe~ spot~ weld/.code={
\bool_if:NF \l__spath_draft_bool
{
- \tl_if_exist:cT {\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 #1 \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}
}
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
+ }
+ },
+ maybe~ spot~ weld~ globally/.code={
+ \bool_if:NF \l__spath_draft_bool
+ {
+ \tl_if_exist:cTF
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ {
+ \spath_spot_gweld_components:c
+ {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ }
+ {
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ }
}
},
transform~ to/.code~ 2~ args={
@@ -449,6 +1287,7 @@
\tl_gset_eq:NN \g__spath_smuggle_tl \l__spath_tmpc_tl
}
{
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
\tl_gset_eq:NN \g__spath_smuggle_tl { {1}{0}{0}{1}{0pt}{0pt} }
}
\group_end:
@@ -484,6 +1323,7 @@
\tl_gset_eq:NN \g__spath_smuggle_tl \l__spath_tmpc_tl
}
{
+ \msg_warning:nnn { spath3 } { missing soft path } { #1 }
\tl_gset_eq:NN \g__spath_smuggle_tl { {1}{0}{0}{1}{0pt}{0pt} }
}
\fp_compare:nT { \tl_item:Nn \g__spath_smuggle_tl {4} < 0}
@@ -503,11 +1343,18 @@
\tl_gclear:N \g__spath_smuggle_tl
},
knot/.style~ n~ args={3}{
- spath/.cd,
- split~ at~ self~ intersections=#1,
- insert~ gaps~ after~ components={#1}{#2}{#3},
- maybe~ spot~ weld=#1,
- render~ components=#1
+ spath/split~ at~ self~ intersections=#1,
+ spath/remove~ empty~ components=#1,
+ spath/insert~ gaps~ after~ components={#1}{#2}{#3},
+ spath/maybe~ spot~ weld=#1,
+ spath/render~ components=#1
+ },
+ global~ knot/.style~ n~ args={3}{
+ spath/split~ globally~ at~ self~ intersections=#1,
+ spath/remove~ empty~ components~ globally=#1,
+ spath/insert~ gaps~ globally ~after~ components={#1}{#2}{#3},
+ spath/maybe~ spot~ weld~ globally=#1,
+ spath/render~ components=#1
},
}
\tikzdeclarecoordinatesystem{spath}{%
@@ -556,15 +1403,20 @@
}
}
{
+ \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:
+ \group_end:
+ \use:c {pgf@process}{%
\tl_use:N \g__spath_smuggle_tl
+ \pgftransforminvert
+ \use:c {pgf@pos@transform@glob}
+ }
}
\ExplSyntaxOff
%%
-%% Copyright (C) 2011-2019 by Andrew Stacey <loopspace@mathforge.org>
+%% Copyright (C) 2011-2021 by Andrew Stacey <loopspace@mathforge.org>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
@@ -576,7 +1428,7 @@
%% This work is "maintained" (as per LPPL maintenance status) by
%% Andrew Stacey.
%%
-%% This work consists of the files spath3.dtx
+%% This work consists of the files spath3_code.dtx
%% calligraphy_doc.tex
%% knots_doc.tex
%% spath3.tex