texlive[49315] Master/texmf-dist: adigraph (4dec18)
commits+karl at tug.org
commits+karl at tug.org
Wed Dec 5 00:07:41 CET 2018
Revision: 49315
http://tug.org/svn/texlive?view=revision&revision=49315
Author: karl
Date: 2018-12-05 00:07:40 +0100 (Wed, 05 Dec 2018)
Log Message:
-----------
adigraph (4dec18)
Modified Paths:
--------------
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
Removed Paths:
-------------
trunk/Master/texmf-dist/doc/latex/adigraph/adigraph-large.png
Deleted: trunk/Master/texmf-dist/doc/latex/adigraph/adigraph-large.png
===================================================================
(Binary files differ)
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-12-04 01:23:21 UTC (rev 49314)
+++ trunk/Master/texmf-dist/doc/latex/adigraph/adigraph_documentation.tex 2018-12-04 23:07:40 UTC (rev 49315)
@@ -136,7 +136,7 @@
\end{minted}
\section{Adding nodes}
-We set its nodes with the following syntax: \textit{<node name, color: \(x\) coordinate, \(y\) coordinate: label>}.
+We set its nodes with the following syntax: \textit{<node name, color, border width: \(x\) coordinate, \(y\) coordinate: label>}.
\begin{figure}
\begin{subfigure}{0.49\textwidth}
@@ -181,6 +181,28 @@
Tested available colors are: red, blue, black, green. You may extend the possible colors with LaTex libraries such as xcolor.
+\subsection{Custom node width}
+To color a node you can use the following syntax: \textit{<node name, textual color, width: \(x\) coordinate, \(y\) coordinate>}. For example:
+
+\begin{figure}
+ \begin{subfigure}{0.49\textwidth}
+ \begin{minted}{latex}
+\NewAdigraph{myAdigraph}{
+ s,red,5:0,0;
+ t,blue,3:4,0;
+}
+\myAdigraph{}
+\end{minted}
+ \end{subfigure}
+ \begin{subfigure}{0.49\textwidth}
+ \NewAdigraph{myAdigraph}{
+ s,red,5:0,0;
+ t,blue,3:4,0;
+ }
+ \myAdigraph{}
+ \end{subfigure}
+\end{figure}
+
\subsection{Custom node labels}
To add a custom label you can use the following syntax: either \textit{<node name: \(x\) coordinate, \(y\) coordinate: node label>} or \textit{<node name,textual color: \(x\) coordinate, \(y\) coordinate: node label>} will work:
@@ -272,7 +294,7 @@
\section{Adding edges}
-We set its nodes with the following syntax: \textit{<node name: \(x\) coordinate, \(y\) coordinate, color : label>}.
+We set its nodes with the following syntax: \textit{<node name: \(x\) coordinate, \(y\) coordinate, color, edge width: label>}.
\subsection{A simple edge}
\begin{figure}
@@ -351,6 +373,30 @@
\end{subfigure}
\end{figure}
+\subsection{A wider simple edge}
+\begin{figure}
+ \begin{subfigure}{0.49\textwidth}
+ \begin{minted}{latex}
+\NewAdigraph{myAdigraph}{
+ s:0,0;
+ t:4,0;
+}{
+ s,t,red,5;
+}
+\myAdigraph{}
+\end{minted}
+ \end{subfigure}
+ \begin{subfigure}{0.49\textwidth}
+ \NewAdigraph{myAdigraph}{
+ s:0,0;
+ t:4,0;
+ }{
+ s,t,red,5;
+ }
+ \myAdigraph{}
+ \end{subfigure}
+\end{figure}
+
\subsection{A weighted edge}
\begin{figure}
\begin{subfigure}{0.49\textwidth}
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-12-04 01:23:21 UTC (rev 49314)
+++ trunk/Master/texmf-dist/doc/latex/adigraph/adigraph_working_test.tex 2018-12-04 23:07:40 UTC (rev 49315)
@@ -103,21 +103,20 @@
\NewAdigraph{myForthAdigraph}{
1:4;
- 2:4;
+ 2,red,1:4;
3:4;
4:4;
5:4;
- 6:4;
+ 6,purple,5:4;
7:4;
8:4;
}{
1,2:5;
2,3:5;
- 3,4:5;
+ 3,4,blue:10;
4,5:5;
- 5,6:5;
+ 5,6,purple,5:5;
}
-
\begin{figure}
\myForthAdigraph{
1,2,3:0;
@@ -142,7 +141,7 @@
\begin{figure}
\myFifthAdigraph{
- 2,3,4::purple;
+ 2,3,4::purple:5;
}
\end{figure}
\end{center}
Modified: trunk/Master/texmf-dist/tex/latex/adigraph/adigraph.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/adigraph/adigraph.sty 2018-12-04 01:23:21 UTC (rev 49314)
+++ trunk/Master/texmf-dist/tex/latex/adigraph/adigraph.sty 2018-12-04 23:07:40 UTC (rev 49315)
@@ -7,7 +7,7 @@
%
% 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.6.0}
+\def\AdigraphVersionNumber{v1.6.1}
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{adigraph}
@@ -40,8 +40,9 @@
\letcs{\nodeY}{adigraphNode#1Y}
\letcs{\nodeLabel}{adigraphNode#1Label}
\letcs{\nodeColor}{adigraphNode#1Color}
+ \letcs{\nodeWidth}{adigraphNode#1Width}
%
- \node[vertex,\nodeColor] (#1) at (\nodeX,\nodeY) {\nodeLabel};
+ \node[vertex,\nodeColor,line width=\nodeWidth pt] (#1) at (\nodeX,\nodeY) {\nodeLabel};
}
\NewDocumentCommand{\sumOfOrientations}{m}{}
@@ -57,6 +58,7 @@
\booltrue{adigraphEdge#1v#2Drawn}
\letcs{\edgeLabelPosition}{adigraphEdge#1v#2LabelPosition}
\letcs{\edgeWeight}{adigraphEdge#1v#2Weight}
+ \letcs{\edgeWidth}{adigraphEdge#1v#2Width}
\ifcsdef{adigraphEdge#2v#1Weight}{%
\letcs{\AdigraphTwinEdgeWeight}{adigraphEdge#2v#1Weight}
}{%
@@ -89,9 +91,9 @@
% The twin edge won't be drawn
% This edge will be a straight line
\ifbool{adigraphEdge#1v#2HasEmptyLabel}{
- \draw[edge,\edgeColor] (#1) to (#2);
+ \draw[edge,\edgeColor,line width=\edgeWidth pt] (#1) to (#2);
}{
- \draw[edge,\edgeColor] (#1) to node[\edgeLabelPosition, fill=white] {\edgeLabel}(#2);
+ \draw[edge,\edgeColor,line width=\edgeWidth pt] (#1) to node[\edgeLabelPosition, fill=white] {\edgeLabel}(#2);
}
}{%
\IfEq{#1}{#2}{
@@ -140,16 +142,16 @@
\pgfmathsetmacro{\leftAngle}{\centralAngle-35}
\pgfmathsetmacro{\rightAngle}{\centralAngle+35}
\ifbool{adigraphEdge#1v#2HasEmptyLabel}{
- \draw[edge,\edgeColor] (#1) to [out=\leftAngle,in=\rightAngle,looseness=8](#1);
+ \draw[edge,\edgeColor,line width=\edgeWidth pt] (#1) to [out=\leftAngle,in=\rightAngle,looseness=8](#1);
}{
- \draw[edge,\edgeColor] (#1) to [out=\leftAngle,in=\rightAngle,looseness=8] node[\edgeLabelPosition, fill=white] {\edgeLabel}(#1);
+ \draw[edge,\edgeColor,line width=\edgeWidth pt] (#1) to [out=\leftAngle,in=\rightAngle,looseness=8] node[\edgeLabelPosition, fill=white] {\edgeLabel}(#1);
}
}{
% Both edges have to be drawn, they will be curly
\ifbool{adigraphEdge#1v#2HasEmptyLabel}{
- \draw[edge,\edgeColor] (#1) to [bend right=20] (#2);
+ \draw[edge,\edgeColor,line width=\edgeWidth pt] (#1) to [bend right=20] (#2);
}{
- \draw[edge,\edgeColor] (#1) to [bend right=20] node[\edgeLabelPosition, fill=white] {\edgeLabel}(#2);
+ \draw[edge,\edgeColor,line width=\edgeWidth pt] (#1) to [bend right=20] node[\edgeLabelPosition, fill=white] {\edgeLabel}(#2);
}
}
}%
@@ -157,16 +159,16 @@
}
}
-\NewDocumentCommand{\AdigraphGenerateNodeName}{m m G{black}}{}
-\NewDocumentCommand{\AdigraphMemorizeNode}{m m G{black}}{}
+\NewDocumentCommand{\AdigraphGenerateNodeName}{m G{black} G{0.4}}{}
+\NewDocumentCommand{\AdigraphMemorizeNode}{m G{}}{}
-\NewDocumentCommand{\AdigraphBuildNode}{> { \SplitArgument{ 1 } {,} } m > { \SplitArgument{ 1 } {,} } m m}{%
+\NewDocumentCommand{\AdigraphBuildNode}{> { \SplitArgument{ 2 } {,} } m > { \SplitArgument{ 1 } {,} } m m}{%
%
- % #1 -> given node name, not normalized
- % #2 -> list of coordinates and color
+ % #1 -> given node name, not normalized, color and width
+ % #2 -> list of coordinates
% #3 -> optional label
%
- \RenewDocumentCommand{\AdigraphGenerateNodeName}{m G{black}}{%
+ \RenewDocumentCommand{\AdigraphGenerateNodeName}{m G{black} G{0.4}}{%
\IfInteger{##1}{%
\def\AdigraphNodeName{\AdigraphRom{##1}}%
\listxadd{\AdigraphNodeList}{\AdigraphRom{##1}}
@@ -175,6 +177,7 @@
\listxadd{\AdigraphNodeList}{##1}
}%
\csdef{adigraphNode\AdigraphNodeName Color}{##2}%
+ \csdef{adigraphNode\AdigraphNodeName Width}{##3}%
\ifblank{#3}{
\csdef{adigraphNode\AdigraphNodeName Label}{##1}%
}{
@@ -209,16 +212,16 @@
\AdigraphMemorizeNode#2
}
-\NewDocumentCommand{\AdigraphMemorizeEdge}{m m G{black}}{}
+\NewDocumentCommand{\AdigraphMemorizeEdge}{m m G{black} G{0.4}}{}
-\NewDocumentCommand{\AdigraphBuildEdge}{> {\SplitArgument{2}{,}} m m m m}{%
+\NewDocumentCommand{\AdigraphBuildEdge}{> {\SplitArgument{3}{,}} m m m m}{%
%
- % #1 -> List of edge nodes and its color, validated
+ % #1 -> List of edge nodes, its color and width
% #2 -> Weight
% #3 -> Label, defaults to weight
% #4 -> Label position, defaults to midway
%
- \RenewDocumentCommand{\AdigraphMemorizeEdge}{m m G{black}}{%
+ \RenewDocumentCommand{\AdigraphMemorizeEdge}{m m G{black} G{0.4}}{%
\IfInteger{##1}{%
\csedef{AdigraphFirstNode}{\AdigraphRom{##1}}%
}{%
@@ -256,6 +259,7 @@
}%
\csdef{adigraphEdge\AdigraphEdgeName Label}{#3}%
\csdef{adigraphEdge\AdigraphEdgeName Color}{##3}%
+ \csdef{adigraphEdge\AdigraphEdgeName Width}{##4}%
\csdef{adigraphEdge\AdigraphEdgeName LabelPosition}{#4}%
}{
\PackageError{adigraph}{%
@@ -308,7 +312,7 @@
}
}
-\NewDocumentCommand{\AdigraphPathBuilder}{m m m m m}{%
+\NewDocumentCommand{\AdigraphPathBuilder}{m m m m m m m}{%
%
% #1 -> first node
% #2 -> second node
@@ -315,6 +319,8 @@
% #3 -> units
% #4 -> forward color
% #5 -> backward color
+ % #6 -> forward width
+ % #7 -> backward width
%
\ifcsdef{adigraphEdge#1v#2Weight}{%
\letcs{\AdigraphWeightA}{adigraphEdge#1v#2Weight}
@@ -349,6 +355,9 @@
\cslet{adigraphEdge#1v#2Color}{#4}%
\cslet{adigraphEdge#2v#1Color}{#5}%
+ \cslet{adigraphEdge#1v#2Width}{#6}%
+ \cslet{adigraphEdge#2v#1Width}{#7}%
+
\expandafter\AdigraphSimpleSum\expandafter{\AdigraphWeightA}{-#3}{\resultA}
\expandafter\AdigraphSimpleSum\expandafter{\AdigraphWeightB}{#3}{\resultB}
\cslet{adigraphEdge#1v#2Weight}{\resultA}%
@@ -356,12 +365,14 @@
}
\NewDocumentCommand{\AdigraphElaboratePathColors}{G{} G{black}}{}
+\NewDocumentCommand{\AdigraphElaboratePathWidth}{G{0.4} G{}}{}
-\NewDocumentCommand{\AdigraphBuildPath}{> { \SplitList{,} } m G{} > { \SplitArgument{ 1 } {,} } G{}}{%
+\NewDocumentCommand{\AdigraphBuildPath}{> { \SplitList{,} } m G{} > { \SplitArgument{ 1 } {,} } G{} G{}}{%
%
% #1 -> List of nodes
% #2 -> Units to send over path
% #3 -> Colors list
+ % #4 -> Width list
%
\ifblank{#2}{%
\FPset{\units}{0}
@@ -386,6 +397,13 @@
\AdigraphElaboratePathColors#3
+ \RenewDocumentCommand{\AdigraphElaboratePathWidth}{G{0.4} G{##1}}{%
+ \def\AdigraphForwardPathWidth{##1}
+ \def\AdigraphBackwardPathWidth{##2}
+ }
+
+ \AdigraphElaboratePathWidth#4
+
\RenewDocumentCommand{\AdigraphElaboratePath}{m}{%
\IfInteger{##1}{%
\def\AdigraphCurrentNode{\AdigraphRom{##1}}%
@@ -393,7 +411,7 @@
\def\AdigraphCurrentNode{##1}%
}%
\ifdef{\AdigraphLastParsedNode}{%
- \expandafter\expandafter\expandafter\AdigraphPathBuilder\expandafter\expandafter\expandafter{\expandafter\AdigraphLastParsedNode\expandafter}\expandafter{\AdigraphCurrentNode}{\units}{\AdigraphForwardPathColor}{\AdigraphBackwardPathColor}
+ \expandafter\expandafter\expandafter\AdigraphPathBuilder\expandafter\expandafter\expandafter{\expandafter\AdigraphLastParsedNode\expandafter}\expandafter{\AdigraphCurrentNode}{\units}{\AdigraphForwardPathColor}{\AdigraphBackwardPathColor}{\AdigraphBackwardPathWidth}{\AdigraphBackwardPathWidth}
}{%
% This is the first iteration
}
@@ -408,6 +426,9 @@
}
\NewDocumentCommand{\AdigraphBuildNodeWrapper}{m m G{}}{
+ % #1 -> given node name, not normalized, color and width
+ % #2 -> list of coordinates
+ % #3 -> optional label
\ifblank{#1}{
%end of list
}{
@@ -531,7 +552,11 @@
\ProcessList{#1}{\AdigraphFirstEdgeRenormalizer}
}
-\NewDocumentCommand{\AdigraphProcessPaths}{> { \SplitArgument{ 2 } {:} } m}{%
+\NewDocumentCommand{\AdigraphProcessPaths}{> { \SplitArgument{ 3 } {:} } m}{%
+ % #1 -> List of nodes
+ % #2 -> Units to send over path
+ % #3 -> Colors list
+ % #4 -> Width list
\stepcounter{AdigraphCurrentPathNumber}
\AdigraphBuildPath#1
}
More information about the tex-live-commits
mailing list