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/source/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/source/latex/spath3')
-rw-r--r-- | Master/texmf-dist/source/latex/spath3/spath3.dtx | 361 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/spath3/spath3.ins | 91 |
2 files changed, 306 insertions, 146 deletions
diff --git a/Master/texmf-dist/source/latex/spath3/spath3.dtx b/Master/texmf-dist/source/latex/spath3/spath3.dtx index 4febfd505f1..73d4a172377 100644 --- a/Master/texmf-dist/source/latex/spath3/spath3.dtx +++ b/Master/texmf-dist/source/latex/spath3/spath3.dtx @@ -131,7 +131,7 @@ and the derived files spath3.ins, %</driver> % \fi % -% \CheckSum{4024} +% \CheckSum{4316} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -151,6 +151,7 @@ and the derived files spath3.ins, % % % \changes{1.0}{2011/05/03}{Converted to DTX file} +% \changes{1.1}{2016/02/19}{Fixes due to changes in LaTeX3} % % \DoNotIndex{\newcommand,\newenvironment} % @@ -167,7 +168,7 @@ and the derived files spath3.ins, % \section{Introduction} % % The \Verb+spath3+ package is intended as a library for manipulating PGF's \emph{soft paths}. -% In between defining a path and using it, PGF stores a path as a \emph{soft path} were all the defining structure has been resolved into the basic operations but these have not yet been written to the output file. +% In between defining a path and using it, PGF stores a path as a \emph{soft path} where all the defining structure has been resolved into the basic operations but these have not yet been written to the output file. % They can therefore still be manipulated by \TeX, and as they have a very rigid form (and limited vocabulary), they are relatively easy to modify. % This package provides some methods for working with these paths. % It is not really intended for use by end users but as a foundation on which other packages can be built. @@ -193,7 +194,7 @@ and the derived files spath3.ins, \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} % \end{macrocode} @@ -207,6 +208,8 @@ 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 % \end{macrocode} % @@ -217,11 +220,13 @@ manipulating PGF soft paths} \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} % \end{macrocode} % % \subsection{Basic Structure and Methods} @@ -323,7 +328,7 @@ manipulating PGF soft paths} % \begin{macrocode} \cs_new_nopar:Npn \__spath_get:nn #1#2 { - \prop_get:cn {l__spath_#1} {#2} + \prop_item:cn {l__spath_#1} {#2} } % \end{macrocode} % \end{macro} @@ -348,17 +353,21 @@ manipulating PGF soft paths} % \end{macrocode} % \end{macro} % -% \begin{macro}{\_spath_get:nnN} +% \begin{macro}{\__spath_get:nnN} % \begin{macrocode} \cs_generate_variant:Nn \__prop_split:NnTF {cnTF} \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} % \end{macrocode} % \end{macro} % @@ -399,9 +408,9 @@ manipulating PGF soft paths} % \begin{macrocode} \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 } % \end{macrocode} % \end{macro} @@ -487,7 +496,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} % \end{macrocode} % \end{macro} % @@ -583,6 +592,7 @@ manipulating PGF soft paths} } \spath_put:nnV {#1} {final point} \l__spath_tmpb_tl } +\cs_generate_variant:Nn \spath_generate_finalpoint:n {V} % \end{macrocode} % \end{macro} % @@ -610,7 +620,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 } @@ -834,7 +844,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 @@ -996,14 +1006,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 } @@ -1021,22 +1031,102 @@ 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} +% \end{macrocode} +% +% This variant allows for passing the coordinates as a single braced group as it strips off the outer braces of the second argument. +% \begin{macrocode} +\cs_new_nopar:Npn \spath_scale:nn #1#2 +{ + \spath_scale:nnn {#1} #2 +} + +\cs_generate_variant:Nn \spath_scale:nn {nV} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\spath_transform:nnnnnnn} +% Applies an affine (matrix and vector) transformation to path. +% The matrix is specified in rows first. +% \begin{macrocode} +\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} +% \end{macrocode} +% +% This variant allows for passing the coordinates as a single braced group as it strips off the outer braces of the second argument. +% \begin{macrocode} +\cs_new_nopar:Npn \spath_transform:nn #1#2 +{ + \spath_transform:nnnnnnn {#1} #2 +} + +\cs_generate_variant:Nn \spath_transform:nn {nV} % \end{macrocode} % \end{macro} % @@ -1047,7 +1137,7 @@ manipulating PGF soft paths} \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} @@ -1064,10 +1154,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} } % \end{macrocode} @@ -1502,6 +1592,42 @@ manipulating PGF soft paths} % \end{macrocode} % \end{macro} % +% \begin{macro}{\spath_bake_round:n} +% Ought to clear the reverse path, if set. +% \begin{macrocode} +\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 +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\spath_close_path:n} +% Appends a close path to the end of the path, and to the end of the reverse path. +% For now, the point is the initial or final point (respectively). +% To be future proof, it ought to be the point of the adjacent move to. +% \begin{macrocode} +\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 + } +} +% \end{macrocode} +% \end{macro} +% % \subsection{Iteration Functions} % % \begin{macro}{\spath_map_component:Nn} @@ -1588,7 +1714,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 { @@ -1747,7 +1873,7 @@ manipulating PGF soft paths} % % \begin{macro}{\SPathShow} % \begin{macrocode} -\NewDocumentCommand \SPathShow { m m } +\NewDocumentCommand \SPathShow { m } { \spath_show:n {#1} } @@ -1778,7 +1904,7 @@ manipulating PGF soft paths} % \begin{macrocode} \NewDocumentCommand \SPathScale { m m m } { - \spath_translate:nnn {#1} {#2} {#3} + \spath_scale:nnn {#1} {#2} {#3} } % \end{macrocode} % \end{macro} @@ -1789,7 +1915,7 @@ manipulating PGF soft paths} \NewDocumentCommand \SPathScaleInto { m m m m } { \spath_clone:nn {#1} {#2} - \spath_translate:nnn {#2} {#3} {#4} + \spath_scale:nnn {#2} {#3} {#4} } % \end{macrocode} % \end{macro} @@ -1823,7 +1949,7 @@ manipulating PGF soft paths} }, restore~spath/.code={ \spath_set_current_path:n {#1} - }, + } } % \end{macrocode} % \subsection{Miscellaneous Commands} @@ -1949,6 +2075,7 @@ manipulating PGF soft paths} \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 @@ -1957,6 +2084,7 @@ manipulating PGF soft paths} \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 @@ -1965,6 +2093,8 @@ manipulating PGF soft paths} \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} % \end{macrocode} % % \subsection{TikZ Keys} @@ -2066,6 +2196,51 @@ manipulating PGF soft paths} \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} + } + } } % \end{macrocode} % @@ -2073,17 +2248,17 @@ manipulating PGF soft paths} % \begin{macrocode} \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] } % \end{macrocode} % @@ -2103,28 +2278,30 @@ manipulating PGF soft paths} { \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 } { @@ -2136,14 +2313,48 @@ manipulating PGF soft paths} \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} + } } } % \end{macrocode} @@ -2187,7 +2398,7 @@ manipulating PGF soft paths} \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 } @@ -2207,7 +2418,7 @@ manipulating PGF soft paths} \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 } @@ -2366,7 +2577,7 @@ manipulating PGF soft paths} \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 { @@ -2418,7 +2629,7 @@ manipulating PGF soft paths} \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 { @@ -2818,14 +3029,16 @@ manipulating PGF soft paths} } { \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}} @@ -3000,7 +3213,7 @@ manipulating PGF soft paths} % \end{macrocode} % Loop through the strands drawing each one for the first time. % \begin{macrocode} - \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 % \end{macrocode} % In super draft mode we don't do anything else. % \begin{macrocode} @@ -3071,6 +3284,7 @@ manipulating PGF soft paths} \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 @@ -3118,7 +3332,7 @@ manipulating PGF soft paths} % \begin{macrocode} \cs_new_protected_nopar:Npn \knot_split_self_intersects:NN #1#2 { - \tl_case:Nnn #1 + \tl_case:NnF #1 { \g__spath_curvetoa_tl { @@ -3342,13 +3556,27 @@ manipulating PGF soft paths} \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}} % \end{macrocode} % If we split potentially self intersecting curves, we test to see if we should prepend yet another segment. % \begin{macrocode} - \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} { @@ -3362,10 +3590,25 @@ manipulating PGF soft paths} % \end{macrocode} % Now the same for appending. % \begin{macrocode} - \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} { @@ -3381,10 +3624,12 @@ manipulating PGF soft paths} % \end{macrocode} % Now we render the crossing. % \begin{macrocode} + \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 % \end{macrocode} % And stick a coordinate possibly with a label at the crossing. % \begin{macrocode} @@ -3509,6 +3754,7 @@ manipulating PGF soft paths} { \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 } % \end{macrocode} @@ -3519,7 +3765,7 @@ manipulating PGF soft paths} % \begin{macrocode} \cs_new_protected_nopar:Npn \knot_save_filament:NN #1#2 { - \tl_case:Nnn #1 + \tl_case:NnF #1 { \g__spath_moveto_tl { @@ -3533,6 +3779,8 @@ manipulating PGF soft paths} \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} { @@ -3544,6 +3792,8 @@ manipulating PGF soft paths} \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} { @@ -3559,6 +3809,7 @@ manipulating PGF soft paths} \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} { diff --git a/Master/texmf-dist/source/latex/spath3/spath3.ins b/Master/texmf-dist/source/latex/spath3/spath3.ins deleted file mode 100644 index b2836135ac1..00000000000 --- a/Master/texmf-dist/source/latex/spath3/spath3.ins +++ /dev/null @@ -1,91 +0,0 @@ -%% -%% This is file `spath3.ins', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% spath3.dtx (with options: `install') -%% ---------------------------------------------------------------- -%% spath3 --- Functions for manipulating PGF soft paths -%% E-mail: stacey@math.ntnu.no -%% Released under the LaTeX Project Public License v1.3c or later -%% See http://www.latex-project.org/lppl.txt -%% ---------------------------------------------------------------- -%% -\input docstrip.tex -\keepsilent -\askforoverwritefalse -\preamble ----------------------------------------------------------------- -spath3 --- Functions for manipulating PGF soft paths -E-mail: stacey@math.ntnu.no -Released under the LaTeX Project Public License v1.3c or later -See http://www.latex-project.org/lppl.txt ----------------------------------------------------------------- - -\endpreamble -\postamble - -Copyright (C) 2011 by Andrew Stacey <stacey@math.ntnu.no> - -This work may be distributed and/or modified under the -conditions of the LaTeX Project Public License (LPPL), either -version 1.3c of this license or (at your option) any later -version. The latest version of this license is in the file: - -http://www.latex-project.org/lppl.txt - -This work is "maintained" (as per LPPL maintenance status) by -Andrew Stacey. - -This work consists of the files spath3.dtx - calligraphy_doc.tex - knot_doc.tex -and the derived files spath3.ins, - spath3.pdf, - spath3.sty, - tikzlibrarycalligraphy.code.tex - tikzlibraryknots.code.tex - calligraphy_doc.pdf - knots_doc.pdf - README.txt - -\endpostamble -\usedir{tex/latex/spath3} -\generate{ - \file{\jobname.sty}{\from{\jobname.dtx}{spath3}} -} -\generate{ - \file{tikzlibrarycalligraphy.code.tex}{\from{\jobname.dtx}{calligraphy}} -} -\generate{ - \file{tikzlibraryknots.code.tex}{\from{\jobname.dtx}{knots}} -} -\endbatchfile -%% -%% Copyright (C) 2011 by Andrew Stacey <stacey@math.ntnu.no> -%% -%% This work may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License (LPPL), either -%% version 1.3c of this license or (at your option) any later -%% version. The latest version of this license is in the file: -%% -%% http://www.latex-project.org/lppl.txt -%% -%% This work is "maintained" (as per LPPL maintenance status) by -%% Andrew Stacey. -%% -%% This work consists of the files spath3.dtx -%% calligraphy_doc.tex -%% knot_doc.tex -%% and the derived files spath3.ins, -%% spath3.pdf, -%% spath3.sty, -%% tikzlibrarycalligraphy.code.tex -%% tikzlibraryknots.code.tex -%% calligraphy_doc.pdf -%% knots_doc.pdf -%% README.txt -%% -%% -%% End of file `spath3.ins'. |