texlive[46948] Master/texmf-dist: adigraph (13mar18)

commits+karl at tug.org commits+karl at tug.org
Tue Mar 13 22:51:14 CET 2018


Revision: 46948
          http://tug.org/svn/texlive?view=revision&revision=46948
Author:   karl
Date:     2018-03-13 22:51:13 +0100 (Tue, 13 Mar 2018)
Log Message:
-----------
adigraph (13mar18)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/adigraph/README.md
    trunk/Master/texmf-dist/doc/latex/adigraph/adigraph_documentation.pdf
    trunk/Master/texmf-dist/doc/latex/adigraph/adigraph_documentation.tex
    trunk/Master/texmf-dist/doc/latex/adigraph/adigraph_working_test.pdf
    trunk/Master/texmf-dist/doc/latex/adigraph/adigraph_working_test.tex
    trunk/Master/texmf-dist/tex/latex/adigraph/adigraph.sty

Modified: trunk/Master/texmf-dist/doc/latex/adigraph/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/adigraph/README.md	2018-03-13 13:31:50 UTC (rev 46947)
+++ trunk/Master/texmf-dist/doc/latex/adigraph/README.md	2018-03-13 21:51:13 UTC (rev 46948)
@@ -6,7 +6,7 @@
 **This library is released under MIT license (Copyright 2018 Luca Cappelletti)**.
 
 ## Documentation
-For more information, you can read the documentation available [here](https://github.com/LucaCappelletti94/adigraph/blob/master/documentation.pdf)
+For more information, you can read the documentation available [here](https://github.com/LucaCappelletti94/adigraph/blob/master/adigraph_documentation.pdf)
 
 ## Basic setup
 ### Installing the package
@@ -25,7 +25,7 @@
 ```
 
 ## Basic example
-More examples and step by step explanation is available in the [documentation](https://github.com/LucaCappelletti94/adigraph/blob/master/documentation.pdf).
+More examples and step by step explanation is available in the [documentation](https://github.com/LucaCappelletti94/adigraph/blob/master/adigraph_documentation.pdf).
 
 Suppose you want to create a graph as the following, with an augmenting path highlighted and a couple of cuts:
 

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

Modified: trunk/Master/texmf-dist/doc/latex/adigraph/adigraph_documentation.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/adigraph/adigraph_documentation.tex	2018-03-13 13:31:50 UTC (rev 46947)
+++ trunk/Master/texmf-dist/doc/latex/adigraph/adigraph_documentation.tex	2018-03-13 21:51:13 UTC (rev 46948)
@@ -1,6 +1,6 @@
 \documentclass{report}
 
-\title{Adigraph, V1.3}
+\title{Adigraph, \AdigraphVersionNumber}
 \author{Luca Cappelletti}
 \date{March 2018}
 
@@ -200,7 +200,7 @@
 \end{figure}
 
 \section{Automatically position nodes}
-When no coordinates are given or you just don't have time to think abount where to put those nodes, just choose a radius and Adigraph will position them on the circle of that radius.
+When no coordinates are given or you just don't have time to think about where to put those nodes, just choose a radius and Adigraph will position them on the circle of that radius.
 
 \begin{figure}
 	\begin{subfigure}{0.49\textwidth}
@@ -294,6 +294,35 @@
 	\end{subfigure}
 \end{figure}
 
+\subsection{A looped edge}
+Looped edges position automatically by themselves to minimize overlapping.
+\begin{figure}
+	\begin{subfigure}{0.49\textwidth}
+		\begin{minted}{latex}
+\NewAdigraph{myAdigraph}{
+ 	s:0,0;
+ 	t:4,0;
+}{
+	s,s;
+	t,t;
+	s,t;
+}
+\myAdigraph{}
+\end{minted}
+	\end{subfigure}
+	\begin{subfigure}{0.49\textwidth}
+		\NewAdigraph{myAdigraph}{
+			s:0,0;
+			t:4,0;
+		}{
+			s,s;
+			t,t;
+			s,t;
+		}
+		\myAdigraph{}
+	\end{subfigure}
+\end{figure}
+
 \subsection{A colored simple edge}
 \begin{figure}
 	\begin{subfigure}{0.49\textwidth}
@@ -525,6 +554,89 @@
 	\end{subfigure}
 \end{figure}
 
+\section{Kleene star operators}
+\subsection{Kleene star on an element}
+This works only when you don't have a node called \textit{<*>}. When this happens, the behavior of a tuple \textit{<a,*>} becomes the normal one.
+\begin{figure}
+	\begin{subfigure}{0.49\textwidth}
+		\begin{minted}{latex}
+\NewAdigraph{myAdigraph}{
+	1:3;
+	2:3;
+	3:3;
+	4:3;
+	5:3;
+	6:3;
+	7:3;
+	8:3;
+}{
+	1,*,blue;
+	*,4,red;
+}
+\myAdigraph{}
+\end{minted}
+	\end{subfigure}
+	\begin{subfigure}{0.49\textwidth}
+		\NewAdigraph{myAdigraph}{
+			1:3;
+			2:3;
+			3:3;
+			4:3;
+			5:3;
+			6:3;
+			7:3;
+			8:3;
+		}{
+			1,*,blue;
+			*,4,red;
+		}
+		\myAdigraph{}
+	\end{subfigure}
+\end{figure}
+
+\subsection{Kleene star minus the element}
+This works only when you don't have a node called \textit{<+>}. When this happens, the behavior of a tuple \textit{<a,+>} becomes the normal one.
+\begin{figure}
+	\begin{subfigure}{0.49\textwidth}
+		\begin{minted}{latex}
+\NewAdigraph{myAdigraph}{
+	1:3;
+	2:3;
+	3:3;
+	4:3;
+	5:3;
+	6:3;
+	7:3;
+	8:3;
+}{
+	1,+,blue;
+	+,4;
+}
+\myAdigraph{}
+\end{minted}
+	\end{subfigure}
+	\begin{subfigure}{0.49\textwidth}
+		\NewAdigraph{myAdigraph}{
+			1:3;
+			2:3;
+			3:3;
+			4:3;
+			5:3;
+			6:3;
+			7:3;
+			8:3;
+		}{
+			1,+,blue;
+			+,4;
+		}
+		\myAdigraph{}
+	\end{subfigure}
+\end{figure}
+
+
+\subsection{Combining Kleene operations}
+Sadly, operations such as \textit{<*,+>} or \textit{<+,+>} are not currently supported and not for lack of trying. I'll try implementing them again in the future when I'll have more time.
+
 \section{Augmenting paths}
 An augmenting path is specified by the following syntax: \textit{<comma separated list of nodes:units>}. It is \textbf{very important} to note that incremental paths called upon the same object are memorized by default.
 
@@ -696,11 +808,11 @@
 		\myAdigraph{}{
 			2,t,red;
 			3,4,blue;
+			2,4,green;
 		}
 	\end{subfigure}
 \end{figure}
 
-
 \chapter{Warnings}
 \section{Reserved words}
 I reserve to use for the package the following tokens:

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

Modified: trunk/Master/texmf-dist/doc/latex/adigraph/adigraph_working_test.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/adigraph/adigraph_working_test.tex	2018-03-13 13:31:50 UTC (rev 46947)
+++ trunk/Master/texmf-dist/doc/latex/adigraph/adigraph_working_test.tex	2018-03-13 21:51:13 UTC (rev 46948)
@@ -2,74 +2,104 @@
 
 \usepackage{adigraph}
 
-\title{Adigraph, V1.3, small working test}
+\title{Adigraph, \AdigraphVersionNumber, small working test}
 \author{Luca Cappelletti}
 \date{March 2018}
 
 \begin{document}
 \maketitle
-\NewAdigraph{myAdigraph}{
-  s:0,0;
-  1:2,2;
-  3:2,-2;
-  2:6,2;
-  4:6,-2;
-  t:8,0;
-}{
-  s,1:25;
-  s,3:25;
-  3,4:25;
-  1,2:35;
-  2,t:20;
-  4,t:30;
-  3,1:10;
-  4,2:10;
-  2,3:15::near start;
-  4,1:5::near start;
-}
+\begin{center}
+	\NewAdigraph{myAdigraph}{
+		s:0,0;
+		1:2,2;
+		3:2,-2;
+		2:6,2;
+		4:6,-2;
+		t:8,0;
+	}{
+		s,1:25;
+		s,3:25;
+		3,4:25;
+		1,2:35;
+		2,t:20;
+		4,t:30;
+		3,1:10;
+		4,2:10;
+		2,3:15::near start;
+		4,1:5::near start;
+	}
 
-\myAdigraph{}
+	\begin{figure}
+		\myAdigraph{}
+	\end{figure}
 
 
-\myAdigraph{
-  s,3,4,2,t:5;
-}
+	\begin{figure}
+		\myAdigraph{
+			s,3,4,2,t:5;
+		}
+	\end{figure}
 
-\myAdigraph{}{
-  2,t,red;
-  3,4,blue;
-}
+	\begin{figure}
+		\myAdigraph{}{
+			2,t,red;
+			3,4,blue;
+		}
+	\end{figure}
+	\NewAdigraph{mySecondAdigraph}{
+		1:4;
+		2:4;
+		3:4;
+		4:4;
+		5:4;
+		6:4;
+		7:4;
+		8:4;
+	}{
+		1,*:3;
+		2,*:3;
+		3,*:3;
+		4,*:3;
+		5,*:3;
+		6,*:3;
+		7,*:3;
+		8,*:3;
+	}
 
-\NewAdigraph{mySecondAdigraph}{
-  s:3;
-  1:3;
-  3:3;
-  2:3;
-  4:3;
-  t:3;
-}{
-  s,1:25;
-  s,3:25;
-  3,4:25;
-  1,2:35;
-  2,t:20;
-  4,t:30;
-  3,1:10;
-  4,2:10;
-  2,3:15::near start;
-  4,1:5::near start;
-}
+	\begin{figure}
+		\mySecondAdigraph{}
+	\end{figure}
+	\NewAdigraph{myThirdAdigraph}{
+		s:0,0;
+		1:2,2;
+		3:2,-2;
+		2:6,2;
+		4:6,-2;
+		t:8,0;
+	}{
+		s,+:25;
+		s,+:25;
+		3,+:25;
+		1,*:35;
+		2,+:20.567;
+		3,+:1.67;
+		4,+:10;
+		2,+:15.97;
+		4,+:5;
+	}
 
-\mySecondAdigraph{}
+	\begin{figure}
+		\myThirdAdigraph{}
+	\end{figure}
+	\begin{figure}
+		\myThirdAdigraph{s,3,4,2,t:5;}
+	\end{figure}
+	\begin{figure}%
+		\myThirdAdigraph{}{
+			2,1,red;
+			3,4,blue;
+		}
+	\end{figure}
+\end{center}
 
-
-\mySecondAdigraph{
-  s,3,4,2,t:5;
-}
-
-\mySecondAdigraph{}{
-  2,t,red;
-  3,4,blue;
-}
-
 \end{document}
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/latex/adigraph/adigraph.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/adigraph/adigraph.sty	2018-03-13 13:31:50 UTC (rev 46947)
+++ trunk/Master/texmf-dist/tex/latex/adigraph/adigraph.sty	2018-03-13 21:51:13 UTC (rev 46948)
@@ -7,9 +7,11 @@
 %
 % THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 %
+\def\AdigraphVersionNumber{v1.4.1}
+
 \NeedsTeXFormat{LaTeX2e}[1994/06/01]
 \ProvidesPackage{adigraph}
-[2018/03/10 v1.3 LaTeX package for creating augmenting directed graphs]
+[2018/03/11 \AdigraphVersionNumber LaTeX package for creating augmenting directed graphs]
 
 \RequirePackage{etoolbox}
 \RequirePackage{fp}
@@ -26,7 +28,10 @@
 \newcounter{AdigraphCurrentNodeCounter}
 \newcounter{AdigraphNumberOfPaths}
 \newcounter{AdigraphCurrentPathNumber}
+\newcounter{AdigraphAdjacentNodes}
 
+\def\AdigraphZero{0}
+
 \NewDocumentCommand{\AdigraphDrawNode}{m}{%
 	%
 	% #1 is node normalized id
@@ -39,6 +44,8 @@
 	\node[vertex,\nodeColor] (#1) at (\nodeX,\nodeY) {\nodeLabel};
 }
 
+\NewDocumentCommand{\sumOfOrientations}{m}{}
+
 \NewDocumentCommand{\AdigraphDrawEdge}{m m}{%
 	%
 	% #1 is first node normalized id
@@ -93,8 +100,22 @@
 		\ifcsdef{adigraphEdge#2v#1Weight}{%
 			\letcs{\AdigraphTwinEdgeWeight}{adigraphEdge#2v#1Weight}
 		}{%
-			\def\AdigraphTwinEdgeWeight{0}
+			\let\AdigraphTwinEdgeWeight\AdigraphZero
 		}
+		\providebool{firstWeight}
+		\FPifeq{\edgeWeight}{0}
+		\booltrue{firstWeight}
+		\else
+		\boolfalse{firstWeight}
+		\fi
+
+		\providebool{secondWeight}
+		\FPifeq{\AdigraphTwinEdgeWeight}{0}
+		\booltrue{secondWeight}
+		\else
+		\boolfalse{secondWeight}
+		\fi
+
 		\letcs{\edgeColor}{adigraphEdge#1v#2Color}
 		\ifbool{adigraphEdge#1v#2HasLabel}{%
 			\letcs{\edgeLabel}{adigraphEdge#1v#2Label}
@@ -101,16 +122,64 @@
 		}{%
 			\letcs{\edgeLabel}{adigraphEdge#1v#2Weight}
 		}
-		\ifnumequal{\edgeWeight}{0}{%
+		\ifbool{firstWeight}{%
 			% We don't draw edges with weight 0
 		}{%
-			\ifnumequal{\AdigraphTwinEdgeWeight}{0}{%
+			\ifbool{secondWeight}{%
 				% The twin edge won't be drawn
 				% This edge will be a straight line
 				\draw[edge,\edgeColor] (#1) to node[\edgeLabelPosition, \AdigraphLabelPosition] {\edgeLabel}(#2);
 			}{%
-				% Both edges have to be drawn, they will be curly
-				\draw[edge,\edgeColor] (#1) to [bend right=20] node[\edgeLabelPosition, \AdigraphLabelPosition] {\edgeLabel}(#2);
+				\IfEq{#1}{#2}{
+					% This is a self loop
+					\def\mySinSum{0}
+					\def\myCosSum{0}
+					\setcounter{AdigraphAdjacentNodes}{0}
+					\RenewDocumentCommand{\sumOfOrientations}{m}{
+						%
+						% #1 is name of node
+						%
+						\IfEq{#1}{##1}{
+							% This is the autoloop
+						}{
+							\newcount\myedgecounter
+							\myedgecounter 0\relax
+							\ifcsdef{adigraphEdge#1v##1Weight}{
+								\advance\myedgecounter 1\relax
+							}{}
+							\ifcsdef{adigraphEdge##1v#1Weight}{
+								\advance\myedgecounter 1\relax
+							}{}
+							\ifnumgreater{\the\myedgecounter}{0}{
+								\stepcounter{AdigraphAdjacentNodes}
+								\letcs{\firstX}{adigraphNode#1X}
+								\letcs{\firstY}{adigraphNode#1Y}
+								\letcs{\secondX}{adigraphNode##1X}
+								\letcs{\secondY}{adigraphNode##1Y}
+								\pgfmathsetmacro{\mySinSum}{\mySinSum+sin(atan2(\secondY-\firstY,\secondX-\firstX))}
+								\pgfmathsetmacro{\myCosSum}{\myCosSum+cos(atan2(\secondY-\firstY,\secondX-\firstX))}
+							}{}
+						}
+					}
+					\forlistloop{\sumOfOrientations}{\AdigraphNodeList}
+					\newcount\nodesNumber
+					\nodesNumber \value{AdigraphAdjacentNodes}\relax
+					\IfEq{\the\nodesNumber}{0}{
+						%No elements
+						\pgfmathsetmacro{\centralAngle}{0}
+					}{
+						\newcount\nodesNumber
+						\nodesNumber \value{AdigraphAdjacentNodes}\relax
+						\pgfmathsetmacro{\meanAngle}{atan2(\mySinSum/\the\nodesNumber,\myCosSum/\the\nodesNumber)}
+						\pgfmathsetmacro{\centralAngle}{180+360-max(\meanAngle,360-(\meanAngle))}
+					}
+					\pgfmathsetmacro{\leftAngle}{\centralAngle-35}
+					\pgfmathsetmacro{\rightAngle}{\centralAngle+35}
+					\draw[edge,\edgeColor] (#1) to [out=\leftAngle,in=\rightAngle,looseness=8] node[\edgeLabelPosition, \AdigraphLabelPosition] {\edgeLabel}(#1);
+				}{
+					% Both edges have to be drawn, they will be curly
+					\draw[edge,\edgeColor] (#1) to [bend right=20] node[\edgeLabelPosition, \AdigraphLabelPosition] {\edgeLabel}(#2);
+				}
 			}%
 		}%
 	}
@@ -128,10 +197,10 @@
 	\RenewDocumentCommand{\AdigraphGenerateNodeName}{m G{black}}{%
 		\IfInteger{##1}{%
 			\def\AdigraphNodeName{\AdigraphRom{##1}}%
-			\listgadd{\AdigraphNodeList}{\AdigraphRom{##1}}
+			\listxadd{\AdigraphNodeList}{\AdigraphRom{##1}}
 		}{%
 			\def\AdigraphNodeName{##1}%
-			\listgadd{\AdigraphNodeList}{##1}
+			\listxadd{\AdigraphNodeList}{##1}
 		}%
 		\csdef{adigraphNode\AdigraphNodeName Color}{##2}%
 		\ifblank{#3}{
@@ -179,38 +248,56 @@
 	%
 	\RenewDocumentCommand{\AdigraphMemorizeEdge}{m m G{black}}{%
 		\IfInteger{##1}{%
-			\IfInteger{##2}{%
-				\def\AdigraphEdgeName{\AdigraphRom{##1}v\AdigraphRom{##2}}%
-				\listgadd{\AdigraphEdgeList}{\AdigraphRom{##1},\AdigraphRom{##2}}
-			}{%
-				\def\AdigraphEdgeName{\AdigraphRom{##1}v##2}%
-				\listgadd{\AdigraphEdgeList}{\AdigraphRom{##1},##2}
-			}%
+			\csedef{AdigraphFirstNode}{\AdigraphRom{##1}}%
 		}{%
-			\IfInteger{##2}{%
-				\def\AdigraphEdgeName{##1v\AdigraphRom{##2}}%
-				\listgadd{\AdigraphEdgeList}{##1,\AdigraphRom{##2}}
-			}{%
-				\def\AdigraphEdgeName{##1v##2}%
-				\listgadd{\AdigraphEdgeList}{##1,##2}
-			}%
+			\csedef{AdigraphFirstNode}{##1}%
 		}%
-		\newbool{adigraphEdge\AdigraphEdgeName HasLabel}
-		\newbool{adigraphEdge\AdigraphEdgeName Drawn}
-		\ifblank{#3}{%
-			\boolfalse{adigraphEdge\AdigraphEdgeName HasLabel}
+		\IfInteger{##2}{%
+			\csedef{AdigraphSecondNode}{\AdigraphRom{##2}}%
 		}{%
-			\booltrue{adigraphEdge\AdigraphEdgeName HasLabel}
+			\csedef{AdigraphSecondNode}{##2}%
 		}%
-		\ifblank{#2}{%
-			\booltrue{adigraphEdge\AdigraphEdgeName HasLabel}
-			\csdef{adigraphEdge\AdigraphEdgeName Weight}{1}%
-		}{%
-			\csdef{adigraphEdge\AdigraphEdgeName Weight}{#2}%
-		}%
-		\csdef{adigraphEdge\AdigraphEdgeName Label}{#3}%
-		\csdef{adigraphEdge\AdigraphEdgeName Color}{##3}%
-		\csdef{adigraphEdge\AdigraphEdgeName LabelPosition}{#4}%
+
+		\xifinlist{\AdigraphFirstNode,\AdigraphSecondNode}{\AdigraphEdgeList}{
+			%This edge was previously added
+		}{
+			\xifinlist{\AdigraphFirstNode}{\AdigraphNodeList}{
+				\xifinlist{\AdigraphSecondNode}{\AdigraphNodeList}{
+					%This edge is new
+					\csedef{AdigraphEdgeName}{\AdigraphFirstNode v\AdigraphSecondNode}
+					\listxadd{\AdigraphEdgeList}{\AdigraphFirstNode,\AdigraphSecondNode}
+
+					\newbool{adigraphEdge\AdigraphEdgeName HasLabel}
+					\newbool{adigraphEdge\AdigraphEdgeName Drawn}
+					\ifblank{#3}{%
+						\boolfalse{adigraphEdge\AdigraphEdgeName HasLabel}
+					}{%
+						\booltrue{adigraphEdge\AdigraphEdgeName HasLabel}
+					}%
+					\ifblank{#2}{%
+						\booltrue{adigraphEdge\AdigraphEdgeName HasLabel}
+						\csdef{adigraphEdge\AdigraphEdgeName Weight}{1}%
+					}{%
+						\csdef{adigraphEdge\AdigraphEdgeName Weight}{#2}%
+					}%
+					\csdef{adigraphEdge\AdigraphEdgeName Label}{#3}%
+					\csdef{adigraphEdge\AdigraphEdgeName Color}{##3}%
+					\csdef{adigraphEdge\AdigraphEdgeName LabelPosition}{#4}%
+				}{
+					\PackageError{adigraph}{%
+						The given edge ends in the node ##2, that does not exist.
+					}{%
+						You have to create the node ##2.
+					}
+				}
+			}{
+				\PackageError{adigraph}{%
+					The given edge starts from the node ##1, that does not exist.
+				}{%
+					You have to create the node ##1.
+				}
+			}
+		}
 	}
 	\AdigraphMemorizeEdge#1
 }
@@ -237,10 +324,14 @@
 	% #2 -> Second addendum
 	% #3 -> Variable to store sum
 	%
-	\newcount\AdigraphCounter
-	\AdigraphCounter #1\relax
-	\advance\AdigraphCounter #2\relax
-	\FPset{#3}{\the\AdigraphCounter}
+	\pgfmathsetmacro{\sat}{#1+#2}
+	\pgfmathfrac{\sat}
+	\IfEq{\pgfmathresult}{0.0}{
+		\pgfmathint{\sat}
+		\FPset{#3}{\pgfmathresult}
+	}{
+		\FPset{#3}{\sat}
+	}
 }
 
 \NewDocumentCommand{\AdigraphPathBuilder}{m m m}{%
@@ -333,6 +424,81 @@
 	\AdigraphBuildEdgeWrapper#1
 }
 
+
+
+\NewDocumentCommand{\AdigraphApplyKleenePlusEdgeBuilder}{m}{%
+	%
+	% #1 -> element
+	%
+	\ifblank{#1}{
+		%end of list
+	}{
+		\IfSubStr{\AdigraphCurrentElaboratingEdge}{,#1,}{
+			%The node is already contained
+		}{
+			\IfSubStr{\AdigraphCurrentElaboratingEdge}{,#1}{
+				%The node is already contained
+			}{
+				\IfSubStr{\AdigraphCurrentElaboratingEdge}{#1,}{
+					\StrPosition{\AdigraphCurrentElaboratingEdge}{#1,}[\stringPosition]
+					\ifnumequal{\stringPosition}{1}{
+						%This is at the beginning of the list
+					}{
+						\StrSubstitute[1]{\AdigraphCurrentElaboratingEdge}{+}{#1}[\temp]%
+						\expandafter\AdigraphFirstEdgeRenormalizer\expandafter{\temp}
+					}
+				}{
+					\StrSubstitute[1]{\AdigraphCurrentElaboratingEdge}{+}{#1}[\temp]%
+					\expandafter\AdigraphFirstEdgeRenormalizer\expandafter{\temp}
+				}
+			}
+		}
+	}
+}
+
+\NewDocumentCommand{\AdigraphKleenePlusEdgeBuilder}{m}{%
+	\ifrmnum{#1}{
+		\def\AdigraphTempList{}
+		\listeadd{\AdigraphTempList}{\rmntonum{#1}}
+		\forlistloop{\AdigraphApplyKleenePlusEdgeBuilder}{\AdigraphTempList}
+	}{
+		\AdigraphApplyKleenePlusEdgeBuilder{#1}
+	}
+}
+
+\NewDocumentCommand{\AdigraphSecondEdgeRenormalizer}{m}{%
+	\xifinlist{+}{\AdigraphNodeList}{
+		%The plus is not a kleene sign, but a symbol for a node
+		\AdigraphEdgeBuilder{#1}
+	}{
+		\IfSubStr{#1}{+}{
+			\def\AdigraphCurrentElaboratingEdge{#1}
+			\forlistloop{\AdigraphKleenePlusEdgeBuilder}{\AdigraphNodeList}
+		}{
+			\AdigraphEdgeBuilder{#1}
+		}
+	}
+}
+
+\NewDocumentCommand{\AdigraphKleeneStarEdgeBuilder}{m}{%
+	\StrSubstitute[1]{\AdigraphCurrentElaboratingEdge}{*}{#1}[\temp]%
+	\expandafter\AdigraphFirstEdgeRenormalizer\expandafter{\temp}
+}
+
+\NewDocumentCommand{\AdigraphFirstEdgeRenormalizer}{m}{%
+	\xifinlist{*}{\AdigraphNodeList}{
+		%The asterisk is not a kleene sign, but a symbol for a node
+		\AdigraphSecondEdgeRenormalizer{#1}
+	}{
+		\IfSubStr{#1}{*}{
+			\def\AdigraphCurrentElaboratingEdge{#1}
+			\forlistloop{\AdigraphKleeneStarEdgeBuilder}{\AdigraphNodeList}
+		}{
+			\AdigraphSecondEdgeRenormalizer{#1}
+		}
+	}
+}
+
 \NewDocumentCommand{\AdigraphEdgeDrawer}{ > { \SplitArgument{ 1 } {,} } m }{%
 	\AdigraphDrawEdge#1
 }
@@ -363,7 +529,7 @@
 }
 
 \NewDocumentCommand{\AdigraphProcessEdges}{> { \SplitList{;} } m}{%
-	\ProcessList{#1}{\AdigraphEdgeBuilder}
+	\ProcessList{#1}{\AdigraphFirstEdgeRenormalizer}
 }
 
 \NewDocumentCommand{\AdigraphProcessPaths}{> { \SplitArgument{ 1 } {:} } m}{%
@@ -375,6 +541,8 @@
 	\stepcounter{AdigraphNumberOfPaths}
 }
 
+\NewDocumentCommand{\AdigraphCalculateInclination}{m m m}{}
+
 \NewDocumentCommand{\AdigraphCalculateOrientation}{m m m}{%
 	\letcs{\firstX}{adigraphNode#2X}
 	\letcs{\firstY}{adigraphNode#2Y}
@@ -382,20 +550,18 @@
 	\letcs{\secondY}{adigraphNode#3Y}
 
 	\providebool{equalX}
-	\FPifeq{\firstX}{\secondX}
+	\pgfmathsetmacro{\deltaX}{\secondX-\firstX}
+	\FPifeq{\deltaX}{0}
 	\booltrue{equalX}
 	\else
 	\boolfalse{equalX}
 	\fi
 
-	\ifnumequal{\secondX-\firstX}{0}{%
+
+	\ifbool{equalX}{%
 		\FPset{#1}{90}
 	}{%
-		\FPsub{\deltaY}{\secondY}{\firstY}
-		\FPsub{\deltaX}{\secondX}{\firstX}
-		\FPdiv{\deltaDiv}{\deltaY}{\deltaX}
-		\FParctan{\arcResult}{\deltaDiv}
-		\FPmul{#1}{\arcResult}{57.2958}
+		\pgfmathsetmacro{#1}{57.2958*atan((\secondY-\firstY)/(\deltaX))}
 	}
 }
 
@@ -475,11 +641,11 @@
 		}
 
 		% %cuts
-		% \ifblank{#4}{%
-		% 	% List is empty
-		% }{%
-		% 	\AdigraphProcessCuts{#4}
-		% }
+		\ifblank{#4}{%
+			% List is empty
+		}{%
+			\AdigraphProcessCuts{#4}
+		}
 	\end{tikzpicture}
 }
 
@@ -500,10 +666,10 @@
 		}
 	}{
 		\csdef{Adigraph#1AugmentingPaths}{}%
-		\expandafter\RenewDocumentCommand{\AdigraphProcessAugmentingPaths}{m}{%
+		\RenewDocumentCommand{\AdigraphProcessAugmentingPaths}{m}{%
 			\listcsgadd{Adigraph#1AugmentingPaths}{##1}
 		}
-		\expandafter\RenewDocumentCommand{\AdigraphProcessAugmentingPathsList}{> { \SplitList{;} } m}{%
+		\RenewDocumentCommand{\AdigraphProcessAugmentingPathsList}{> { \SplitList{;} } m}{%
 			\AdigraphProcessAugmentingPaths##1
 		}
 		\expandafter\NewDocumentCommand\expandafter{\csname #1\endcsname}{m G{}}{%
@@ -528,10 +694,10 @@
 	%
 	\ifcsdef{#1}{
 		\csdef{Adigraph#1AugmentingPaths}{}%
-		\expandafter\RenewDocumentCommand{\AdigraphProcessAugmentingPaths}{m}{%
+		\RenewDocumentCommand{\AdigraphProcessAugmentingPaths}{m}{%
 			\listcsgadd{Adigraph#1AugmentingPaths}{##1}
 		}
-		\expandafter\RenewDocumentCommand{\AdigraphProcessAugmentingPathsList}{> { \SplitList{;} } m}{%
+		\RenewDocumentCommand{\AdigraphProcessAugmentingPathsList}{> { \SplitList{;} } m}{%
 			\AdigraphProcessAugmentingPaths##1
 		}
 		\expandafter\RenewDocumentCommand\expandafter{\csname #1\endcsname}{m G{}}{%



More information about the tex-live-commits mailing list