diff options
author | Karl Berry <karl@freefriends.org> | 2016-02-20 23:38:34 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-02-20 23:38:34 +0000 |
commit | a96566db41be14d9f7d6ac1b237c9625b8b405ea (patch) | |
tree | 8f1a0317f4620e24bdd9030a11b6c59ac2132a08 /Master/texmf-dist/tex/latex/spath3 | |
parent | e9f61ed7121f3980dee02d7bc39309bbb7fd3c4a (diff) |
spath3 (20feb16)
git-svn-id: svn://tug.org/texlive/trunk@39794 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/spath3')
3 files changed, 273 insertions, 52 deletions
diff --git a/Master/texmf-dist/tex/latex/spath3/spath3.sty b/Master/texmf-dist/tex/latex/spath3/spath3.sty index a1f4b190fe8..876f5ca5841 100644 --- a/Master/texmf-dist/tex/latex/spath3/spath3.sty +++ b/Master/texmf-dist/tex/latex/spath3/spath3.sty @@ -15,7 +15,7 @@ \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} \RequirePackage{pgf} -\ProvidesExplPackage {spath3} {2013/04/09} {1.0} {Functions for +\ProvidesExplPackage {spath3} {2016/02/19} {1.1} {Functions for manipulating PGF soft paths} \RequirePackage{xparse} \tl_new:N \l__spath_tmpa_tl @@ -25,17 +25,21 @@ manipulating PGF soft paths} \tl_new:N \l__spath_smuggle_tl \dim_new:N \l__spath_tmpa_dim \dim_new:N \l__spath_tmpb_dim +\fp_new:N \l__spath_tmpa_fp +\fp_new:N \l__spath_tmpb_fp \int_new:N \l__spath_tmpa_int \tl_new:N \g__spath_moveto_tl \tl_new:N \g__spath_lineto_tl \tl_new:N \g__spath_curveto_tl \tl_new:N \g__spath_curvetoa_tl \tl_new:N \g__spath_curvetob_tl +\tl_new:N \g__spath_closepath_tl \tl_set:Nn \g__spath_moveto_tl {\pgfsyssoftpath@movetotoken} \tl_set:Nn \g__spath_lineto_tl {\pgfsyssoftpath@linetotoken} \tl_set:Nn \g__spath_curveto_tl {\pgfsyssoftpath@curvetotoken} \tl_set:Nn \g__spath_curvetoa_tl {\pgfsyssoftpath@curvetosupportatoken} \tl_set:Nn \g__spath_curvetob_tl {\pgfsyssoftpath@curvetosupportbtoken} +\tl_set:Nn \g__spath_closepath_tl {\pgfsyssoftpath@closepathtoken} \tl_new:N \g__spath_attributes \tl_new:N \g__spath_moveable_attributes \tl_new:N \g__spath_path_attributes @@ -88,7 +92,7 @@ manipulating PGF soft paths} } \cs_new_nopar:Npn \__spath_get:nn #1#2 { - \prop_get:cn {l__spath_#1} {#2} + \prop_item:cn {l__spath_#1} {#2} } \cs_new_nopar:Npn \__spath_get:nnN #1#2#3 { @@ -104,11 +108,15 @@ manipulating PGF soft paths} \prg_new_protected_conditional:Npnn \__spath_get:nnN #1#2#3 {T, F, TF} { \__prop_split:cnTF {l__spath_#1} {#2} - { \__prop_get_true:Nnnn #3 } + { + \tl_set:Nn #3 {##2} + \prg_return_true: + } { \prg_return_false: } } \cs_generate_variant:Nn \spath_put:nnn {nnV, nnx, nno} \cs_generate_variant:Nn \__spath_get:nn {Vn} +\cs_generate_variant:Nn \__spath_get:nnN {VnN} \prg_new_conditional:Npnn \spath_if_exist:n #1 {p,T,F,TF} { \prop_if_exist:cTF {l__spath_#1} @@ -133,9 +141,9 @@ manipulating PGF soft paths} } \cs_new_protected_nopar:Npn \spath_get_current_path:n #1 { - \pgfsyssoftpath@getcurrentpath\l__knot_tmpa_tl + \pgfsyssoftpath@getcurrentpath\l__spath_tmpa_tl \spath_clear_new:n {#1} - \spath_put:nnV {#1} {path} \l__knot_tmpa_tl + \spath_put:nnV {#1} {path} \l__spath_tmpa_tl } \cs_new_protected_nopar:Npn \spath_set_current_path:n #1 { @@ -186,7 +194,7 @@ manipulating PGF soft paths} } \__spath_get:nnN {#1} {#2} #3 } -\cs_generate_variant:Nn \spath_get:nnN {nnV} +\cs_generate_variant:Nn \spath_get:nnN {nnV,VnN,VnV} \cs_new_nopar:Npn \spath_generate_length:n #1 { \__spath_get:nnN {#1} {path} \l__spath_tmpa_tl @@ -250,6 +258,7 @@ manipulating PGF soft paths} } \spath_put:nnV {#1} {final point} \l__spath_tmpb_tl } +\cs_generate_variant:Nn \spath_generate_finalpoint:n {V} \cs_new_nopar:Npn \spath_generate_reversepath:n #1 { \__spath_get:nnN {#1} {path} \l__spath_tmpa_tl @@ -270,7 +279,7 @@ manipulating PGF soft paths} { \tl_set:Nx \l__spath_tmpc_tl {\tl_head:N \l__spath_tmpa_tl} \tl_set:Nn \l__spath_tmpd_tl {} - \tl_case:Nnn \l__spath_tmpc_tl + \tl_case:NnF \l__spath_tmpc_tl { \g__spath_moveto_tl {\tl_set_eq:NN \l__spath_tmpd_tl \g__spath_moveto_tl } \g__spath_lineto_tl {\tl_set_eq:NN \l__spath_tmpd_tl \g__spath_lineto_tl } @@ -448,7 +457,7 @@ manipulating PGF soft paths} \tl_set_eq:NN \l__spath_fa_tl \l__spath_tmpc_tl \int_incr:N \l__spath_l_int - \tl_case:Nnn \l__spath_tmpc_tl + \tl_case:NnF \l__spath_tmpc_tl { \g__spath_moveto_tl { \tl_set_eq:NN \l__spath_tmpd_tl \g__spath_moveto_tl @@ -592,14 +601,14 @@ manipulating PGF soft paths} { \__spath_get:nnN {#1} {##1} \l__spath_tmpa_tl - \dim_set:Nn \l__spath_tmpa_dim {\tl_head:N \l__spath_tmpa_tl * #2} + \fp_set:Nn \l__spath_tmpa_fp {\tl_head:N \l__spath_tmpa_tl * #2} \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl} - \dim_set:Nn \l__spath_tmpb_dim {\tl_head:N \l__spath_tmpa_tl * #3} + \fp_set:Nn \l__spath_tmpb_fp {\tl_head:N \l__spath_tmpa_tl * #3} \tl_clear:N \l__spath_tmpb_tl \tl_put_right:Nx \l__spath_tmpb_tl { - {\dim_use:N \l__spath_tmpa_dim} - {\dim_use:N \l__spath_tmpb_dim} + {\fp_to_dim:N \l__spath_tmpa_fp} + {\fp_to_dim:N \l__spath_tmpb_fp} } \spath_put:nnV {#1} {##1} \l__spath_tmpb_tl } @@ -617,26 +626,91 @@ manipulating PGF soft paths} \tl_put_right:Nx \l__spath_tmpb_tl {\tl_head:N \l__spath_tmpa_tl} \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl} - \dim_set:Nn \l__spath_tmpa_dim {\tl_head:N \l__spath_tmpa_tl * #2} + \fp_set:Nn \l__spath_tmpa_fp {\tl_head:N \l__spath_tmpa_tl * #2} \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl} - \dim_set:Nn \l__spath_tmpb_dim {\tl_head:N \l__spath_tmpa_tl * #3} + \fp_set:Nn \l__spath_tmpb_fp {\tl_head:N \l__spath_tmpa_tl * #3} \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl} \tl_put_right:Nx \l__spath_tmpb_tl { - {\dim_use:N \l__spath_tmpa_dim} - {\dim_use:N \l__spath_tmpb_dim} + {\fp_to_dim:N \l__spath_tmpa_fp} + {\fp_to_dim:N \l__spath_tmpb_fp} } } \spath_put:nnV {#1} {##1} \l__spath_tmpb_tl } } } +\cs_generate_variant:Nn \spath_scale:nnn {nxx} +\cs_new_nopar:Npn \spath_scale:nn #1#2 +{ + \spath_scale:nnn {#1} #2 +} + +\cs_generate_variant:Nn \spath_scale:nn {nV} +\cs_new_nopar:Npn \spath_transform:nnnnnnn #1#2#3#4#5#6#7 +{ + \tl_map_inline:Nn \g__spath_moveable_attributes + { + \spath_if_in:nnT {#1} {##1} + { + \__spath_get:nnN {#1} {##1} \l__spath_tmpa_tl + \tl_set:Nx \l__spath_tmpb_tl {\tl_tail:N \l__spath_tmpa_tl} + \tl_set:Nx \l__spath_tmpb_tl {\tl_head:N \l__spath_tmpb_tl} + \tl_set:Nx \l__spath_tmpa_tl {\tl_head:N \l__spath_tmpa_tl} + \fp_set:Nn \l__spath_tmpa_fp {\l__spath_tmpa_tl * #2 + \l__spath_tmpb_tl * #3 + #6} + \fp_set:Nn \l__spath_tmpb_fp {\l__spath_tmpa_tl * #4 + \l__spath_tmpb_tl * #5 + #7} + \tl_clear:N \l__spath_tmpb_tl + \tl_put_right:Nx \l__spath_tmpb_tl + { + {\fp_to_dim:N \l__spath_tmpa_fp} + {\fp_to_dim:N \l__spath_tmpb_fp} + } + \spath_put:nnV {#1} {##1} \l__spath_tmpb_tl + } + } + \tl_map_inline:Nn \g__spath_path_attributes + { + \spath_if_in:nnT {#1} {##1} + { + \__spath_get:nnN {#1} {##1} \l__spath_tmpa_tl + \tl_clear:N \l__spath_tmpb_tl + \bool_until_do:nn { + \tl_if_empty_p:N \l__spath_tmpa_tl + } + { + \tl_put_right:Nx \l__spath_tmpb_tl {\tl_head:N \l__spath_tmpa_tl} + \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl} + \tl_set:Nx \l_tmpa_tl {\tl_head:N \l__spath_tmpa_tl} + \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl} + \tl_set:Nx \l_tmpb_tl {\tl_head:N \l__spath_tmpa_tl} + \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl} + + \fp_set:Nn \l__spath_tmpa_fp {\l_tmpa_tl * #2 + \l_tmpb_tl * #3 + #6} + \fp_set:Nn \l__spath_tmpb_fp {\l_tmpa_tl * #4 + \l_tmpb_tl * #5 + #7} + \tl_put_right:Nx \l__spath_tmpb_tl + { + {\fp_to_dim:N \l__spath_tmpa_fp} + {\fp_to_dim:N \l__spath_tmpb_fp} + } + } + \spath_put:nnV {#1} {##1} \l__spath_tmpb_tl + } + } +} + +\cs_generate_variant:Nn \spath_transform:nnnnnnn {nxxxxxx} +\cs_new_nopar:Npn \spath_transform:nn #1#2 +{ + \spath_transform:nnnnnnn {#1} #2 +} + +\cs_generate_variant:Nn \spath_transform:nn {nV} \cs_new_nopar:Npn \spath_reverse:n #1 { \spath_if_in:nnF {#1} {reverse path} { - \cs_use:c {spath_generate_reverse path} + \use:c {spath_generate_reverse path:n} {#1} } \spath_swap:nnn {#1} {path} {reverse path} \spath_swap:nnn {#1} {initial point} {final point} @@ -647,10 +721,10 @@ manipulating PGF soft paths} \__spath_get:nnNF {#1} {#2} \l__spath_tmpa_tl {\tl_clear:N \l__spath_tmpa_tl} \__spath_get:nnNF {#1} {#3} \l__spath_tmpb_tl {\tl_clear:N \l__spath_tmpb_tl} \tl_if_empty:NTF \l__spath_tmpb_tl - {\spath_remove:nnV {#1} {#2}} + {\spath_remove:nn {#1} {#2}} {\spath_put:nnV {#1} {#2} \l__spath_tmpb_tl} \tl_if_empty:NTF \l__spath_tmpa_tl - {\spath_remove:nnV {#1} {#3}} + {\spath_remove:nn {#1} {#3}} {\spath_put:nnV {#1} {#3} \l__spath_tmpa_tl} } \cs_new_nopar:Npn \spath_weld:nn #1#2 @@ -1060,6 +1134,28 @@ manipulating PGF soft paths} } } } +\cs_new_nopar:Npn \spath_bake_round:n #1 +{ + \__spath_get:nnN {#1} {path} \l__spath_tmpa_tl + \pgf@@processround\l__spath_tmpa_tl\l__spath_tmpb_tl + \spath_put:nnV {#1} {path} \l__spath_tmpb_tl +} +\cs_new_nopar:Npn \spath_close_path:n #1 +{ + \spath_get:nnN {#1} {initial point} \l__spath_tmpb_tl + \__spath_get:nnN {#1} {path} \l__spath_tmpa_tl + \tl_put_right:NV \l__spath_tmpa_tl \g__spath_closepath_tl + \tl_put_right:NV \l__spath_tmpa_tl \l__spath_tmpb_tl + \spath_put:nnV {#1} {path} \l__spath_tmpa_tl + \spath_if_in:nnT {#1} {reverse path} + { + \spath_get:nnN {#1} {final point} \l__spath_tmpb_tl + \__spath_get:nnN {#1} {reverse path} \l__spath_tmpa_tl + \tl_put_right:NV \l__spath_tmpa_tl \g__spath_closepath_tl + \tl_put_right:NV \l__spath_tmpa_tl \l__spath_tmpb_tl + \spath_put:nnV {#1} {reverse path} \l__spath_tmpa_tl + } +} \cs_new_nopar:Npn \spath_map_component:Nn #1#2 { \int_gincr:N \g__prg_map_int @@ -1119,7 +1215,7 @@ manipulating PGF soft paths} { \tl_set:Nx \l__spath_tmpc_tl {\tl_head:N \l__spath_tmpa_tl} \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl} - \tl_case:Nnn \l__spath_tmpc_tl + \tl_case:NnF \l__spath_tmpc_tl { \g__spath_lineto_tl { @@ -1229,7 +1325,7 @@ manipulating PGF soft paths} \tl_set:Nn \l_tmpa_tl #3 \spath_get:nnV {#1} {#2} \l_tmpa_tl } -\NewDocumentCommand \SPathShow { m m } +\NewDocumentCommand \SPathShow { m } { \spath_show:n {#1} } @@ -1244,12 +1340,12 @@ manipulating PGF soft paths} } \NewDocumentCommand \SPathScale { m m m } { - \spath_translate:nnn {#1} {#2} {#3} + \spath_scale:nnn {#1} {#2} {#3} } \NewDocumentCommand \SPathScaleInto { m m m m } { \spath_clone:nn {#1} {#2} - \spath_translate:nnn {#2} {#3} {#4} + \spath_scale:nnn {#2} {#3} {#4} } \NewDocumentCommand \SPathWeld { m m } { @@ -1268,7 +1364,7 @@ manipulating PGF soft paths} }, restore~spath/.code={ \spath_set_current_path:n {#1} - }, + } } \cs_new_nopar:Npn \spath_split_curve:nnNN #1#2#3#4 { diff --git a/Master/texmf-dist/tex/latex/spath3/tikzlibrarycalligraphy.code.tex b/Master/texmf-dist/tex/latex/spath3/tikzlibrarycalligraphy.code.tex index 9e4c80c6672..f9530ffc9cb 100644 --- a/Master/texmf-dist/tex/latex/spath3/tikzlibrarycalligraphy.code.tex +++ b/Master/texmf-dist/tex/latex/spath3/tikzlibrarycalligraphy.code.tex @@ -20,6 +20,7 @@ \int_new:N \l__cal_tmpa_int \int_new:N \l__cal_tmpb_int \int_new:N \l__cal_path_component_int +\int_new:N \l__cal_label_int \dim_new:N \l__cal_tmpa_dim \dim_new:N \l__cal_tmpb_dim \dim_new:N \l__cal_tmpc_dim @@ -28,6 +29,7 @@ \dim_new:N \l__cal_tmpf_dim \dim_new:N \l__cal_tmpg_dim \dim_new:N \l__cal_tmph_dim +\bool_new:N \l__cal_annotate_bool \bool_new:N \l__cal_taper_start_bool \bool_new:N \l__cal_taper_end_bool \bool_new:N \l__cal_taperable_bool @@ -36,6 +38,8 @@ \bool_set_true:N \l__cal_taper_start_bool \bool_set_true:N \l__cal_taper_end_bool + +\cs_generate_variant:Nn \tl_put_right:Nn {Nv} \tikzset{ define~pen/.code={ \tikzset{pen~name=#1} @@ -131,20 +135,65 @@ \tl_clear_new:c {l__cal_stroke_inline_style_ \int_use:N \l__cal_path_component_int} \tl_set:cn {l__cal_stroke_inline_style_ \int_use:N \l__cal_path_component_int} {#1} }, + annotate/.style={ + annotate~if, + annotate~reset, + annotation~style/.update~value={#1}, + }, + annotate~if/.default={true}, + annotate~if/.code={ + \tl_if_eq:nnTF {#1} {true} + { + \bool_set_true:N \l__cal_annotate_bool + } + { + \bool_set_false:N \l__cal_annotate_bool + } + }, + annotate~reset/.code={ + \int_gzero:N \l__cal_label_int + }, + annotation~style/.initial={draw,->}, + annotation~shift/.initial={(0,1ex)}, + every~annotation~node/.initial={anchor=south~west}, + annotation~node~style/.code~2~args={ + \tl_set:cn {l__cal_annotation_style_ #1 _tl}{#2} + }, + tl~use:N/.code={ + \exp_args:NV \pgfkeysalso #1 + }, + tl~use:c/.code={ + \tl_if_exist:cT {#1} + { + \exp_args:Nv \pgfkeysalso {#1} + } + }, + /handlers/.update~style/.code={ + \tl_if_eq:nnF {#1} {\pgfkeysnovalue} + { + \pgfkeys{\pgfkeyscurrentpath/.code=\pgfkeysalso{#1}} + } + }, + /handlers/.update~value/.code={ + \tl_if_eq:nnF {#1} {\pgfkeysnovalue} + { + \pgfkeyssetvalue{\pgfkeyscurrentpath}{#1} + } + } } \NewDocumentCommand \pen { O{} } { - \path[define~ pen,#1] + \path[define~ pen,every~ calligraphy~ pen/.try,#1] } \NewDocumentCommand \definepen { O{} } { - \tikz \path[define~ pen,#1] + \tikz \path[define~ pen,every~ calligraphy~ pen/.try,#1] } \NewDocumentCommand \calligraphy { O{} } { - \path[use~ pen,#1] + \path[use~ pen,every~ calligraphy/.try,#1] } \NewDocumentCommand \CalligraphyPathCreate { m m } { @@ -157,28 +206,30 @@ { \int_incr:N \l__cal_tmpb_int \group_begin: + \pgfsys@beginscope + \cal_apply_style:c {l__cal_stroke_style_ \int_use:N \l__cal_tmpa_int} \cal_apply_style:c {l__cal_stroke_inline_style_ \int_use:N \l__cal_tmpa_int} \cal_apply_style:c {l__cal_nib_style_ \int_use:N \l__cal_tmpb_int} \spath_clone:nn {##1} {calligraphy temp path} - \__spath_get:nnN {####1} {initial point} \l__spath_tmpa_tl - \spath_translate:nV {calligraphy temp path} \l__spath_tmpa_tl + \__spath_get:nnN {####1} {initial point} \l__cal_tmpa_tl + \spath_translate:nV {calligraphy temp path} \l__cal_tmpa_tl - \__spath_get:nnN {####1} {length} \l__spath_tmpa_tl + \__spath_get:nnN {####1} {length} \l__cal_tmpa_tl - \int_compare:nTF {\l__spath_tmpa_tl = 1} + \int_compare:nTF {\l__cal_tmpa_tl = 1} { \cal_at_least_three:n {calligraphy temp path} \spath_protocol_path:n {calligraphy temp path} - \__spath_get:nnN {calligraphy temp path} {path} \l__spath_tmpa_tl + \__spath_get:nnN {calligraphy temp path} {path} \l__cal_tmpa_tl \tikz@options \dim_set:Nn \l__cal_line_width_dim {\pgflinewidth} - \cal_maybe_taper:N \l__spath_tmpa_tl + \cal_maybe_taper:N \l__cal_tmpa_tl } { @@ -190,14 +241,48 @@ \spath_reverse:n {##1} \spath_reverse:n {####1} - \spath_set_current_path:n {calligraphy temp path} + \tl_clear:N \l__cal_tmpa_tl + \tl_set:Nn \l__cal_tmpa_tl {fill=\pgfkeysvalueof{/tikz/pen~colour},draw=none} + \tl_if_exist:cT {l__cal_stroke_style_ \int_use:N \l__cal_tmpa_int} + { + \tl_put_right:Nv \l__cal_tmpa_tl {l__cal_stroke_style_ \int_use:N \l__cal_tmpa_int} + } + \tl_if_exist:cT {l__cal_stroke_inline_style_ \int_use:N \l__cal_tmpa_int} + { + \tl_put_right:Nn \l__cal_tmpa_tl {,} + \tl_put_right:Nv \l__cal_tmpa_tl {l__cal_stroke_inline_style_ \int_use:N \l__cal_tmpa_int} + } + \tl_if_exist:cT {l__cal_nib_style_ \int_use:N \l__cal_tmpb_int} + { + \tl_put_right:Nn \l__cal_tmpa_tl {,} + \tl_put_right:Nv \l__cal_tmpa_tl {l__cal_nib_style_ \int_use:N \l__cal_tmpb_int} + } + \spath_tikz_path:Vn \l__cal_tmpa_tl {calligraphy temp path} - \tikz@options - \pgfsetfillcolor{\pgfkeysvalueof{/tikz/pen~colour}} - \pgfusepath{fill} } + \pgfsys@endscope \group_end: } + \bool_if:NT \l__cal_annotate_bool + { + \spath_clone:nn {##1} {calligraphy temp path} + \tl_set_eq:Nc \l_tmpa_tl {l__spath_list_calligraphy pen #2} + \tl_reverse:N \l_tmpa_tl + \tl_set:Nx \l_tmpa_tl {\tl_head:N \l_tmpa_tl} + \spath_generate_finalpoint:V \l_tmpa_tl + \spath_get:VnN \l_tmpa_tl {final point} \l_tmpa_tl + \spath_translate:nV {calligraphy temp path} \l_tmpa_tl + \tikz@scan@one@point\pgfutil@firstofone\pgfkeysvalueof{/tikz/annotation~shift} + \spath_translate:nnn {calligraphy temp path} {\pgf@x} {\pgf@y} + + \pgfkeysgetvalue{/tikz/annotation~style}{\l_tmpa_tl} + \spath_tikz_path:Vn \l_tmpa_tl {calligraphy temp path} + \spath_get:nnN {calligraphy temp path} {final point} \l_tmpa_tl + \exp_last_unbraced:NV \pgfqpoint \l_tmpa_tl + \begin{scope}[reset~ cm] + \node[every~annotation~node/.try,tl~use:c = {l__cal_annotation_style_ \int_use:N \l__cal_tmpa_int _tl}] at (\pgf@x,\pgf@y) {\int_use:N \l__cal_tmpa_int}; + \end{scope} + } } } \cs_new_eq:NN \cal_orig_moveto:n \pgfpathmoveto @@ -222,7 +307,7 @@ \spath_get:nnN {#1} {path} \l__cal_tmpa_tl \spath_map_segment_inline:Nn \l__cal_tmpa_tl { - \tl_case:Nnn ##1 { + \tl_case:NnF ##1 { \g__spath_lineto_tl { \cal_split_line_in_three:NN \l__cal_tmpb_tl ##2 } @@ -242,7 +327,7 @@ \spath_get:nnN {#1} {path} \l__cal_tmpa_tl \spath_map_segment_inline:Nn \l__cal_tmpa_tl { - \tl_case:Nnn ##1 { + \tl_case:NnF ##1 { \g__spath_lineto_tl { \cal_split_line_in_two:NN \l__cal_tmpb_tl ##2 } @@ -371,7 +456,7 @@ \dim_set:Nn \l__cal_tmpb_dim {\tl_item:Nn \l__cal_tmpa_tl {3}} \tl_set:Nx \l__cal_tmpb_tl {\tl_item:Nn \l__cal_tmpa_tl {4}} - \tl_case:Nnn \l__cal_tmpb_tl + \tl_case:NnF \l__cal_tmpb_tl { \g__spath_lineto_tl { @@ -423,7 +508,7 @@ \dim_set:Nn \l__cal_tmpb_dim {\tl_item:Nn \l__cal_tmpa_tl {-1}} \tl_set:Nx \l__cal_tmpb_tl {\tl_item:Nn \l__cal_tmpa_tl {-3}} - \tl_case:Nnn \l__cal_tmpb_tl + \tl_case:NnF \l__cal_tmpb_tl { \g__spath_lineto_tl { diff --git a/Master/texmf-dist/tex/latex/spath3/tikzlibraryknots.code.tex b/Master/texmf-dist/tex/latex/spath3/tikzlibraryknots.code.tex index 2cc0806f588..e8a0872539c 100644 --- a/Master/texmf-dist/tex/latex/spath3/tikzlibraryknots.code.tex +++ b/Master/texmf-dist/tex/latex/spath3/tikzlibraryknots.code.tex @@ -61,14 +61,16 @@ } { \tikz@addmode{\tikz@mode@doubletrue} - \tl_if_empty:nTF {#1} + \tl_if_eq:nnTF {\pgfkeysnovalue} {#1} { - \pgfsetinnerstrokecolor{\tikz@strokecolor} + \tikz@addoption{\pgfsetinnerstrokecolor{.}} } { \pgfsetinnerstrokecolor{#1} } - \tikz@addoption{\pgfsetstrokecolor{knotbg}} + \tikz@addoption{ + \pgfsetstrokecolor{knotbg} + } \tl_set:Nn \tikz@double@setup{ \pgfsetinnerlinewidth{\pgflinewidth} \pgfsetlinewidth{\dim_eval:n {\tl_use:N \l__knot_gap_tl \pgflinewidth}} @@ -204,7 +206,7 @@ { \pgfscope \pgftransformreset - \int_step_function:nnnN {1} {1} {\l__knot_strands_int} \knot_draw_strand:n + \int_step_function:nnnN {1} {1} {\l__knot_strands_int} \knot_draw_strand:n \bool_if:NF \l__knot_super_draft_bool { \int_step_function:nnnN {1} {1} {\l__knot_strands_int} \knot_draw_labels:n @@ -245,6 +247,7 @@ \tl_set:Nn \l_tmpa_tl {knot~ diagram/every~ strand/.try,} \tl_put_right:Nv \l_tmpa_tl {l__knot_options_strand #1} \tl_put_right:Nn \l_tmpa_tl {,knot~ diagram/only~ when~ rendering/.try,only~ when~ rendering/.try} + \spath_bake_round:n {knot strand #1} \spath_tikz_path:Vn \l_tmpa_tl {knot strand #1} \group_end: \endpgfscope @@ -276,7 +279,7 @@ } \cs_new_protected_nopar:Npn \knot_split_self_intersects:NN #1#2 { - \tl_case:Nnn #1 + \tl_case:NnF #1 { \g__spath_curvetoa_tl { @@ -462,10 +465,24 @@ \tl_set_eq:cc {l__knot_options_ \tl_use:N \l__knot_prefix_tl -1} {l__knot_options_ \tl_use:N \l__knot_tmpg_tl} - \bool_if:NT \l__knot_prepend_prev_bool + \bool_if:nT + { + \l__knot_prepend_prev_bool + && + \tl_if_exist_p:c {knot previous \tl_use:N \l__knot_tmpg_tl} + && + !\tl_if_empty_p:c {knot previous \tl_use:N \l__knot_tmpg_tl} + } { \spath_prepend_no_move:nn {knot \tl_use:N \l__knot_prefix_tl -1} {knot \tl_use:c {knot previous \tl_use:N \l__knot_tmpg_tl}} - \bool_if:NT \l__knot_splits_bool + \bool_if:nT + { + \l__knot_splits_bool + && + \tl_if_exist_p:c {knot previous \tl_use:N \l__knot_tmpg_tl} + && + !\tl_if_empty_p:c {knot previous \tl_use:N \l__knot_tmpg_tl} + } { \knot_test_endpoint:vnT {knot previous \tl_use:N \l__knot_tmpg_tl} {initial point} { @@ -476,10 +493,25 @@ } } } - \bool_if:NT \l__knot_append_next_bool + \bool_if:nT + { + \l__knot_append_next_bool + && + \tl_if_exist_p:c {knot next \tl_use:N \l__knot_tmpg_tl} + && + !\tl_if_empty_p:c {knot previous \tl_use:N \l__knot_tmpg_tl} + } { \spath_append_no_move:nn {knot \tl_use:N \l__knot_prefix_tl -1} {knot \tl_use:c {knot next \tl_use:N \l__knot_tmpg_tl}} - \bool_if:NT \l__knot_splits_bool + \bool_if:nT + { + \l__knot_splits_bool + && + \tl_if_exist_p:c {knot previous \tl_use:N + \l__knot_tmpg_tl} + && + !\tl_if_empty_p:c {knot previous \tl_use:N \l__knot_tmpg_tl} + } { \knot_test_endpoint:vnT {knot previous \tl_use:N \l__knot_tmpg_tl} {final point} { @@ -492,10 +524,12 @@ \tl_set:Nn \l__knot_tmpg_tl {\tl_use:N \l__knot_prefix_tl -1} } } + \pgfscope \group_begin: - \tikzset{knot~ diagram/intersection~ \int_use:N \l__knot_intersections_int/.try} + \tikzset{knot~ diagram/every~ intersection/.try, every~ intersection/.try, knot~ diagram/intersection~ \int_use:N \l__knot_intersections_int/.try} \knot_draw_crossing:nVV {\tl_use:N \l__knot_tmpg_tl} \l__knot_tmpa_dim \l__knot_tmpb_dim \group_end: + \endpgfscope \tl_use:N \l__knot_node_tl (\l__knot_name_tl \c_space_tl \int_use:N \l__knot_intersections_int) at (\l__knot_tmpa_dim, \l__knot_tmpb_dim) {}; } } @@ -580,11 +614,12 @@ { \int_set_eq:NN \l__knot_component_start_int \l__knot_filaments_int \int_incr:N \l__knot_component_start_int + \tl_set_eq:Nc \l__knot_tmpa_tl {l__knot_options_strand #1} \spath_map_segment_function:nN {knot strand #1} \knot_save_filament:NN } \cs_new_protected_nopar:Npn \knot_save_filament:NN #1#2 { - \tl_case:Nnn #1 + \tl_case:NnF #1 { \g__spath_moveto_tl { @@ -598,6 +633,8 @@ \int_gincr:N \l__knot_filaments_int \spath_clear_new:n {knot filament \int_use:N \l__knot_filaments_int} \spath_put:nnV {knot filament \int_use:N \l__knot_filaments_int} {path} #2 + \tl_set_eq:cN {l__knot_options_filament \int_use:N \l__knot_filaments_int} \l__knot_tmpa_tl + \tl_clear_new:c {knot previous filament \int_use:N \l__knot_filaments_int} \int_compare:nF {\l__knot_component_start_int == \l__knot_filaments_int} { @@ -609,6 +646,8 @@ \int_gincr:N \l__knot_filaments_int \spath_clear_new:n {knot filament \int_use:N \l__knot_filaments_int} \spath_put:nnV {knot filament \int_use:N \l__knot_filaments_int} {path} #2 + \tl_set_eq:cN {l__knot_options_filament \int_use:N \l__knot_filaments_int} \l__knot_tmpa_tl + \tl_clear_new:c {knot previous filament \int_use:N \l__knot_filaments_int} \int_compare:nF {\l__knot_component_start_int == \l__knot_filaments_int} { @@ -624,6 +663,7 @@ \tl_put_right:NV \l_tmpa_tl \g__spath_lineto_tl \tl_set:Nx \l_tmpa_tl {\tl_item:Nn #2 {5}\tl_item:Nn #2 {6}} \spath_put:nnV {knot filament \int_use:N \l__knot_filaments_int} {path} \l_tmpa_tl + \tl_set_eq:cN {l__knot_options_filament \int_use:N \l__knot_filaments_int} \l__knot_tmpa_tl \tl_clear_new:c {knot previous filament \int_use:N \l__knot_filaments_int} \int_compare:nF {\l__knot_component_start_int == \l__knot_filaments_int} { |