texlive[71396] Master/texmf-dist: spath3 (31may24)

commits+karl at tug.org commits+karl at tug.org
Fri May 31 23:39:19 CEST 2024


Revision: 71396
          https://tug.org/svn/texlive?view=revision&revision=71396
Author:   karl
Date:     2024-05-31 23:39:19 +0200 (Fri, 31 May 2024)
Log Message:
-----------
spath3 (31may24)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/spath3/README.txt
    trunk/Master/texmf-dist/doc/latex/spath3/spath3.pdf
    trunk/Master/texmf-dist/doc/latex/spath3/spath3.tex
    trunk/Master/texmf-dist/doc/latex/spath3/spath3_code.pdf
    trunk/Master/texmf-dist/source/latex/spath3/spath3_code.dtx
    trunk/Master/texmf-dist/source/latex/spath3/spath3_code.ins
    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/texmf-dist/tex/latex/spath3/tikzlibraryspath3.code.tex

Removed Paths:
-------------
    trunk/Master/texmf-dist/doc/latex/spath3/README

Deleted: trunk/Master/texmf-dist/doc/latex/spath3/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/spath3/README	2024-05-31 21:38:50 UTC (rev 71395)
+++ trunk/Master/texmf-dist/doc/latex/spath3/README	2024-05-31 21:39:19 UTC (rev 71396)
@@ -1,9 +0,0 @@
-----------------------------------------------------------------
-spath3 --- LaTeX3 functions for manipulating PGF soft paths
-E-mail: loopspace at mathforge.org
-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.

Modified: trunk/Master/texmf-dist/doc/latex/spath3/README.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex/spath3/README.txt	2024-05-31 21:38:50 UTC (rev 71395)
+++ trunk/Master/texmf-dist/doc/latex/spath3/README.txt	2024-05-31 21:39:19 UTC (rev 71396)
@@ -1,6 +1,6 @@
 ----------------------------------------------------------------
 spath3 --- LaTeX3 functions for manipulating PGF soft paths
-E-mail: loopspace at mathforge.org
+E-mail: Andrew Stacey <loopspace at mathforge.org>
 Released under the LaTeX Project Public License v1.3c or later
 See http://www.latex-project.org/lppl.txt
 ----------------------------------------------------------------

Modified: trunk/Master/texmf-dist/doc/latex/spath3/spath3.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/spath3/spath3.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/spath3/spath3.tex	2024-05-31 21:38:50 UTC (rev 71395)
+++ trunk/Master/texmf-dist/doc/latex/spath3/spath3.tex	2024-05-31 21:39:19 UTC (rev 71396)
@@ -1,5 +1,5 @@
 \RequirePackage{shellesc}
-\immediate\write18{tex spath3_code.dtx}
+%\immediate\write18{tex spath3_code.dtx}
 \documentclass{l3doc}
 \usepackage{tikz}
 \usetikzlibrary{
@@ -50,27 +50,29 @@
 
 \title{The \textsf{spath3} Package: Documentation}
 \author{Andrew Stacey \\ \url{loopspace at mathforge.org}}
-  \date{\fileversion~from \filedate}
+\date{\fileversion~from \filedate}
 
-  \begin{document}
+\let\OriginalBar=|
 
-  \maketitle
+\begin{document}
 
+\maketitle
+
 \tableofcontents
 
-  \section{Introduction}
+\section{Introduction}
 
-  The \texttt{spath3} package was originally designed as a low-level package for manipulating the \emph{soft paths} defined by PGF/TikZ.
-  Soft paths form one stage of the stack of translations between what the author writes in the \texttt{tikzpicture} environments in their \LaTeX\ document and what is eventually written to the output file.
-  Most of the complicated processing has been done by the time a soft path is constructed, but it is still very definitely a \TeX\ object and there has not, for example, been any consideration as to what the eventual output file format is (such as PDF, DVI, or SVG).
-  So it is very amenable to being modified at this stage and this package provides a set of routines for doing so.
+The \texttt{spath3} package was originally designed as a low-level package for manipulating the \emph{soft paths} defined by PGF/TikZ.
+Soft paths form one stage of the stack of translations between what the author writes in the \texttt{tikzpicture} environments in their \LaTeX\ document and what is eventually written to the output file.
+Most of the complicated processing has been done by the time a soft path is constructed, but it is still very definitely a \TeX\ object and there has not, for example, been any consideration as to what the eventual output file format is (such as PDF, DVI, or SVG).
+So it is very amenable to being modified at this stage and this package provides a set of routines for doing so.
 
-  The original purpose was to provide a common core on which other packages would be built.
-  Indeed, the packages \texttt{calligraphy}, \texttt{knots}, and \texttt{penrose} all use this package.
-  However, over time I've found myself wanting to use the routines of this package at a higher level and so have designed some user-level interfaces.
-  This document documents those.
+The original purpose was to provide a common core on which other packages would be built.
+Indeed, the packages \texttt{calligraphy}, \texttt{knots}, and \texttt{tilings} all use this package.
+However, over time I've found myself wanting to use the routines of this package at a higher level and so have designed some user-level interfaces.
+This document documents those.
 
-  To clarify some terminology used in this document (and more generally, this package), I regard paths as being composed of \emph{segments} and \emph{components}.
+To clarify some terminology used in this document (and more generally, this package), I regard paths as being composed of \emph{segments} and \emph{components}.
 A \emph{segment} is a minimal drawing piece.
 Thus it might be a straight line or a B\'ezier curve.
 A \emph{component} is a minimal connected section of the path.
@@ -634,6 +636,24 @@
 
 \end{function}
 
+\begin{function}{
+  arrow shortening
+}
+\begin{syntax}
+|arrow shortening|
+|arrow shortening=|\marg{true{\OriginalBar}false}
+\end{syntax}
+
+When an arrow is added to a path then the path is shortened so that the arrow tip is at the end of where the path should end up.
+Placing an arrow, therefore, has two effects: modifying the path and rendering the arrow.
+The former should happen before a soft path is manipulated, the latter afterwards.
+This key allows for the necessary separation to occur.
+Invoking it when the path is used disables the shortening at that juncture.
+
+Note that if the path (or its last segment) is very short then when the arrow is eventually placed it may end up pointing backwards.
+Fixing this is on the \emph{ToDo} list!
+\end{function}
+
 \subsection{Exporting Paths}
 
 There are two keys to export a path.
@@ -908,6 +928,21 @@
 \end{tikzpicture}
 \end{example}
 
+\begin{example}
+\begin{tikzpicture}[>=Latex, line width=5pt]
+% Just a simple line
+\draw (0,1) to[bend left] +(5,0);
+% Same line but with arrows, also save the path
+\draw[->.>, spath/save=arrow] (0,0) to[bend left] +(5,0);
+% Let's redraw that path without the arrows - it's short! But also distorted
+\draw[spath/use={arrow,transform={yshift=-1cm}}];
+% So if we redraw it with arrows it gets doubly shortened
+\draw[->.>,spath/use={arrow,transform={yshift=-2cm}}];
+% If we disable the shortening, the arrows end up in the right place
+\draw[->.>,spath/use={arrow,transform={yshift=-3cm}}, spath/arrow shortening=false];
+\end{tikzpicture}
+\end{example}
+
 \item Intersections.
 
 One of the main motivations for implementing the intersection routines was to provide a different way of drawing knots and links and similar diagrams.

Modified: trunk/Master/texmf-dist/doc/latex/spath3/spath3_code.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/spath3/spath3_code.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/spath3/spath3_code.dtx	2024-05-31 21:38:50 UTC (rev 71395)
+++ trunk/Master/texmf-dist/source/latex/spath3/spath3_code.dtx	2024-05-31 21:39:19 UTC (rev 71396)
@@ -5,7 +5,7 @@
 %<*readme>
 ----------------------------------------------------------------
 spath3 --- LaTeX3 functions for manipulating PGF soft paths
-E-mail: loopspace at mathforge.org
+E-mail: Andrew Stacey <loopspace at mathforge.org>
 Released under the LaTeX Project Public License v1.3c or later
 See http://www.latex-project.org/lppl.txt
 ----------------------------------------------------------------
@@ -27,7 +27,7 @@
 \preamble
 ----------------------------------------------------------------
 spath3 --- Functions for manipulating PGF soft paths
-E-mail: loopspace at mathforge.org
+E-mail: Andrew Stacey <loopspace at mathforge.org>
 Released under the LaTeX Project Public License v1.3c or later
 See http://www.latex-project.org/lppl.txt
 ----------------------------------------------------------------
@@ -35,7 +35,7 @@
 \endpreamble
 \postamble
 
-Copyright (C) 2011-2021 by Andrew Stacey <loopspace at mathforge.org>
+Copyright (C) 2011-2024 by Andrew Stacey <loopspace at mathforge.org>
 
 This work may be distributed and/or modified under the
 conditions of the LaTeX Project Public License (LPPL), either
@@ -60,7 +60,7 @@
                                  calligraphy.pdf
                                  knots.pdf
                                  spath3.pdf
-                                 README
+                                 README.txt
 
 \endpostamble
 \usedir{tex/latex/spath3}
@@ -143,7 +143,7 @@
 %</driver>
 % \fi
 %
-% \CheckSum{10189}
+% \CheckSum{10278}
 %
 % \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
@@ -171,6 +171,7 @@
 % \changes{2.4}{2021/02/21}{Rejigged how the routines for using paths were implemented, added some more routines for joining paths.}
 % \changes{2.6}{2021/11/23}{Modified core routines to cope with a "true rectangle" path; added routines for splitting at a parametrised point.}
 % \changes{2.7}{2022/08/24}{Bug fixes}
+% \changes{2.8}{2024/05/31}{Routine to disable arrow shortening, bug fixes}
 %
 % \DoNotIndex{\newcommand,\newenvironment}
 %
@@ -198,7 +199,7 @@
 % It was originally not really intended for use by end users but as a foundation on which other packages can be built.
 % However, over the years I've found myself using it at ever higher levels and so a set of interfaces has been designed using TikZ keys.
 %
-% It also provides the engine that drives a few other packages, such as the  \Verb+calligraphy+, \Verb+knot+, and \Verb+penrose+ packages.
+% It also provides the engine that drives a few other packages, such as the  \Verb+calligraphy+, \Verb+knot+, and \Verb+tilings+ (formerly, \Verb+penrose+) packages.
 % The first two of these are subpackages of this one.
 % The \Verb+calligraphy+ package simulates a calligraphic pen stroking a path.
 % The \Verb+knots+ package can be used to draw knot (and similar) diagrams.
@@ -208,7 +209,7 @@
 % \begin{itemize}
 % \item \Verb+calligraphy+
 % \item \Verb+knots+
-% \item \Verb+penrose+
+% \item \Verb+tilings+ 
 % \item \Verb+spath3+ (\emph{this} document is the code, there's another which focusses on usage)
 % \end{itemize}
 %
@@ -259,7 +260,7 @@
 \NeedsTeXFormat{LaTeX2e}
 \RequirePackage{expl3}
 \RequirePackage{pgf}
-\ProvidesExplPackage {spath3} {2022/08/24} {2.7} {Functions for
+\ProvidesExplPackage {spath3} {2024/05/31} {2.8} {Functions for
 manipulating PGF soft paths}
 \RequirePackage{xparse}
 %    \end{macrocode}
@@ -375,6 +376,13 @@
 \bool_new:N \l_spath_movetorelevant_bool
 %    \end{macrocode}
 %
+% When manipulating soft paths, we might need to separate the shortening due to an arrow from when the path is rendered.
+%
+%    \begin{macrocode}
+\bool_new:N \l_spath_arrow_shortening_bool
+\bool_set_true:N \l_spath_arrow_shortening_bool
+%    \end{macrocode}
+%
 % The intersection routine can't happen inside a group so we need two token lists to hold the paths that we'll intersect.
 %
 %    \begin{macrocode}
@@ -457,7 +465,7 @@
   {
     \tl_set:Nx \l_@@_tmpc_tl {\tl_head:N \l_@@_tmpa_tl}
     \tl_set:Nx \l_@@_tmpa_tl {\tl_tail:N \l_@@_tmpa_tl}
-    \tl_case:NnF \l_@@_tmpc_tl
+    \token_case_meaning:NnF \l_@@_tmpc_tl
     {
       \c_spath_moveto_tl
       {
@@ -718,7 +726,7 @@
   \int_set:Nn \l_@@_tmpa_int {0}
   \tl_map_inline:nn {#1} {
     \tl_set:Nn \l_@@_tmpa_tl {##1}
-    \tl_case:NnT \l_@@_tmpa_tl
+    \token_case_meaning:NnT \l_@@_tmpa_tl
     {
       \c_spath_lineto_tl {}
       \c_spath_curveto_tl {}
@@ -763,7 +771,7 @@
   \int_set:Nn \l_@@_tmpa_int {0}
   \tl_map_inline:nn {#1} {
     \tl_set:Nn \l_@@_tmpa_tl {##1}
-    \tl_case:Nn \l_@@_tmpa_tl
+    \token_case_meaning:Nn \l_@@_tmpa_tl
     {
       \c_spath_moveto_tl
       {
@@ -910,7 +918,7 @@
   }
   {
     \tl_set:Nx \l_@@_tmpb_tl {\tl_head:N \l_@@_tmpa_tl}
-    \tl_case:Nn \l_@@_tmpb_tl
+    \token_case_meaning:Nn \l_@@_tmpb_tl
     {
       \c_spath_moveto_tl
       {
@@ -1102,7 +1110,7 @@
   }
   {
     \tl_set:Nx \l_@@_tmpb_tl {\tl_head:N \l_@@_tmpa_tl}
-    \tl_case:Nn \l_@@_tmpb_tl
+    \token_case_meaning:Nn \l_@@_tmpb_tl
     {
       \c_spath_moveto_tl
       {
@@ -1229,7 +1237,7 @@
       \tl_set:Nx \l_@@_tmpc_tl {\tl_head:N \l_@@_tmpa_tl}
       \bool_set_false:N \l_@@_rect_bool
 
-      \tl_case:NnTF \l_@@_tmpc_tl
+      \token_case_meaning:NnTF \l_@@_tmpc_tl
       {
         \c_spath_moveto_tl {
         
@@ -1679,8 +1687,8 @@
     \tl_clear:N \l_@@_tmpa_tl
     \tl_put_right:Nn \l_@@_tmpa_tl {
       \ExplSyntaxOn
-      \tl_clear_new:N #1
-      \tl_set:Nn #1 {#2}
+      \tl_gclear_new:N #1
+      \tl_gset:Nn #1 {#2}
       \ExplSyntaxOff
     }
     \protected at write\@auxout{}{
@@ -3054,6 +3062,35 @@
 }
 \cs_generate_variant:Nn \spath_gbake_shorten:N {c}
 %    \end{macrocode}
+%
+% Shortening the path when it is baked can cause issues with arrows.
+% Putting an arrow in a path definition affects the path because the path gets shortened so that the arrow ends where the path was meant to end.
+% So an arrow affects the path definition, but the arrow is not itself part of the path so if an arrow is used when the path is defined and again when the path is used, the path will be shortened twice which might not be what is intended.
+% Therefore it is useful to have a way to disable the shortening and place an arrow tip at the actual end of the line.
+% The following code achieves that.
+%
+% Save the original command that computes the arrow shortening.
+%    \begin{macrocode}
+\cs_set_eq:Nc \@@_pgf_arrow_compute_shortening:n {pgf at arrow@compute at shortening}
+%    \end{macrocode}
+%
+% After \verb+\pgf at arrow@compute at shortening+ then \verb+\pgf at xa+ is the amount to shorten the line by, so we will be setting that to 0pt.
+% Then \verb+\pgf at xb+ is the length of the arrow head which is used to position the arrow and so before zeroing \verb+\pgf at xa+ we subtract it from \verb+\pgf at xb+ so that the arrow is placed so that its back point is at the current position.
+%
+%    \begin{macrocode}
+\cs_new_nopar:Npn \@@_arrow_compute_shortening:n #1
+{
+  \@@_pgf_arrow_compute_shortening:n {#1}
+  \bool_if:NF \l_spath_arrow_shortening_bool
+  {
+    \dim_sub:cn {pgf at xb} {\dim_use:c {pgf at xa}}
+    \dim_zero:c {pgf at xa}
+  }
+}
+
+\cs_set_eq:cN {pgf at arrow@compute at shortening} \@@_arrow_compute_shortening:n
+%    \end{macrocode}
+%
 % \end{macro}
 %
 % \begin{macro}[internal]{
@@ -3209,7 +3246,7 @@
     \tl_set:Nx \l_@@_tmpc_tl {\tl_head:N \l_@@_tmpa_tl}
     \tl_set:Nx \l_@@_tmpa_tl {\tl_tail:N \l_@@_tmpa_tl}
 
-    \tl_case:NnF \l_@@_tmpc_tl
+    \token_case_meaning:NnF \l_@@_tmpc_tl
     {
       \c_spath_closepath_tl {
 
@@ -3930,7 +3967,7 @@
   }
   {
     \tl_set:Nx \l_@@_tmpc_tl {\tl_head:N \l_@@_tmpa_tl}
-    \tl_case:NnF \l_@@_tmpc_tl
+    \token_case_meaning:NnF \l_@@_tmpc_tl
     {
       \c_spath_curvetoa_tl
       {
@@ -4225,7 +4262,7 @@
   {
     \tl_set:Nx \l_@@_tmpf_tl {\tl_head:N \l_@@_tmpe_tl}
     \tl_set:Nx \l_@@_tmpe_tl {\tl_tail:N \l_@@_tmpe_tl }
-    \tl_case:Nn \l_@@_tmpf_tl
+    \token_case_meaning:Nn \l_@@_tmpf_tl
     {
       \c_spath_lineto_tl
       {
@@ -4279,7 +4316,7 @@
   }
   {
 
-    \tl_case:Nn \l_@@_tmpf_tl
+    \token_case_meaning:Nn \l_@@_tmpf_tl
     {
       \c_spath_lineto_tl
       {
@@ -5018,7 +5055,7 @@
 
       \tl_clear:N \l_@@_tmpc_tl
   
-      \tl_case:Nn \l_@@_tmpb_tl
+      \token_case_meaning:Nn \l_@@_tmpb_tl
       {
         \c_spath_moveto_tl
         {
@@ -5263,7 +5300,7 @@
 
       \tl_clear:N \l_@@_tmpc_tl
   
-      \tl_case:Nn \l_@@_tmpb_tl
+      \token_case_meaning:Nn \l_@@_tmpb_tl
       {
         \c_spath_moveto_tl
         {
@@ -6383,7 +6420,7 @@
   \tl_map_inline:nn {#1}
   {
     \tl_set:Nn \l_@@_tmpb_tl {##1}
-    \tl_case:NnF \l_@@_tmpb_tl
+    \token_case_meaning:NnF \l_@@_tmpb_tl
     {
       \c_spath_moveto_tl
       {
@@ -6516,10 +6553,14 @@
 \cs_new_protected_nopar:Npn \spath_protocol_path:n #1
 {
   \spath_minbb:Nn \l_@@_tmpa_tl {#1}
-  \exp_last_unbraced:NV \pgf at protocolsizes\l_@@_tmpa_tl
+  \dim_set:Nn \l_@@_tmpa_dim {\tl_item:Nn \l_@@_tmpa_tl {1}}
+  \dim_set:Nn \l_@@_tmpb_dim {\tl_item:Nn \l_@@_tmpa_tl {2}}
+  \pgf at protocolsizes\l_@@_tmpa_dim\l_@@_tmpb_dim
 
   \spath_maxbb:Nn \l_@@_tmpa_tl {#1}
-  \exp_last_unbraced:NV \pgf at protocolsizes\l_@@_tmpa_tl
+  \dim_set:Nn \l_@@_tmpa_dim {\tl_item:Nn \l_@@_tmpa_tl {1}}
+  \dim_set:Nn \l_@@_tmpb_dim {\tl_item:Nn \l_@@_tmpa_tl {2}}
+  \pgf at protocolsizes\l_@@_tmpa_dim\l_@@_tmpb_dim
 }
 \cs_generate_variant:Nn \spath_protocol_path:n {V}
 %    \end{macrocode}
@@ -6880,7 +6921,7 @@
     }
   }
   {
-    \msg_warning:nnn { spath3 } { missing soft path } { #2 }
+    \msg_warning:nnx { spath3 } { missing soft path } { #2 }
   }
   \tl_use:N \l_@@_check_tl
 }
@@ -9027,13 +9068,9 @@
 % This puts a conditional around the \texttt{spot weld} key because when figuring out a knot drawing then we will initially want to render it without the spot weld to keep the number of components constant.
 %
 %    \begin{macrocode}
-  draft~ mode/.is~ choice,
-  draft~ mode/true/.code={
-    \bool_set_true:N \l_@@_draft_bool
+  draft~ mode/.code={
+    \@@_set_bool:Nn \l_@@_draft_bool {#1}
   },
-  draft~ mode/false/.code={
-    \bool_set_false:N \l_@@_draft_bool
-  },
   maybe~ spot~ weld/.code={
     \bool_if:NF \l_@@_draft_bool
     {
@@ -9113,6 +9150,12 @@
   },
 %    \end{macrocode}
 %
+%    \begin{macrocode}
+  arrow~ shortening/.code={
+    \@@_set_bool:Nn \l_spath_arrow_shortening_bool {#1}
+  },
+%    \end{macrocode}  
+%
 % For single argument commands which take a path as their argument, set the default to be \Verb+current+ so that they use the current path.
 %
 %    \begin{macrocode}
@@ -9616,7 +9659,7 @@
     \dim_set:Nn \l_@@_tmpb_dim {\tl_item:Nn \l_@@_tmpa_tl {3}}
     \tl_set:Nx \l_@@_tmpb_tl {\tl_item:Nn \l_@@_tmpa_tl {4}}
 
-    \tl_case:NnF \l_@@_tmpb_tl
+    \token_case_meaning:NnF \l_@@_tmpb_tl
     {
       \c_spath_lineto_tl
       {
@@ -9668,7 +9711,7 @@
     \dim_set:Nn \l_@@_tmpb_dim {\tl_item:Nn \l_@@_tmpa_tl {-1}}
     \tl_set:Nx \l_@@_tmpb_tl {\tl_item:Nn \l_@@_tmpa_tl {-3}}
 
-    \tl_case:NnF \l_@@_tmpb_tl
+    \token_case_meaning:NnF \l_@@_tmpb_tl
     {
       \c_spath_lineto_tl
       {
@@ -10411,6 +10454,15 @@
   }
 }
 
+\cs_new_nopar:Npn \knot_show_strand:n #1
+{
+  \bool_if:NT \l_@@_debugging_bool
+  {
+    \iow_term:n {===Knot~ debug: #1===}
+    \spath_show:v {knot #1}
+  }
+}
+
 \cs_generate_variant:Nn \knot_debug:n {x}
 %    \end{macrocode}
 % \end{macro}
@@ -10592,6 +10644,7 @@
     knot~ diagram/only~ when~ rendering/.try,
     only~ when~ rendering/.try,
   }
+  \knot_show_strand:n {strand #1}
   \spath_tikz_path:Vv \l_@@_tmpa_tl {knot strand #1}
   \group_end:
   \endpgfscope
@@ -10629,6 +10682,7 @@
   }
   {
     \tl_clear:N \l_@@_tmpa_tl
+    \spath_remove_empty_components:c {knot strand #1}
     \spath_initialpoint:Nv \l_@@_tmpa_tl {knot strand #1}
     \tl_put_left:NV \l_@@_tmpa_tl \c_spath_moveto_tl
     \spath_segments_to_seq:Nv \l_@@_segments_seq {knot strand #1}
@@ -10649,7 +10703,7 @@
 {
   \knot_debug:n {knot~ split~ self~ intersects}
   \tl_set:Nx \l_@@_tmpc_tl {\tl_item:nn {#1} {4}}
-  \tl_case:NnF \l_@@_tmpc_tl
+  \token_case_meaning:NnF \l_@@_tmpc_tl
   {
     \c_spath_curvetoa_tl
     {
@@ -11271,6 +11325,7 @@
   \int_set_eq:NN \l_@@_component_start_int \g_@@_filaments_int
   \int_incr:N \l_@@_component_start_int
   \tl_set_eq:Nc \l_@@_tmpa_tl {l_@@_options_strand #1}
+  \spath_remove_empty_components:c {knot strand #1}
   \spath_segments_to_seq:Nv \l_@@_segments_seq {knot strand #1}
   \seq_map_function:NN \l_@@_segments_seq \knot_save_filament:N
 }
@@ -11284,7 +11339,7 @@
 {
   \knot_debug:n {knot~ save~ filament}
   \tl_set:Nx \l_@@_tmpb_tl {\tl_item:nn {#1} {4}}
-  \tl_case:NnF \l_@@_tmpb_tl
+  \token_case_meaning:NnF \l_@@_tmpb_tl
   {
     \c_spath_moveto_tl
     {

Modified: trunk/Master/texmf-dist/source/latex/spath3/spath3_code.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/spath3/spath3_code.ins	2024-05-31 21:38:50 UTC (rev 71395)
+++ trunk/Master/texmf-dist/source/latex/spath3/spath3_code.ins	2024-05-31 21:39:19 UTC (rev 71396)
@@ -7,7 +7,7 @@
 %% spath3_code.dtx  (with options: `install')
 %% ----------------------------------------------------------------
 %% spath3 --- Functions for manipulating PGF soft paths
-%% E-mail: loopspace at mathforge.org
+%% E-mail: Andrew Stacey <loopspace at mathforge.org>
 %% Released under the LaTeX Project Public License v1.3c or later
 %% See http://www.latex-project.org/lppl.txt
 %% ----------------------------------------------------------------
@@ -18,7 +18,7 @@
 \preamble
 ----------------------------------------------------------------
 spath3 --- Functions for manipulating PGF soft paths
-E-mail: loopspace at mathforge.org
+E-mail: Andrew Stacey <loopspace at mathforge.org>
 Released under the LaTeX Project Public License v1.3c or later
 See http://www.latex-project.org/lppl.txt
 ----------------------------------------------------------------
@@ -26,7 +26,7 @@
 \endpreamble
 \postamble
 
-Copyright (C) 2011-2021 by Andrew Stacey <loopspace at mathforge.org>
+Copyright (C) 2011-2024 by Andrew Stacey <loopspace at mathforge.org>
 
 This work may be distributed and/or modified under the
 conditions of the LaTeX Project Public License (LPPL), either
@@ -51,7 +51,7 @@
                                  calligraphy.pdf
                                  knots.pdf
                                  spath3.pdf
-                                 README
+                                 README.txt
 
 \endpostamble
 \usedir{tex/latex/spath3}
@@ -69,7 +69,7 @@
 }
 \endbatchfile
 %% 
-%% Copyright (C) 2011-2021 by Andrew Stacey <loopspace at mathforge.org>
+%% Copyright (C) 2011-2024 by Andrew Stacey <loopspace at mathforge.org>
 %% 
 %% This work may be distributed and/or modified under the
 %% conditions of the LaTeX Project Public License (LPPL), either
@@ -94,7 +94,7 @@
 %%                                  calligraphy.pdf
 %%                                  knots.pdf
 %%                                  spath3.pdf
-%%                                  README
+%%                                  README.txt
 %% 
 %%
 %% End of file `spath3_code.ins'.

Modified: trunk/Master/texmf-dist/tex/latex/spath3/spath3.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/spath3/spath3.sty	2024-05-31 21:38:50 UTC (rev 71395)
+++ trunk/Master/texmf-dist/tex/latex/spath3/spath3.sty	2024-05-31 21:39:19 UTC (rev 71396)
@@ -7,7 +7,7 @@
 %% spath3_code.dtx  (with options: `spath3')
 %% ----------------------------------------------------------------
 %% spath3 --- Functions for manipulating PGF soft paths
-%% E-mail: loopspace at mathforge.org
+%% E-mail: Andrew Stacey <loopspace at mathforge.org>
 %% Released under the LaTeX Project Public License v1.3c or later
 %% See http://www.latex-project.org/lppl.txt
 %% ----------------------------------------------------------------
@@ -15,7 +15,7 @@
 \NeedsTeXFormat{LaTeX2e}
 \RequirePackage{expl3}
 \RequirePackage{pgf}
-\ProvidesExplPackage {spath3} {2022/08/24} {2.7} {Functions for
+\ProvidesExplPackage {spath3} {2024/05/31} {2.8} {Functions for
 manipulating PGF soft paths}
 \RequirePackage{xparse}
 \cs_new_protected:Nn \__spath_tl_put_right_braced:Nn
@@ -80,6 +80,8 @@
 
 \bool_new:N \l__spath_rect_bool
 \bool_new:N \l_spath_movetorelevant_bool
+\bool_new:N \l_spath_arrow_shortening_bool
+\bool_set_true:N \l_spath_arrow_shortening_bool
 \tl_new:N \l__spath_intersecta_tl
 \tl_new:N \l__spath_intersectb_tl
 \tl_const:Nn \c_spath_moveto_tl {\pgfsyssoftpath at movetotoken}
@@ -121,7 +123,7 @@
   {
     \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:NnF \l__spath_tmpc_tl
+    \token_case_meaning:NnF \l__spath_tmpc_tl
     {
       \c_spath_moveto_tl
       {
@@ -355,7 +357,7 @@
   \int_set:Nn \l__spath_tmpa_int {0}
   \tl_map_inline:nn {#1} {
     \tl_set:Nn \l__spath_tmpa_tl {##1}
-    \tl_case:NnT \l__spath_tmpa_tl
+    \token_case_meaning:NnT \l__spath_tmpa_tl
     {
       \c_spath_lineto_tl {}
       \c_spath_curveto_tl {}
@@ -390,7 +392,7 @@
   \int_set:Nn \l__spath_tmpa_int {0}
   \tl_map_inline:nn {#1} {
     \tl_set:Nn \l__spath_tmpa_tl {##1}
-    \tl_case:Nn \l__spath_tmpa_tl
+    \token_case_meaning:Nn \l__spath_tmpa_tl
     {
       \c_spath_moveto_tl
       {
@@ -510,7 +512,7 @@
   }
   {
     \tl_set:Nx \l__spath_tmpb_tl {\tl_head:N \l__spath_tmpa_tl}
-    \tl_case:Nn \l__spath_tmpb_tl
+    \token_case_meaning:Nn \l__spath_tmpb_tl
     {
       \c_spath_moveto_tl
       {
@@ -674,7 +676,7 @@
   }
   {
     \tl_set:Nx \l__spath_tmpb_tl {\tl_head:N \l__spath_tmpa_tl}
-    \tl_case:Nn \l__spath_tmpb_tl
+    \token_case_meaning:Nn \l__spath_tmpb_tl
     {
       \c_spath_moveto_tl
       {
@@ -792,7 +794,7 @@
       \tl_set:Nx \l__spath_tmpc_tl {\tl_head:N \l__spath_tmpa_tl}
       \bool_set_false:N \l__spath_rect_bool
 
-      \tl_case:NnTF \l__spath_tmpc_tl
+      \token_case_meaning:NnTF \l__spath_tmpc_tl
       {
         \c_spath_moveto_tl {
 
@@ -1196,8 +1198,8 @@
     \tl_clear:N \l__spath_tmpa_tl
     \tl_put_right:Nn \l__spath_tmpa_tl {
       \ExplSyntaxOn
-      \tl_clear_new:N #1
-      \tl_set:Nn #1 {#2}
+      \tl_gclear_new:N #1
+      \tl_gset:Nn #1 {#2}
       \ExplSyntaxOff
     }
     \protected at write\@auxout{}{
@@ -2339,6 +2341,18 @@
   \spath_gbake_shorten:NV #1#1
 }
 \cs_generate_variant:Nn \spath_gbake_shorten:N {c}
+\cs_set_eq:Nc \__spath_pgf_arrow_compute_shortening:n {pgf at arrow@compute at shortening}
+\cs_new_nopar:Npn \__spath_arrow_compute_shortening:n #1
+{
+  \__spath_pgf_arrow_compute_shortening:n {#1}
+  \bool_if:NF \l_spath_arrow_shortening_bool
+  {
+    \dim_sub:cn {pgf at xb} {\dim_use:c {pgf at xa}}
+    \dim_zero:c {pgf at xa}
+  }
+}
+
+\cs_set_eq:cN {pgf at arrow@compute at shortening} \__spath_arrow_compute_shortening:n
 \cs_new_protected_nopar:Npn \__spath_close:n #1
 {
   \group_begin:
@@ -2459,7 +2473,7 @@
     \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:NnF \l__spath_tmpc_tl
+    \token_case_meaning:NnF \l__spath_tmpc_tl
     {
       \c_spath_closepath_tl {
 
@@ -3108,7 +3122,7 @@
   }
   {
     \tl_set:Nx \l__spath_tmpc_tl {\tl_head:N \l__spath_tmpa_tl}
-    \tl_case:NnF \l__spath_tmpc_tl
+    \token_case_meaning:NnF \l__spath_tmpc_tl
     {
       \c_spath_curvetoa_tl
       {
@@ -3346,7 +3360,7 @@
   {
     \tl_set:Nx \l__spath_tmpf_tl {\tl_head:N \l__spath_tmpe_tl}
     \tl_set:Nx \l__spath_tmpe_tl {\tl_tail:N \l__spath_tmpe_tl }
-    \tl_case:Nn \l__spath_tmpf_tl
+    \token_case_meaning:Nn \l__spath_tmpf_tl
     {
       \c_spath_lineto_tl
       {
@@ -3400,7 +3414,7 @@
   }
   {
 
-    \tl_case:Nn \l__spath_tmpf_tl
+    \token_case_meaning:Nn \l__spath_tmpf_tl
     {
       \c_spath_lineto_tl
       {
@@ -4078,7 +4092,7 @@
 
       \tl_clear:N \l__spath_tmpc_tl
 
-      \tl_case:Nn \l__spath_tmpb_tl
+      \token_case_meaning:Nn \l__spath_tmpb_tl
       {
         \c_spath_moveto_tl
         {
@@ -4312,7 +4326,7 @@
 
       \tl_clear:N \l__spath_tmpc_tl
 
-      \tl_case:Nn \l__spath_tmpb_tl
+      \token_case_meaning:Nn \l__spath_tmpb_tl
       {
         \c_spath_moveto_tl
         {
@@ -5317,7 +5331,7 @@
   \tl_map_inline:nn {#1}
   {
     \tl_set:Nn \l__spath_tmpb_tl {##1}
-    \tl_case:NnF \l__spath_tmpb_tl
+    \token_case_meaning:NnF \l__spath_tmpb_tl
     {
       \c_spath_moveto_tl
       {
@@ -5414,10 +5428,14 @@
 \cs_new_protected_nopar:Npn \spath_protocol_path:n #1
 {
   \spath_minbb:Nn \l__spath_tmpa_tl {#1}
-  \exp_last_unbraced:NV \pgf at protocolsizes\l__spath_tmpa_tl
+  \dim_set:Nn \l__spath_tmpa_dim {\tl_item:Nn \l__spath_tmpa_tl {1}}
+  \dim_set:Nn \l__spath_tmpb_dim {\tl_item:Nn \l__spath_tmpa_tl {2}}
+  \pgf at protocolsizes\l__spath_tmpa_dim\l__spath_tmpb_dim
 
   \spath_maxbb:Nn \l__spath_tmpa_tl {#1}
-  \exp_last_unbraced:NV \pgf at protocolsizes\l__spath_tmpa_tl
+  \dim_set:Nn \l__spath_tmpa_dim {\tl_item:Nn \l__spath_tmpa_tl {1}}
+  \dim_set:Nn \l__spath_tmpb_dim {\tl_item:Nn \l__spath_tmpa_tl {2}}
+  \pgf at protocolsizes\l__spath_tmpa_dim\l__spath_tmpb_dim
 }
 \cs_generate_variant:Nn \spath_protocol_path:n {V}
 \cs_new_protected_nopar:Npn \spath_set_current_path:n #1
@@ -5549,7 +5567,7 @@
 }
 \cs_generate_variant:Nn \spath_set_tikz_data:n {V, v}
 %% 
-%% Copyright (C) 2011-2021 by Andrew Stacey <loopspace at mathforge.org>
+%% Copyright (C) 2011-2024 by Andrew Stacey <loopspace at mathforge.org>
 %% 
 %% This work may be distributed and/or modified under the
 %% conditions of the LaTeX Project Public License (LPPL), either
@@ -5574,7 +5592,7 @@
 %%                                  calligraphy.pdf
 %%                                  knots.pdf
 %%                                  spath3.pdf
-%%                                  README
+%%                                  README.txt
 %% 
 %%
 %% 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	2024-05-31 21:38:50 UTC (rev 71395)
+++ trunk/Master/texmf-dist/tex/latex/spath3/tikzlibrarycalligraphy.code.tex	2024-05-31 21:39:19 UTC (rev 71396)
@@ -7,7 +7,7 @@
 %% spath3_code.dtx  (with options: `calligraphy')
 %% ----------------------------------------------------------------
 %% spath3 --- Functions for manipulating PGF soft paths
-%% E-mail: loopspace at mathforge.org
+%% E-mail: Andrew Stacey <loopspace at mathforge.org>
 %% Released under the LaTeX Project Public License v1.3c or later
 %% See http://www.latex-project.org/lppl.txt
 %% ----------------------------------------------------------------
@@ -374,7 +374,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:NnF \l__cal_tmpb_tl
+    \token_case_meaning:NnF \l__cal_tmpb_tl
     {
       \c_spath_lineto_tl
       {
@@ -426,7 +426,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:NnF \l__cal_tmpb_tl
+    \token_case_meaning:NnF \l__cal_tmpb_tl
     {
       \c_spath_lineto_tl
       {
@@ -885,7 +885,7 @@
 }
 \fi
 %% 
-%% Copyright (C) 2011-2021 by Andrew Stacey <loopspace at mathforge.org>
+%% Copyright (C) 2011-2024 by Andrew Stacey <loopspace at mathforge.org>
 %% 
 %% This work may be distributed and/or modified under the
 %% conditions of the LaTeX Project Public License (LPPL), either
@@ -910,7 +910,7 @@
 %%                                  calligraphy.pdf
 %%                                  knots.pdf
 %%                                  spath3.pdf
-%%                                  README
+%%                                  README.txt
 %% 
 %%
 %% 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	2024-05-31 21:38:50 UTC (rev 71395)
+++ trunk/Master/texmf-dist/tex/latex/spath3/tikzlibraryknots.code.tex	2024-05-31 21:39:19 UTC (rev 71396)
@@ -7,7 +7,7 @@
 %% spath3_code.dtx  (with options: `knots')
 %% ----------------------------------------------------------------
 %% spath3 --- Functions for manipulating PGF soft paths
-%% E-mail: loopspace at mathforge.org
+%% E-mail: Andrew Stacey <loopspace at mathforge.org>
 %% Released under the LaTeX Project Public License v1.3c or later
 %% See http://www.latex-project.org/lppl.txt
 %% ----------------------------------------------------------------
@@ -229,6 +229,15 @@
   }
 }
 
+\cs_new_nopar:Npn \knot_show_strand:n #1
+{
+  \bool_if:NT \l__knot_debugging_bool
+  {
+    \iow_term:n {===Knot~ debug: #1===}
+    \spath_show:v {knot #1}
+  }
+}
+
 \cs_generate_variant:Nn \knot_debug:n {x}
 \cs_new_nopar:Npn \knot_apply_style:N #1
 {
@@ -334,6 +343,7 @@
     knot~ diagram/only~ when~ rendering/.try,
     only~ when~ rendering/.try,
   }
+  \knot_show_strand:n {strand #1}
   \spath_tikz_path:Vv \l__knot_tmpa_tl {knot strand #1}
   \group_end:
   \endpgfscope
@@ -364,6 +374,7 @@
   }
   {
     \tl_clear:N \l__knot_tmpa_tl
+    \spath_remove_empty_components:c {knot strand #1}
     \spath_initialpoint:Nv \l__knot_tmpa_tl {knot strand #1}
     \tl_put_left:NV \l__knot_tmpa_tl \c_spath_moveto_tl
     \spath_segments_to_seq:Nv \l__knot_segments_seq {knot strand #1}
@@ -375,7 +386,7 @@
 {
   \knot_debug:n {knot~ split~ self~ intersects}
   \tl_set:Nx \l__knot_tmpc_tl {\tl_item:nn {#1} {4}}
-  \tl_case:NnF \l__knot_tmpc_tl
+  \token_case_meaning:NnF \l__knot_tmpc_tl
   {
     \c_spath_curvetoa_tl
     {
@@ -898,6 +909,7 @@
   \int_set_eq:NN \l__knot_component_start_int \g__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_remove_empty_components:c {knot strand #1}
   \spath_segments_to_seq:Nv \l__knot_segments_seq {knot strand #1}
   \seq_map_function:NN \l__knot_segments_seq \knot_save_filament:N
 }
@@ -905,7 +917,7 @@
 {
   \knot_debug:n {knot~ save~ filament}
   \tl_set:Nx \l__knot_tmpb_tl {\tl_item:nn {#1} {4}}
-  \tl_case:NnF \l__knot_tmpb_tl
+  \token_case_meaning:NnF \l__knot_tmpb_tl
   {
     \c_spath_moveto_tl
     {
@@ -1190,7 +1202,7 @@
  }
 }
 %% 
-%% Copyright (C) 2011-2021 by Andrew Stacey <loopspace at mathforge.org>
+%% Copyright (C) 2011-2024 by Andrew Stacey <loopspace at mathforge.org>
 %% 
 %% This work may be distributed and/or modified under the
 %% conditions of the LaTeX Project Public License (LPPL), either
@@ -1215,7 +1227,7 @@
 %%                                  calligraphy.pdf
 %%                                  knots.pdf
 %%                                  spath3.pdf
-%%                                  README
+%%                                  README.txt
 %% 
 %%
 %% End of file `tikzlibraryknots.code.tex'.

Modified: trunk/Master/texmf-dist/tex/latex/spath3/tikzlibraryspath3.code.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/spath3/tikzlibraryspath3.code.tex	2024-05-31 21:38:50 UTC (rev 71395)
+++ trunk/Master/texmf-dist/tex/latex/spath3/tikzlibraryspath3.code.tex	2024-05-31 21:39:19 UTC (rev 71396)
@@ -7,7 +7,7 @@
 %% spath3_code.dtx  (with options: `tikzspath3')
 %% ----------------------------------------------------------------
 %% spath3 --- Functions for manipulating PGF soft paths
-%% E-mail: loopspace at mathforge.org
+%% E-mail: Andrew Stacey <loopspace at mathforge.org>
 %% Released under the LaTeX Project Public License v1.3c or later
 %% See http://www.latex-project.org/lppl.txt
 %% ----------------------------------------------------------------
@@ -135,7 +135,7 @@
     }
   }
   {
-    \msg_warning:nnn { spath3 } { missing soft path } { #2 }
+    \msg_warning:nnx { spath3 } { missing soft path } { #2 }
   }
   \tl_use:N \l__tikzspath_check_tl
 }
@@ -1928,13 +1928,9 @@
       }
     } {#1} { {} {#2} }
   },
-  draft~ mode/.is~ choice,
-  draft~ mode/true/.code={
-    \bool_set_true:N \l__tikzspath_draft_bool
+  draft~ mode/.code={
+    \__tikzspath_set_bool:Nn \l__tikzspath_draft_bool {#1}
   },
-  draft~ mode/false/.code={
-    \bool_set_false:N \l__tikzspath_draft_bool
-  },
   maybe~ spot~ weld/.code={
     \bool_if:NF \l__tikzspath_draft_bool
     {
@@ -1997,6 +1993,9 @@
     /tikz/spath/maybe~ spot~ weld~ globally=#1,
     /tikz/spath/render~ components=#1
   },
+  arrow~ shortening/.code={
+    \__tikzspath_set_bool:Nn \l_spath_arrow_shortening_bool {#1}
+  },
   show/.default=current,
   spot~ weld/.default=current,
   spot~ weld~ globally/.default=current,
@@ -2070,7 +2069,7 @@
 
 \ExplSyntaxOff
 %% 
-%% Copyright (C) 2011-2021 by Andrew Stacey <loopspace at mathforge.org>
+%% Copyright (C) 2011-2024 by Andrew Stacey <loopspace at mathforge.org>
 %% 
 %% This work may be distributed and/or modified under the
 %% conditions of the LaTeX Project Public License (LPPL), either
@@ -2095,7 +2094,7 @@
 %%                                  calligraphy.pdf
 %%                                  knots.pdf
 %%                                  spath3.pdf
-%%                                  README
+%%                                  README.txt
 %% 
 %%
 %% End of file `tikzlibraryspath3.code.tex'.



More information about the tex-live-commits mailing list.