texlive[50018] Master: spath3 (13feb19)
commits+karl at tug.org
commits+karl at tug.org
Wed Feb 13 23:22:09 CET 2019
Revision: 50018
http://tug.org/svn/texlive?view=revision&revision=50018
Author: karl
Date: 2019-02-13 23:22:09 +0100 (Wed, 13 Feb 2019)
Log Message:
-----------
spath3 (13feb19)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/spath3/spath3_code.pdf
trunk/Master/texmf-dist/source/latex/spath3/spath3.dtx
trunk/Master/texmf-dist/tex/latex/spath3/spath3.sty
trunk/Master/texmf-dist/tex/latex/spath3/tikzlibrarycalligraphy.code.tex
trunk/Master/texmf-dist/tex/latex/spath3/tikzlibraryknots.code.tex
trunk/Master/tlpkg/libexec/ctan2tds
Added Paths:
-----------
trunk/Master/texmf-dist/doc/latex/spath3/README.txt
trunk/Master/texmf-dist/doc/latex/spath3/calligraphy_doc.pdf
trunk/Master/texmf-dist/doc/latex/spath3/knots_doc.pdf
trunk/Master/texmf-dist/source/latex/spath3/spath3.ins
Removed Paths:
-------------
trunk/Master/texmf-dist/doc/latex/spath3/calligraphy.pdf
trunk/Master/texmf-dist/doc/latex/spath3/knots.pdf
Added: trunk/Master/texmf-dist/doc/latex/spath3/README.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex/spath3/README.txt (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/spath3/README.txt 2019-02-13 22:22:09 UTC (rev 50018)
@@ -0,0 +1,9 @@
+----------------------------------------------------------------
+spath3 --- LaTeX3 functions for manipulating PGF soft paths
+E-mail: stacey at math.ntnu.no
+Released under the LaTeX Project Public License v1.3c or later
+See http://www.latex-project.org/lppl.txt
+----------------------------------------------------------------
+
+This package defines some functions used to manipulate PGFs soft paths.
+As applications of its use, included are a package for drawing calligraphic paths and a package for drawing knot diagrams.
Property changes on: trunk/Master/texmf-dist/doc/latex/spath3/README.txt
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Deleted: trunk/Master/texmf-dist/doc/latex/spath3/calligraphy.pdf
===================================================================
(Binary files differ)
Added: trunk/Master/texmf-dist/doc/latex/spath3/calligraphy_doc.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/latex/spath3/calligraphy_doc.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/spath3/calligraphy_doc.pdf 2019-02-13 01:23:58 UTC (rev 50017)
+++ trunk/Master/texmf-dist/doc/latex/spath3/calligraphy_doc.pdf 2019-02-13 22:22:09 UTC (rev 50018)
Property changes on: trunk/Master/texmf-dist/doc/latex/spath3/calligraphy_doc.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Deleted: trunk/Master/texmf-dist/doc/latex/spath3/knots.pdf
===================================================================
(Binary files differ)
Added: trunk/Master/texmf-dist/doc/latex/spath3/knots_doc.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/latex/spath3/knots_doc.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/spath3/knots_doc.pdf 2019-02-13 01:23:58 UTC (rev 50017)
+++ trunk/Master/texmf-dist/doc/latex/spath3/knots_doc.pdf 2019-02-13 22:22:09 UTC (rev 50018)
Property changes on: trunk/Master/texmf-dist/doc/latex/spath3/knots_doc.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/latex/spath3/spath3_code.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/latex/spath3/spath3.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/spath3/spath3.dtx 2019-02-13 01:23:58 UTC (rev 50017)
+++ trunk/Master/texmf-dist/source/latex/spath3/spath3.dtx 2019-02-13 22:22:09 UTC (rev 50018)
@@ -35,7 +35,7 @@
\endpreamble
\postamble
-Copyright (C) 2011 by Andrew Stacey <stacey at math.ntnu.no>
+Copyright (C) 2011-2019 by Andrew Stacey <stacey at math.ntnu.no>
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License (LPPL), either
@@ -49,15 +49,15 @@
This work consists of the files spath3.dtx
calligraphy_doc.tex
- knot_doc.tex
+ knots_doc.tex
and the derived files spath3.ins,
- spath3.pdf,
+ spath3_code.pdf,
spath3.sty,
tikzlibrarycalligraphy.code.tex
tikzlibraryknots.code.tex
- calligraphy_doc.pdf
- knots_doc.pdf
- README.txt
+ calligraphy.pdf
+ knots.pdf
+ README
\endpostamble
\usedir{tex/latex/spath3}
@@ -131,7 +131,7 @@
%</driver>
% \fi
%
-% \CheckSum{4316}
+% \CheckSum{4488}
%
% \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
@@ -152,6 +152,7 @@
%
% \changes{1.0}{2011/05/03}{Converted to DTX file}
% \changes{1.1}{2016/02/19}{Fixes due to changes in LaTeX3}
+% \changes{1.2}{2019/02/12}{More fixes due to changes in LaTeX3}
%
% \DoNotIndex{\newcommand,\newenvironment}
%
@@ -194,7 +195,7 @@
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
\RequirePackage{pgf}
-\ProvidesExplPackage {spath3} {2016/02/19} {1.1} {Functions for
+\ProvidesExplPackage {spath3} {2019/02/12} {1.2} {Functions for
manipulating PGF soft paths}
\RequirePackage{xparse}
% \end{macrocode}
@@ -211,6 +212,7 @@
\fp_new:N \l__spath_tmpa_fp
\fp_new:N \l__spath_tmpb_fp
\int_new:N \l__spath_tmpa_int
+\int_new:N \g__spath_map_int
% \end{macrocode}
%
% We need to be able to compare against the macros that can occur in a soft path so these token lists contain them.
@@ -496,7 +498,7 @@
}
\__spath_get:nnN {#1} {#2} #3
}
-\cs_generate_variant:Nn \spath_get:nnN {nnV,VnN,VnV}
+\cs_generate_variant:Nn \spath_get:nnN {VnN}
% \end{macrocode}
% \end{macro}
%
@@ -1635,8 +1637,8 @@
% \begin{macrocode}
\cs_new_nopar:Npn \spath_map_component:Nn #1#2
{
- \int_gincr:N \g__prg_map_int
- \cs_gset:cpn { __prg_map_ \int_use:N \g__prg_map_int :w } ##1 {#2}
+ \int_gincr:N \g__spath_map_int
+ \cs_gset:cpn { __spath_map_ \int_use:N \g__spath_map_int :w } ##1 {#2}
\tl_set:NV \l__spath_tmpa_tl #1
\tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
\tl_put_right:NV \l__spath_tmpa_tl \g__spath_moveto_tl
@@ -1648,7 +1650,7 @@
\tl_set:Nx \l__spath_tmpc_tl {\tl_head:N \l__spath_tmpa_tl}
\tl_if_eq:NNT \l__spath_tmpc_tl \g__spath_moveto_tl
{
- \exp_args:NnV \use:c { __prg_map_ \int_use:N \g__prg_map_int :w } \l__spath_tmpb_tl
+ \exp_args:NnV \use:c { __spath_map_ \int_use:N \g__spath_map_int :w } \l__spath_tmpb_tl
\tl_clear:N \l__spath_tmpb_tl
}
\tl_if_single:NTF \l__spath_tmpc_tl
@@ -1669,9 +1671,9 @@
% \begin{macrocode}
\cs_new_nopar:Npn \spath_map_segment_inline:Nn #1#2
{
- \int_gincr:N \g__prg_map_int
- \cs_gset:cpn { __prg_map_ \int_use:N \g__prg_map_int :w } ##1 ##2 {#2}
- \spath_map_segment_function:Nc #1 { __prg_map_ \int_use:N \g__prg_map_int :w }
+ \int_gincr:N \g__spath_map_int
+ \cs_gset:cpn { __spath_map_ \int_use:N \g__spath_map_int :w } ##1 ##2 {#2}
+ \spath_map_segment_function:Nc #1 { __spath_map_ \int_use:N \g__spath_map_int :w }
}
% \end{macrocode}
% \end{macro}
@@ -1681,10 +1683,10 @@
% \begin{macrocode}
\cs_new_nopar:Npn \spath_map_segment_inline:nn #1#2
{
- \int_gincr:N \g__prg_map_int
- \cs_gset:cpn { __prg_map_ \int_use:N \g__prg_map_int :w } ##1 ##2 {#2}
+ \int_gincr:N \g__spath_map_int
+ \cs_gset:cpn { __spath_map_ \int_use:N \g__spath_map_int :w } ##1 ##2 {#2}
\spath_get:nnN {#1} {path} \l__spath_tmpd_tl
- \spath_map_segment_function:Nc \l__spath_tmpd_tl { __prg_map_ \int_use:N \g__prg_map_int :w }
+ \spath_map_segment_function:Nc \l__spath_tmpd_tl { __spath_map_ \int_use:N \g__spath_map_int :w }
}
% \end{macrocode}
% \end{macro}
@@ -1764,7 +1766,28 @@
\tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
}
- }
+
+ \g__spath_closepath_tl
+ {
+ \tl_set_eq:NN \l__spath_tmpb_tl \g__spath_moveto_tl
+ \tl_put_right:Nx \l__spath_tmpb_tl
+ {
+ {\dim_use:N \l__spath_tmpa_dim}
+ {\dim_use:N \l__spath_tmpb_dim}
+ }
+ \tl_put_right:NV \l__spath_tmpb_tl \g__spath_lineto_tl
+
+ \tl_put_right:Nx \l__spath_tmpb_tl {{\tl_head:N \l__spath_tmpa_tl}}
+ \dim_set:Nn \l__spath_tmpa_dim {\tl_head:N \l__spath_tmpa_tl}
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+
+ \tl_put_right:Nx \l__spath_tmpb_tl {{\tl_head:N \l__spath_tmpa_tl}}
+ \dim_set:Nn \l__spath_tmpb_dim {\tl_head:N \l__spath_tmpa_tl}
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+
+ }
+
+ }
{
\tl_set_eq:NN \l__spath_tmpb_tl \l__spath_tmpc_tl
@@ -1865,8 +1888,8 @@
% \begin{macrocode}
\NewDocumentCommand \SPathInfoInto { m m m }
{
- \tl_set:Nn \l_tmpa_tl #3
- \spath_get:nnV {#1} {#2} \l_tmpa_tl
+ \tl_clear_new:N #3
+ \spath_get:nnN {#1} {#2} #3
}
% \end{macrocode}
% \end{macro}
@@ -1963,8 +1986,8 @@
\tl_gclear:N \l__spath_smuggle_tl
\tl_set_eq:NN \l__spath_tmpa_tl \g__spath_moveto_tl
\tl_put_right:Nx \l__spath_tmpa_tl {
+ {\tl_item:nn {#2} {2}}
{\tl_item:nn {#2} {3}}
- {\tl_item:nn {#2} {4}}
}
\tl_put_right:NV \l__spath_tmpa_tl \g__spath_curvetoa_tl
\tl_put_right:Nx \l__spath_tmpa_tl
@@ -2993,6 +3016,8 @@
\tl_new:N \l__knot_clip_width_tl
\tl_new:N \l__knot_name_tl
\tl_new:N \l__knot_node_tl
+\tl_new:N \l__knot_aux_tl
+\tl_new:N \l__knot_auxa_tl
\int_new:N \l__knot_tmpa_int
\int_new:N \l__knot_strands_int
@@ -3004,7 +3029,8 @@
\dim_new:N \l__knot_tmpb_dim
\dim_new:N \l__knot_tmpc_dim
\dim_new:N \l__knot_tolerance_dim
-\dim_new:N \l__knot_clip_radius_dim
+\dim_new:N \l__knot_clip_bg_radius_dim
+\dim_new:N \l__knot_clip_draw_radius_dim
\bool_new:N \l__knot_draft_bool
\bool_new:N \l__knot_ignore_ends_bool
@@ -3015,7 +3041,10 @@
\bool_new:N \l__knot_prepend_prev_bool
\bool_new:N \l__knot_append_next_bool
\bool_new:N \l__knot_skip_bool
+\bool_new:N \l__knot_save_bool
+\seq_new:N \l__knot_nodes_seq
+
\bool_set_true:N \l__knot_ignore_ends_bool
% \end{macrocode}
%
@@ -3062,8 +3091,16 @@
},
background~ colour=white,
knot~ diagram,
- name/.store~in=\l__knot_name_tl,
+ name/.store~ in=\l__knot_name_tl,
name={knot},
+ save~ intersections/.is~ choice,
+ save~ intersections/.default=true,
+ save~ intersections/true/.code={
+ \bool_set_true:N \l__knot_save_bool
+ },
+ save~ intersections/false/.code={
+ \bool_set_false:N \l__knot_save_bool
+ },
every~ strand/.style={draw},
ignore~ endpoint~ intersections/.code={
\tl_if_eq:nnTF {#1} {true}
@@ -3090,13 +3127,26 @@
},
consider~ self~ intersections/.default={true},
clip~ radius/.code={
- \dim_set:Nn \l__knot_clip_radius_dim {#1}
+ \dim_set:Nn \l__knot_clip_bg_radius_dim {#1}
+ \dim_set:Nn \l__knot_clip_draw_radius_dim {#1+2pt}
},
+ clip~ draw~ radius/.code={
+ \dim_set:Nn \l__knot_clip_draw_radius_dim {#1}
+ },
+ clip~ background~ radius/.code={
+ \dim_set:Nn \l__knot_clip_bg_radius_dim {#1}
+ },
clip~ radius=10pt,
end~ tolerance/.code={
\dim_set:Nn \l__knot_tolerance_dim {#1}
},
end~ tolerance=14pt,
+ clip/.style={
+ clip
+ },
+ background~ clip/.style={
+ clip
+ },
clip~ width/.code={
\tl_set:Nn \l__knot_clip_width_tl {#1}
},
@@ -3105,6 +3155,10 @@
\tl_clear_new:c {l__knot_crossing_#1}
\tl_set:cn {l__knot_crossing_#1} {x}
},
+ ignore~ crossing/.code={%
+ \tl_clear_new:c {l__knot_ignore_crossing_#1}
+ \tl_set:cn {l__knot_ignore_crossing_#1} {x}
+ },
draft~ mode/.is~ choice,
draft~ mode/off/.code={%
\bool_set_false:N \l__knot_draft_bool
@@ -3196,6 +3250,7 @@
\tikzset{knot~ diagram/.cd,every~ knot~ diagram/.try,#1}
\int_zero:N \l__knot_strands_int
\tl_clear:N \l__knot_redraws_tl
+ \seq_gclear:N \l__knot_nodes_seq
}
% \end{macrocode}
% \end{macro}
@@ -3245,11 +3300,14 @@
% \begin{macrocode}
\bool_if:NTF \l__knot_draft_bool
{
- \tl_set:Nn \l__knot_node_tl
- {\node[coordinate,pin={[knot~ diagram/draft/crossing~ label]{\int_use:N \l__knot_intersections_int}}]}
+ \tl_set:Nn \l__knot_node_tl {
+ \exp_not:N \node[coordinate,
+ pin={[node~ contents={\int_use:N \l__knot_intersections_int},knot~ diagram/draft/crossing~ label, knot~ diagram/draft/crossing~ \int_use:N \l__knot_intersections_int \c_space_tl label/.try]
+ }]
+ }
}
{
- \tl_set:Nn \l__knot_node_tl {\node[coordinate]}
+ \tl_set:Nn \l__knot_node_tl {\exp_not:N \node[coordinate]}
}
% \end{macrocode}
% This double loop steps through the pieces (strands or filaments) and computes the intersections and does stuff with those.
@@ -3265,6 +3323,10 @@
% If any redraws were requested, do them here.
% \begin{macrocode}
\tl_use:N \l__knot_redraws_tl
+% \end{macrocode}
+% Draw the crossing nodes
+% \begin{macrocode}
+ \seq_use:Nn \l__knot_nodes_seq {}
}
% \end{macrocode}
% Close the scope
@@ -3422,17 +3484,71 @@
\spath_get:nnN {knot \tl_use:N \l__knot_tmpa_tl} {path} \l__knot_tmpc_tl
\spath_get:nnN {knot \tl_use:N \l__knot_tmpb_tl} {path} \l__knot_tmpd_tl
- \pgfintersectionofpaths{\pgfsetpath\l__knot_tmpc_tl}{\pgfsetpath\l__knot_tmpd_tl}
+ \bool_if:nTF {
+ \l__knot_save_bool
+ &&
+ \tl_if_exist_p:c {knot~ intersections~ \tl_use:N \l__knot_name_tl - \tl_use:N \l__knot_tmpa_tl - \tl_use:N \l__knot_tmpb_tl}
+ }
+ {
+ \tl_use:c {knot~ intersections~ \tl_use:N \l__knot_name_tl - \tl_use:N \l__knot_tmpa_tl - \tl_use:N \l__knot_tmpb_tl}
+ }
+ {
+\pgfintersectionofpaths{\pgfsetpath\l__knot_tmpc_tl}{\pgfsetpath\l__knot_tmpd_tl}
+ }
\int_compare:nT {\pgfintersectionsolutions > 0}
{
\int_step_function:nnnN {1} {1} {\pgfintersectionsolutions} \knot_do_intersection:n
}
+ \knot_save_intersections:VV \l__knot_tmpa_tl \l__knot_tmpb_tl
\group_end:
}
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\knot_save_intersections:nn}
+% \begin{macrocode}
+\cs_new_protected_nopar:Npn \knot_save_intersections:nn #1#2
+{
+ \bool_if:NT \l__knot_save_bool
+ {
+ \tl_clear:N \l__knot_aux_tl
+ \tl_put_right:Nn \l__knot_aux_tl
+ {
+ \def\pgfintersectionsolutions
+ }
+ \tl_put_right:Nx \l__knot_aux_tl
+ {
+ {\int_eval:n {\pgfintersectionsolutions}}
+ }
+ \int_compare:nT {\pgfintersectionsolutions > 0}
+ {
+ \int_step_inline:nnnn {1} {1} {\pgfintersectionsolutions}
+ {
+ \pgfpointintersectionsolution{##1}
+ \dim_set:Nn \l__knot_tmpa_dim {\pgf at x}
+ \dim_set:Nn \l__knot_tmpb_dim {\pgf at y}
+ \tl_put_right:Nn \l__knot_aux_tl
+ {
+ \expandafter\def\csname pgfpoint at intersect@solution@##1\endcsname
+ }
+ \tl_put_right:Nx \l__knot_aux_tl
+ {
+ {\exp_not:N \pgf at x=\dim_use:N \l__knot_tmpa_dim\exp_not:N\relax\exp_not:N \pgf at y =\dim_use:N \l__knot_tmpb_dim\relax}
+ }
+ }
+ \tl_set:Nn \l__knot_auxa_tl {\expandafter \gdef \csname knot~ intersections~}
+ \tl_put_right:Nx \l__knot_auxa_tl {\tl_use:N \l__knot_name_tl - #1 - #2}
+ \tl_put_right:Nn \l__knot_auxa_tl {\endcsname}
+ \tl_put_right:Nx \l__knot_auxa_tl {{\tl_to_str:N \l__knot_aux_tl}}
+ \protected at write\@auxout{}{\tl_to_str:N \l__knot_auxa_tl}
+ }
+ }
+}
+\cs_generate_variant:Nn \knot_save_intersections:nn {VV}
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\knot_do_intersection:n}
% This handles a specific intersection.
% \begin{macrocode}
@@ -3476,7 +3592,7 @@
}
}
% \end{macrocode}
-% The can also say that end points of filaments (or strands) should simply be ignored anyway.
+% The user can also say that end points of filaments (or strands) should simply be ignored anyway.
% \begin{macrocode}
\bool_if:NT \l__knot_ignore_ends_bool
{
@@ -3505,73 +3621,72 @@
\int_gincr:N \l__knot_intersections_int
% \end{macrocode}
-% This is the flip test.
-% We only render one of the paths.
-% The ``flip'' swaps which one we render.
+% This is the intersection test.
+% If the intersection finder finds too many, it might be useful to ignore some.
% \begin{macrocode}
- \bool_if:nTF
+ \bool_if:nF
{
- \tl_if_exist_p:c {l__knot_crossing_ \int_use:N
+ \tl_if_exist_p:c {l__knot_ignore_crossing_ \int_use:N
\l__knot_intersections_int}
&&
- ! \tl_if_empty_p:c {l__knot_crossing_ \int_use:N
+ ! \tl_if_empty_p:c {l__knot_ignore_crossing_ \int_use:N
\l__knot_intersections_int}
}
{
- \tl_set_eq:NN \l__knot_tmpg_tl \l__knot_tmpb_tl
- }
- {
- \tl_set_eq:NN \l__knot_tmpg_tl \l__knot_tmpa_tl
- }
% \end{macrocode}
-% Now we know which one we're rendering, we test to see if we should also render its predecessor or successor to ensure that we render a path through the entire crossing region.
-% \begin{macrocode}
- \bool_if:NT \l__knot_self_intersections_bool
- {
- \knot_test_endpoint:VnT \l__knot_tmpg_tl {initial point}
+% This is the flip test.
+% We only render one of the paths.
+% The ``flip'' swaps which one we render.
+% \begin{macrocode}
+ \bool_if:nTF
{
- \bool_set_true:N \l__knot_prepend_prev_bool
+ \tl_if_exist_p:c {l__knot_crossing_ \int_use:N
+ \l__knot_intersections_int}
+ &&
+ ! \tl_if_empty_p:c {l__knot_crossing_ \int_use:N
+ \l__knot_intersections_int}
}
{
- \bool_set_false:N \l__knot_prepend_prev_bool
+ \tl_set_eq:NN \l__knot_tmpg_tl \l__knot_tmpb_tl
}
-
- \knot_test_endpoint:VnT \l__knot_tmpg_tl {final point}
{
- \bool_set_true:N \l__knot_append_next_bool
+ \tl_set_eq:NN \l__knot_tmpg_tl \l__knot_tmpa_tl
}
+% \end{macrocode}
+% Now we know which one we're rendering, we test to see if we should also render its predecessor or successor to ensure that we render a path through the entire crossing region.
+% \begin{macrocode}
+ \bool_if:NT \l__knot_self_intersections_bool
{
- \bool_set_false:N \l__knot_append_next_bool
- }
+ \knot_test_endpoint:VnT \l__knot_tmpg_tl {initial point}
+ {
+ \bool_set_true:N \l__knot_prepend_prev_bool
+ }
+ {
+ \bool_set_false:N \l__knot_prepend_prev_bool
+ }
+ \knot_test_endpoint:VnT \l__knot_tmpg_tl {final point}
+ {
+ \bool_set_true:N \l__knot_append_next_bool
+ }
+ {
+ \bool_set_false:N \l__knot_append_next_bool
+ }
% \end{macrocode}
% If either of those tests succeeded, do the appending or prepending.
% \begin{macrocode}
- \bool_if:nT
- {
- \l__knot_prepend_prev_bool || \l__knot_append_next_bool
- }
- {
- \spath_clone:nn {knot \tl_use:N \l__knot_tmpg_tl}
- {knot \tl_use:N \l__knot_prefix_tl -1}
-
- \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
- &&
- \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}
+ \l__knot_prepend_prev_bool || \l__knot_append_next_bool
}
{
- \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}
+ \spath_clone:nn {knot \tl_use:N \l__knot_tmpg_tl}
+ {knot \tl_use:N \l__knot_prefix_tl -1}
+
+ \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_splits_bool
+ \l__knot_prepend_prev_bool
&&
\tl_if_exist_p:c {knot previous \tl_use:N \l__knot_tmpg_tl}
&&
@@ -3578,62 +3693,80 @@
!\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}
+ \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
{
- \spath_get:nnN {knot \tl_use:N \l__knot_prefix_tl -1} {path} \l_tmpa_tl
- \spath_prepend_no_move:nn {knot \tl_use:N \l__knot_prefix_tl -1} {knot \tl_use:c {knot previous \tl_use:c {knot previous \tl_use:N \l__knot_tmpg_tl}}}
- \spath_get:nnN {knot \tl_use:N \l__knot_prefix_tl -1} {path} \l_tmpa_tl
+ \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}
+ {
+ \spath_get:nnN {knot \tl_use:N \l__knot_prefix_tl -1} {path} \l_tmpa_tl
+ \spath_prepend_no_move:nn {knot \tl_use:N \l__knot_prefix_tl -1} {knot \tl_use:c {knot previous \tl_use:c {knot previous \tl_use:N \l__knot_tmpg_tl}}}
+ \spath_get:nnN {knot \tl_use:N \l__knot_prefix_tl -1} {path} \l_tmpa_tl
+ }
}
}
- }
% \end{macrocode}
% Now the same for appending.
% \begin{macrocode}
- \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
+ \l__knot_append_next_bool
&&
- \tl_if_exist_p:c {knot previous \tl_use:N
- \l__knot_tmpg_tl}
+ \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}
}
{
- \knot_test_endpoint:vnT {knot previous \tl_use:N \l__knot_tmpg_tl} {final point}
+ \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
{
- \spath_append_no_move:nn {knot \tl_use:N \l__knot_prefix_tl -1} {knot \tl_use:c {knot next \tl_use:c {knot next \tl_use:N \l__knot_tmpg_tl}}}
-
+ \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}
+ {
+ \spath_append_no_move:nn {knot \tl_use:N \l__knot_prefix_tl -1} {knot \tl_use:c {knot next \tl_use:c {knot next \tl_use:N \l__knot_tmpg_tl}}}
+
+ }
+ }
}
+
+ \tl_set:Nn \l__knot_tmpg_tl {\tl_use:N \l__knot_prefix_tl -1}
}
-
- \tl_set:Nn \l__knot_tmpg_tl {\tl_use:N \l__knot_prefix_tl -1}
}
- }
% \end{macrocode}
% Now we render the crossing.
% \begin{macrocode}
- \pgfscope
- \group_begin:
- \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
+ \pgfscope
+ \group_begin:
+ \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}
+% This ends the boolean as to whether to consider the intersection at all
+% \begin{macrocode}
+ }
+% \end{macrocode}
% And stick a coordinate possibly with a label at the crossing.
% \begin{macrocode}
- \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) {};
+ \seq_gpush:Nx \l__knot_nodes_seq { \l__knot_node_tl (\l__knot_name_tl \c_space_tl \int_use:N \l__knot_intersections_int) at (\dim_use:N \l__knot_tmpa_dim, \dim_use:N \l__knot_tmpb_dim) {};}
+
}
}
@@ -3648,9 +3781,9 @@
{
\dim_compare:nTF
{
- \dim_abs:n {\pgf at x - \tl_item:Nn #1 {1}}
+ \dim_abs:n { \l__knot_tmpa_dim - \tl_item:Nn #1 {1}}
+
- \dim_abs:n {\pgf at y - \tl_item:Nn #1 {2}}
+ \dim_abs:n { \l__knot_tmpb_dim - \tl_item:Nn #1 {2}}
<
\l__knot_tolerance_dim
}
@@ -3692,7 +3825,7 @@
{
\group_begin:
\pgfscope
- \clip (#2, #3) circle[radius=\l__knot_clip_radius_dim];
+ \path[knot~ diagram/background~ clip] (#2, #3) circle[radius=\l__knot_clip_bg_radius_dim];
\tl_set:Nn \l_tmpa_tl {knot~ diagram/every~ strand/.try,}
\tl_if_exist:cT {l__knot_options_ #1}
@@ -3705,7 +3838,7 @@
\endpgfscope
\pgfscope
- \clip (#2, #3) circle[radius=1.1\l__knot_clip_radius_dim];
+ \path[knot~ diagram/clip] (#2, #3) circle[radius=\l__knot_clip_draw_radius_dim];
\tl_set:Nn \l_tmpa_tl {knot~ diagram/every~ strand/.try,}
\tl_if_exist:cT {l__knot_options_ #1}
@@ -3720,6 +3853,12 @@
}
\cs_generate_variant:Nn \knot_draw_crossing:nnn {nVV}
+
+\cs_new_nopar:Npn \knot_draw_crossing:nn #1#2
+{
+ \tikz at scan@one at point\pgfutil at firstofone #2 \relax
+ \knot_draw_crossing:nVV {#1} \pgf at x \pgf at y
+}
% \end{macrocode}
% \end{macro}
%
@@ -3800,14 +3939,16 @@
\tl_set:cx {knot previous filament \int_use:N \l__knot_filaments_int} {filament \int_eval:n {\l__knot_filaments_int - 1}}
}
}
- \g__spath_close_tl
+ \g__spath_closepath_tl
{
+ \tl_show:N #2
\int_gincr:N \l__knot_filaments_int
\spath_clear_new:n {knot filament \int_use:N \l__knot_filaments_int}
- \tl_set_eq:NN \l_tmpa_tl #2
- \tl_set:Nx \l_tmpa_tl {\tl_item:Nn #2 {1}\tl_item:Nn #2 {2}\tl_item:Nn #2 {3}}
+ \tl_clear:N \l_tmpa_tl
+ \tl_put_right:Nx {\tl_item:Nn #2 {1}\tl_item:Nn #2 {2}\tl_item:Nn #2 {3}}
\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}}
+ \tl_put_right:Nx {\tl_item:Nn #2 {5}\tl_item:Nn #2 {6}}
+ \tl_show:N \l_tmpa_tl
\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}
@@ -3829,10 +3970,10 @@
% \begin{macrocode}
\NewDocumentCommand \redraw { m m }
{
- \tikz at scan@one at point\pgfutil at firstofone #2 \relax
- \tl_put_right:Nn \l__knot_redraws_tl {\knot_draw_crossing:nnn}
+% \tikz at scan@one at point\pgfutil at firstofone #2 \relax
+ \tl_put_right:Nn \l__knot_redraws_tl {\knot_draw_crossing:nn}
\tl_put_right:Nx \l__knot_redraws_tl {
- {strand #1} {\dim_use:N \pgf at x} {\dim_use:N \pgf at y}
+ {strand #1} {#2}% {\dim_use:N \pgf at x} {\dim_use:N \pgf at y}
}
}
% \end{macrocode}
Added: trunk/Master/texmf-dist/source/latex/spath3/spath3.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/spath3/spath3.ins (rev 0)
+++ trunk/Master/texmf-dist/source/latex/spath3/spath3.ins 2019-02-13 22:22:09 UTC (rev 50018)
@@ -0,0 +1,91 @@
+%%
+%% 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 at 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 at 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-2019 by Andrew Stacey <stacey at 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
+ knots_doc.tex
+and the derived files spath3.ins,
+ spath3_code.pdf,
+ spath3.sty,
+ tikzlibrarycalligraphy.code.tex
+ tikzlibraryknots.code.tex
+ calligraphy.pdf
+ knots.pdf
+ README
+
+\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-2019 by Andrew Stacey <stacey at 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
+%% knots_doc.tex
+%% and the derived files spath3.ins,
+%% spath3_code.pdf,
+%% spath3.sty,
+%% tikzlibrarycalligraphy.code.tex
+%% tikzlibraryknots.code.tex
+%% calligraphy.pdf
+%% knots.pdf
+%% README
+%%
+%%
+%% End of file `spath3.ins'.
Modified: trunk/Master/texmf-dist/tex/latex/spath3/spath3.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/spath3/spath3.sty 2019-02-13 01:23:58 UTC (rev 50017)
+++ trunk/Master/texmf-dist/tex/latex/spath3/spath3.sty 2019-02-13 22:22:09 UTC (rev 50018)
@@ -15,7 +15,7 @@
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
\RequirePackage{pgf}
-\ProvidesExplPackage {spath3} {2016/02/19} {1.1} {Functions for
+\ProvidesExplPackage {spath3} {2019/02/12} {1.2} {Functions for
manipulating PGF soft paths}
\RequirePackage{xparse}
\tl_new:N \l__spath_tmpa_tl
@@ -28,6 +28,7 @@
\fp_new:N \l__spath_tmpa_fp
\fp_new:N \l__spath_tmpb_fp
\int_new:N \l__spath_tmpa_int
+\int_new:N \g__spath_map_int
\tl_new:N \g__spath_moveto_tl
\tl_new:N \g__spath_lineto_tl
\tl_new:N \g__spath_curveto_tl
@@ -194,7 +195,7 @@
}
\__spath_get:nnN {#1} {#2} #3
}
-\cs_generate_variant:Nn \spath_get:nnN {nnV,VnN,VnV}
+\cs_generate_variant:Nn \spath_get:nnN {VnN}
\cs_new_nopar:Npn \spath_generate_length:n #1
{
\__spath_get:nnN {#1} {path} \l__spath_tmpa_tl
@@ -1158,8 +1159,8 @@
}
\cs_new_nopar:Npn \spath_map_component:Nn #1#2
{
- \int_gincr:N \g__prg_map_int
- \cs_gset:cpn { __prg_map_ \int_use:N \g__prg_map_int :w } ##1 {#2}
+ \int_gincr:N \g__spath_map_int
+ \cs_gset:cpn { __spath_map_ \int_use:N \g__spath_map_int :w } ##1 {#2}
\tl_set:NV \l__spath_tmpa_tl #1
\tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
\tl_put_right:NV \l__spath_tmpa_tl \g__spath_moveto_tl
@@ -1171,7 +1172,7 @@
\tl_set:Nx \l__spath_tmpc_tl {\tl_head:N \l__spath_tmpa_tl}
\tl_if_eq:NNT \l__spath_tmpc_tl \g__spath_moveto_tl
{
- \exp_args:NnV \use:c { __prg_map_ \int_use:N \g__prg_map_int :w } \l__spath_tmpb_tl
+ \exp_args:NnV \use:c { __spath_map_ \int_use:N \g__spath_map_int :w } \l__spath_tmpb_tl
\tl_clear:N \l__spath_tmpb_tl
}
\tl_if_single:NTF \l__spath_tmpc_tl
@@ -1186,16 +1187,16 @@
}
\cs_new_nopar:Npn \spath_map_segment_inline:Nn #1#2
{
- \int_gincr:N \g__prg_map_int
- \cs_gset:cpn { __prg_map_ \int_use:N \g__prg_map_int :w } ##1 ##2 {#2}
- \spath_map_segment_function:Nc #1 { __prg_map_ \int_use:N \g__prg_map_int :w }
+ \int_gincr:N \g__spath_map_int
+ \cs_gset:cpn { __spath_map_ \int_use:N \g__spath_map_int :w } ##1 ##2 {#2}
+ \spath_map_segment_function:Nc #1 { __spath_map_ \int_use:N \g__spath_map_int :w }
}
\cs_new_nopar:Npn \spath_map_segment_inline:nn #1#2
{
- \int_gincr:N \g__prg_map_int
- \cs_gset:cpn { __prg_map_ \int_use:N \g__prg_map_int :w } ##1 ##2 {#2}
+ \int_gincr:N \g__spath_map_int
+ \cs_gset:cpn { __spath_map_ \int_use:N \g__spath_map_int :w } ##1 ##2 {#2}
\spath_get:nnN {#1} {path} \l__spath_tmpd_tl
- \spath_map_segment_function:Nc \l__spath_tmpd_tl { __prg_map_ \int_use:N \g__prg_map_int :w }
+ \spath_map_segment_function:Nc \l__spath_tmpd_tl { __spath_map_ \int_use:N \g__spath_map_int :w }
}
\cs_new_nopar:Npn \spath_map_segment_function:nN #1#2
{
@@ -1265,6 +1266,27 @@
\tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
}
+
+ \g__spath_closepath_tl
+ {
+ \tl_set_eq:NN \l__spath_tmpb_tl \g__spath_moveto_tl
+ \tl_put_right:Nx \l__spath_tmpb_tl
+ {
+ {\dim_use:N \l__spath_tmpa_dim}
+ {\dim_use:N \l__spath_tmpb_dim}
+ }
+ \tl_put_right:NV \l__spath_tmpb_tl \g__spath_lineto_tl
+
+ \tl_put_right:Nx \l__spath_tmpb_tl {{\tl_head:N \l__spath_tmpa_tl}}
+ \dim_set:Nn \l__spath_tmpa_dim {\tl_head:N \l__spath_tmpa_tl}
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+
+ \tl_put_right:Nx \l__spath_tmpb_tl {{\tl_head:N \l__spath_tmpa_tl}}
+ \dim_set:Nn \l__spath_tmpb_dim {\tl_head:N \l__spath_tmpa_tl}
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+
+ }
+
}
{
@@ -1322,8 +1344,8 @@
}
\NewDocumentCommand \SPathInfoInto { m m m }
{
- \tl_set:Nn \l_tmpa_tl #3
- \spath_get:nnV {#1} {#2} \l_tmpa_tl
+ \tl_clear_new:N #3
+ \spath_get:nnN {#1} {#2} #3
}
\NewDocumentCommand \SPathShow { m }
{
@@ -1372,8 +1394,8 @@
\tl_gclear:N \l__spath_smuggle_tl
\tl_set_eq:NN \l__spath_tmpa_tl \g__spath_moveto_tl
\tl_put_right:Nx \l__spath_tmpa_tl {
+ {\tl_item:nn {#2} {2}}
{\tl_item:nn {#2} {3}}
- {\tl_item:nn {#2} {4}}
}
\tl_put_right:NV \l__spath_tmpa_tl \g__spath_curvetoa_tl
\tl_put_right:Nx \l__spath_tmpa_tl
@@ -1463,7 +1485,7 @@
\cs_generate_variant:Nn \spath_split_curve:nnNN {nVNN, VVNN}
%%
-%% Copyright (C) 2011 by Andrew Stacey <stacey at math.ntnu.no>
+%% Copyright (C) 2011-2019 by Andrew Stacey <stacey at math.ntnu.no>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
@@ -1477,15 +1499,15 @@
%%
%% This work consists of the files spath3.dtx
%% calligraphy_doc.tex
-%% knot_doc.tex
+%% knots_doc.tex
%% and the derived files spath3.ins,
-%% spath3.pdf,
+%% spath3_code.pdf,
%% spath3.sty,
%% tikzlibrarycalligraphy.code.tex
%% tikzlibraryknots.code.tex
-%% calligraphy_doc.pdf
-%% knots_doc.pdf
-%% README.txt
+%% calligraphy.pdf
+%% knots.pdf
+%% README
%%
%%
%% End of file `spath3.sty'.
Modified: trunk/Master/texmf-dist/tex/latex/spath3/tikzlibrarycalligraphy.code.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/spath3/tikzlibrarycalligraphy.code.tex 2019-02-13 01:23:58 UTC (rev 50017)
+++ trunk/Master/texmf-dist/tex/latex/spath3/tikzlibrarycalligraphy.code.tex 2019-02-13 22:22:09 UTC (rev 50018)
@@ -806,7 +806,7 @@
}
\fi
%%
-%% Copyright (C) 2011 by Andrew Stacey <stacey at math.ntnu.no>
+%% Copyright (C) 2011-2019 by Andrew Stacey <stacey at math.ntnu.no>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
@@ -820,15 +820,15 @@
%%
%% This work consists of the files spath3.dtx
%% calligraphy_doc.tex
-%% knot_doc.tex
+%% knots_doc.tex
%% and the derived files spath3.ins,
-%% spath3.pdf,
+%% spath3_code.pdf,
%% spath3.sty,
%% tikzlibrarycalligraphy.code.tex
%% tikzlibraryknots.code.tex
-%% calligraphy_doc.pdf
-%% knots_doc.pdf
-%% README.txt
+%% calligraphy.pdf
+%% knots.pdf
+%% README
%%
%%
%% End of file `tikzlibrarycalligraphy.code.tex'.
Modified: trunk/Master/texmf-dist/tex/latex/spath3/tikzlibraryknots.code.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/spath3/tikzlibraryknots.code.tex 2019-02-13 01:23:58 UTC (rev 50017)
+++ trunk/Master/texmf-dist/tex/latex/spath3/tikzlibraryknots.code.tex 2019-02-13 22:22:09 UTC (rev 50018)
@@ -29,6 +29,8 @@
\tl_new:N \l__knot_clip_width_tl
\tl_new:N \l__knot_name_tl
\tl_new:N \l__knot_node_tl
+\tl_new:N \l__knot_aux_tl
+\tl_new:N \l__knot_auxa_tl
\int_new:N \l__knot_tmpa_int
\int_new:N \l__knot_strands_int
@@ -40,7 +42,8 @@
\dim_new:N \l__knot_tmpb_dim
\dim_new:N \l__knot_tmpc_dim
\dim_new:N \l__knot_tolerance_dim
-\dim_new:N \l__knot_clip_radius_dim
+\dim_new:N \l__knot_clip_bg_radius_dim
+\dim_new:N \l__knot_clip_draw_radius_dim
\bool_new:N \l__knot_draft_bool
\bool_new:N \l__knot_ignore_ends_bool
@@ -51,7 +54,10 @@
\bool_new:N \l__knot_prepend_prev_bool
\bool_new:N \l__knot_append_next_bool
\bool_new:N \l__knot_skip_bool
+\bool_new:N \l__knot_save_bool
+\seq_new:N \l__knot_nodes_seq
+
\bool_set_true:N \l__knot_ignore_ends_bool
\tikzset{
knot/.code={
@@ -94,8 +100,16 @@
},
background~ colour=white,
knot~ diagram,
- name/.store~in=\l__knot_name_tl,
+ name/.store~ in=\l__knot_name_tl,
name={knot},
+ save~ intersections/.is~ choice,
+ save~ intersections/.default=true,
+ save~ intersections/true/.code={
+ \bool_set_true:N \l__knot_save_bool
+ },
+ save~ intersections/false/.code={
+ \bool_set_false:N \l__knot_save_bool
+ },
every~ strand/.style={draw},
ignore~ endpoint~ intersections/.code={
\tl_if_eq:nnTF {#1} {true}
@@ -122,13 +136,26 @@
},
consider~ self~ intersections/.default={true},
clip~ radius/.code={
- \dim_set:Nn \l__knot_clip_radius_dim {#1}
+ \dim_set:Nn \l__knot_clip_bg_radius_dim {#1}
+ \dim_set:Nn \l__knot_clip_draw_radius_dim {#1+2pt}
},
+ clip~ draw~ radius/.code={
+ \dim_set:Nn \l__knot_clip_draw_radius_dim {#1}
+ },
+ clip~ background~ radius/.code={
+ \dim_set:Nn \l__knot_clip_bg_radius_dim {#1}
+ },
clip~ radius=10pt,
end~ tolerance/.code={
\dim_set:Nn \l__knot_tolerance_dim {#1}
},
end~ tolerance=14pt,
+ clip/.style={
+ clip
+ },
+ background~ clip/.style={
+ clip
+ },
clip~ width/.code={
\tl_set:Nn \l__knot_clip_width_tl {#1}
},
@@ -137,6 +164,10 @@
\tl_clear_new:c {l__knot_crossing_#1}
\tl_set:cn {l__knot_crossing_#1} {x}
},
+ ignore~ crossing/.code={%
+ \tl_clear_new:c {l__knot_ignore_crossing_#1}
+ \tl_set:cn {l__knot_ignore_crossing_#1} {x}
+ },
draft~ mode/.is~ choice,
draft~ mode/off/.code={%
\bool_set_false:N \l__knot_draft_bool
@@ -201,6 +232,7 @@
\tikzset{knot~ diagram/.cd,every~ knot~ diagram/.try,#1}
\int_zero:N \l__knot_strands_int
\tl_clear:N \l__knot_redraws_tl
+ \seq_gclear:N \l__knot_nodes_seq
}
\cs_new_protected_nopar:Npn \knot_render:
{
@@ -223,11 +255,14 @@
\int_gzero:N \l__knot_intersections_int
\bool_if:NTF \l__knot_draft_bool
{
- \tl_set:Nn \l__knot_node_tl
- {\node[coordinate,pin={[knot~ diagram/draft/crossing~ label]{\int_use:N \l__knot_intersections_int}}]}
+ \tl_set:Nn \l__knot_node_tl {
+ \exp_not:N \node[coordinate,
+ pin={[node~ contents={\int_use:N \l__knot_intersections_int},knot~ diagram/draft/crossing~ label, knot~ diagram/draft/crossing~ \int_use:N \l__knot_intersections_int \c_space_tl label/.try]
+ }]
+ }
}
{
- \tl_set:Nn \l__knot_node_tl {\node[coordinate]}
+ \tl_set:Nn \l__knot_node_tl {\exp_not:N \node[coordinate]}
}
\int_step_variable:nnnNn {1} {1} {\l__knot_tmpa_int - 1} \l__knot_tmpa_tl
{
@@ -237,6 +272,7 @@
}
}
\tl_use:N \l__knot_redraws_tl
+ \seq_use:Nn \l__knot_nodes_seq {}
}
\endpgfscope
}
@@ -363,14 +399,63 @@
\spath_get:nnN {knot \tl_use:N \l__knot_tmpa_tl} {path} \l__knot_tmpc_tl
\spath_get:nnN {knot \tl_use:N \l__knot_tmpb_tl} {path} \l__knot_tmpd_tl
- \pgfintersectionofpaths{\pgfsetpath\l__knot_tmpc_tl}{\pgfsetpath\l__knot_tmpd_tl}
+ \bool_if:nTF {
+ \l__knot_save_bool
+ &&
+ \tl_if_exist_p:c {knot~ intersections~ \tl_use:N \l__knot_name_tl - \tl_use:N \l__knot_tmpa_tl - \tl_use:N \l__knot_tmpb_tl}
+ }
+ {
+ \tl_use:c {knot~ intersections~ \tl_use:N \l__knot_name_tl - \tl_use:N \l__knot_tmpa_tl - \tl_use:N \l__knot_tmpb_tl}
+ }
+ {
+\pgfintersectionofpaths{\pgfsetpath\l__knot_tmpc_tl}{\pgfsetpath\l__knot_tmpd_tl}
+ }
\int_compare:nT {\pgfintersectionsolutions > 0}
{
\int_step_function:nnnN {1} {1} {\pgfintersectionsolutions} \knot_do_intersection:n
}
+ \knot_save_intersections:VV \l__knot_tmpa_tl \l__knot_tmpb_tl
\group_end:
}
+\cs_new_protected_nopar:Npn \knot_save_intersections:nn #1#2
+{
+ \bool_if:NT \l__knot_save_bool
+ {
+ \tl_clear:N \l__knot_aux_tl
+ \tl_put_right:Nn \l__knot_aux_tl
+ {
+ \def\pgfintersectionsolutions
+ }
+ \tl_put_right:Nx \l__knot_aux_tl
+ {
+ {\int_eval:n {\pgfintersectionsolutions}}
+ }
+ \int_compare:nT {\pgfintersectionsolutions > 0}
+ {
+ \int_step_inline:nnnn {1} {1} {\pgfintersectionsolutions}
+ {
+ \pgfpointintersectionsolution{##1}
+ \dim_set:Nn \l__knot_tmpa_dim {\pgf at x}
+ \dim_set:Nn \l__knot_tmpb_dim {\pgf at y}
+ \tl_put_right:Nn \l__knot_aux_tl
+ {
+ \expandafter\def\csname pgfpoint at intersect@solution@##1\endcsname
+ }
+ \tl_put_right:Nx \l__knot_aux_tl
+ {
+ {\exp_not:N \pgf at x=\dim_use:N \l__knot_tmpa_dim\exp_not:N\relax\exp_not:N \pgf at y =\dim_use:N \l__knot_tmpb_dim\relax}
+ }
+ }
+ \tl_set:Nn \l__knot_auxa_tl {\expandafter \gdef \csname knot~ intersections~}
+ \tl_put_right:Nx \l__knot_auxa_tl {\tl_use:N \l__knot_name_tl - #1 - #2}
+ \tl_put_right:Nn \l__knot_auxa_tl {\endcsname}
+ \tl_put_right:Nx \l__knot_auxa_tl {{\tl_to_str:N \l__knot_aux_tl}}
+ \protected at write\@auxout{}{\tl_to_str:N \l__knot_auxa_tl}
+ }
+ }
+}
+\cs_generate_variant:Nn \knot_save_intersections:nn {VV}
\cs_new_protected_nopar:Npn \knot_do_intersection:n #1
{
\pgfpointintersectionsolution{#1}
@@ -424,60 +509,58 @@
{
\int_gincr:N \l__knot_intersections_int
- \bool_if:nTF
+ \bool_if:nF
{
- \tl_if_exist_p:c {l__knot_crossing_ \int_use:N
+ \tl_if_exist_p:c {l__knot_ignore_crossing_ \int_use:N
\l__knot_intersections_int}
&&
- ! \tl_if_empty_p:c {l__knot_crossing_ \int_use:N
+ ! \tl_if_empty_p:c {l__knot_ignore_crossing_ \int_use:N
\l__knot_intersections_int}
}
{
- \tl_set_eq:NN \l__knot_tmpg_tl \l__knot_tmpb_tl
- }
- {
- \tl_set_eq:NN \l__knot_tmpg_tl \l__knot_tmpa_tl
- }
- \bool_if:NT \l__knot_self_intersections_bool
- {
- \knot_test_endpoint:VnT \l__knot_tmpg_tl {initial point}
+ \bool_if:nTF
{
- \bool_set_true:N \l__knot_prepend_prev_bool
+ \tl_if_exist_p:c {l__knot_crossing_ \int_use:N
+ \l__knot_intersections_int}
+ &&
+ ! \tl_if_empty_p:c {l__knot_crossing_ \int_use:N
+ \l__knot_intersections_int}
}
{
- \bool_set_false:N \l__knot_prepend_prev_bool
+ \tl_set_eq:NN \l__knot_tmpg_tl \l__knot_tmpb_tl
}
-
- \knot_test_endpoint:VnT \l__knot_tmpg_tl {final point}
{
- \bool_set_true:N \l__knot_append_next_bool
+ \tl_set_eq:NN \l__knot_tmpg_tl \l__knot_tmpa_tl
}
+ \bool_if:NT \l__knot_self_intersections_bool
{
- \bool_set_false:N \l__knot_append_next_bool
- }
- \bool_if:nT
- {
- \l__knot_prepend_prev_bool || \l__knot_append_next_bool
- }
- {
- \spath_clone:nn {knot \tl_use:N \l__knot_tmpg_tl}
- {knot \tl_use:N \l__knot_prefix_tl -1}
-
- \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}
-
+ \knot_test_endpoint:VnT \l__knot_tmpg_tl {initial point}
+ {
+ \bool_set_true:N \l__knot_prepend_prev_bool
+ }
+ {
+ \bool_set_false:N \l__knot_prepend_prev_bool
+ }
+ \knot_test_endpoint:VnT \l__knot_tmpg_tl {final point}
+ {
+ \bool_set_true:N \l__knot_append_next_bool
+ }
+ {
+ \bool_set_false:N \l__knot_append_next_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}
+ \l__knot_prepend_prev_bool || \l__knot_append_next_bool
}
{
- \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}}
+ \spath_clone:nn {knot \tl_use:N \l__knot_tmpg_tl}
+ {knot \tl_use:N \l__knot_prefix_tl -1}
+
+ \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_splits_bool
+ \l__knot_prepend_prev_bool
&&
\tl_if_exist_p:c {knot previous \tl_use:N \l__knot_tmpg_tl}
&&
@@ -484,53 +567,65 @@
!\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}
+ \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
{
- \spath_get:nnN {knot \tl_use:N \l__knot_prefix_tl -1} {path} \l_tmpa_tl
- \spath_prepend_no_move:nn {knot \tl_use:N \l__knot_prefix_tl -1} {knot \tl_use:c {knot previous \tl_use:c {knot previous \tl_use:N \l__knot_tmpg_tl}}}
- \spath_get:nnN {knot \tl_use:N \l__knot_prefix_tl -1} {path} \l_tmpa_tl
+ \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}
+ {
+ \spath_get:nnN {knot \tl_use:N \l__knot_prefix_tl -1} {path} \l_tmpa_tl
+ \spath_prepend_no_move:nn {knot \tl_use:N \l__knot_prefix_tl -1} {knot \tl_use:c {knot previous \tl_use:c {knot previous \tl_use:N \l__knot_tmpg_tl}}}
+ \spath_get:nnN {knot \tl_use:N \l__knot_prefix_tl -1} {path} \l_tmpa_tl
+ }
}
}
- }
- \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
+ \l__knot_append_next_bool
&&
- \tl_if_exist_p:c {knot previous \tl_use:N
- \l__knot_tmpg_tl}
+ \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}
}
{
- \knot_test_endpoint:vnT {knot previous \tl_use:N \l__knot_tmpg_tl} {final point}
+ \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
{
- \spath_append_no_move:nn {knot \tl_use:N \l__knot_prefix_tl -1} {knot \tl_use:c {knot next \tl_use:c {knot next \tl_use:N \l__knot_tmpg_tl}}}
+ \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}
+ {
+ \spath_append_no_move:nn {knot \tl_use:N \l__knot_prefix_tl -1} {knot \tl_use:c {knot next \tl_use:c {knot next \tl_use:N \l__knot_tmpg_tl}}}
+ }
}
}
+
+ \tl_set:Nn \l__knot_tmpg_tl {\tl_use:N \l__knot_prefix_tl -1}
}
-
- \tl_set:Nn \l__knot_tmpg_tl {\tl_use:N \l__knot_prefix_tl -1}
}
+ \pgfscope
+ \group_begin:
+ \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
}
- \pgfscope
- \group_begin:
- \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) {};
+ \seq_gpush:Nx \l__knot_nodes_seq { \l__knot_node_tl (\l__knot_name_tl \c_space_tl \int_use:N \l__knot_intersections_int) at (\dim_use:N \l__knot_tmpa_dim, \dim_use:N \l__knot_tmpb_dim) {};}
+
}
}
@@ -539,9 +634,9 @@
{
\dim_compare:nTF
{
- \dim_abs:n {\pgf at x - \tl_item:Nn #1 {1}}
+ \dim_abs:n { \l__knot_tmpa_dim - \tl_item:Nn #1 {1}}
+
- \dim_abs:n {\pgf at y - \tl_item:Nn #1 {2}}
+ \dim_abs:n { \l__knot_tmpb_dim - \tl_item:Nn #1 {2}}
<
\l__knot_tolerance_dim
}
@@ -571,7 +666,7 @@
{
\group_begin:
\pgfscope
- \clip (#2, #3) circle[radius=\l__knot_clip_radius_dim];
+ \path[knot~ diagram/background~ clip] (#2, #3) circle[radius=\l__knot_clip_bg_radius_dim];
\tl_set:Nn \l_tmpa_tl {knot~ diagram/every~ strand/.try,}
\tl_if_exist:cT {l__knot_options_ #1}
@@ -584,7 +679,7 @@
\endpgfscope
\pgfscope
- \clip (#2, #3) circle[radius=1.1\l__knot_clip_radius_dim];
+ \path[knot~ diagram/clip] (#2, #3) circle[radius=\l__knot_clip_draw_radius_dim];
\tl_set:Nn \l_tmpa_tl {knot~ diagram/every~ strand/.try,}
\tl_if_exist:cT {l__knot_options_ #1}
@@ -599,6 +694,12 @@
}
\cs_generate_variant:Nn \knot_draw_crossing:nnn {nVV}
+
+\cs_new_nopar:Npn \knot_draw_crossing:nn #1#2
+{
+ \tikz at scan@one at point\pgfutil at firstofone #2 \relax
+ \knot_draw_crossing:nVV {#1} \pgf at x \pgf at y
+}
\cs_new_protected_nopar:Npn \knot_split_strands:
{
\int_gzero:N \l__knot_filaments_int
@@ -654,14 +755,16 @@
\tl_set:cx {knot previous filament \int_use:N \l__knot_filaments_int} {filament \int_eval:n {\l__knot_filaments_int - 1}}
}
}
- \g__spath_close_tl
+ \g__spath_closepath_tl
{
+ \tl_show:N #2
\int_gincr:N \l__knot_filaments_int
\spath_clear_new:n {knot filament \int_use:N \l__knot_filaments_int}
- \tl_set_eq:NN \l_tmpa_tl #2
- \tl_set:Nx \l_tmpa_tl {\tl_item:Nn #2 {1}\tl_item:Nn #2 {2}\tl_item:Nn #2 {3}}
+ \tl_clear:N \l_tmpa_tl
+ \tl_put_right:Nx {\tl_item:Nn #2 {1}\tl_item:Nn #2 {2}\tl_item:Nn #2 {3}}
\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}}
+ \tl_put_right:Nx {\tl_item:Nn #2 {5}\tl_item:Nn #2 {6}}
+ \tl_show:N \l_tmpa_tl
\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}
@@ -677,10 +780,9 @@
}
\NewDocumentCommand \redraw { m m }
{
- \tikz at scan@one at point\pgfutil at firstofone #2 \relax
- \tl_put_right:Nn \l__knot_redraws_tl {\knot_draw_crossing:nnn}
+ \tl_put_right:Nn \l__knot_redraws_tl {\knot_draw_crossing:nn}
\tl_put_right:Nx \l__knot_redraws_tl {
- {strand #1} {\dim_use:N \pgf at x} {\dim_use:N \pgf at y}
+ {strand #1} {#2}% {\dim_use:N \pgf at x} {\dim_use:N \pgf at y}
}
}
\ExplSyntaxOff
@@ -888,7 +990,7 @@
}
}
%%
-%% Copyright (C) 2011 by Andrew Stacey <stacey at math.ntnu.no>
+%% Copyright (C) 2011-2019 by Andrew Stacey <stacey at math.ntnu.no>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
@@ -902,15 +1004,15 @@
%%
%% This work consists of the files spath3.dtx
%% calligraphy_doc.tex
-%% knot_doc.tex
+%% knots_doc.tex
%% and the derived files spath3.ins,
-%% spath3.pdf,
+%% spath3_code.pdf,
%% spath3.sty,
%% tikzlibrarycalligraphy.code.tex
%% tikzlibraryknots.code.tex
-%% calligraphy_doc.pdf
-%% knots_doc.pdf
-%% README.txt
+%% calligraphy.pdf
+%% knots.pdf
+%% README
%%
%%
%% End of file `tikzlibraryknots.code.tex'.
Modified: trunk/Master/tlpkg/libexec/ctan2tds
===================================================================
--- trunk/Master/tlpkg/libexec/ctan2tds 2019-02-13 01:23:58 UTC (rev 50017)
+++ trunk/Master/tlpkg/libexec/ctan2tds 2019-02-13 22:22:09 UTC (rev 50018)
@@ -772,6 +772,7 @@
'metauml', "&MAKEmetauml",
'metropolis', "die 'skipping, use beamertheme-metropolis'",
'mff', "die 'skipping, noinfo license'",
+ 'mflogo', "die 'skipping, must find logosl8.mf on CTAN'", # 11feb19
'mflogo-font', "&MAKEflatten",
'mfpic', "&MAKEcopy",
'mftoeps', "die 'skipping, bat-only (mirror.ctan.org/graphics/MF-PS)'",
More information about the tex-live-commits
mailing list