summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-12-10 22:57:17 +0000
committerKarl Berry <karl@freefriends.org>2018-12-10 22:57:17 +0000
commitc871eb0744646b3fa09135cc962cdc2d15cd83a0 (patch)
treedc5750349c91dbd4aeb9e2ec6ffd7cf840909280
parentb5a51fa6a8498c3a5ce9f196b981259813415818 (diff)
adigraph (10dec18)
git-svn-id: svn://tug.org/texlive/trunk@49374 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/adigraph/adigraph-large.pngbin0 -> 158870 bytes
-rw-r--r--Master/texmf-dist/doc/latex/adigraph/adigraph_documentation.pdfbin112224 -> 203860 bytes
-rw-r--r--Master/texmf-dist/doc/latex/adigraph/adigraph_documentation.tex102
-rw-r--r--Master/texmf-dist/doc/latex/adigraph/adigraph_working_test.pdfbin32299 -> 32107 bytes
-rw-r--r--Master/texmf-dist/doc/latex/adigraph/adigraph_working_test.tex17
-rw-r--r--Master/texmf-dist/doc/latex/adigraph/img_examples/pyadigraph.pngbin0 -> 83900 bytes
-rw-r--r--Master/texmf-dist/doc/latex/adigraph/test.tex57
-rw-r--r--Master/texmf-dist/tex/latex/adigraph/adigraph.sty179
8 files changed, 294 insertions, 61 deletions
diff --git a/Master/texmf-dist/doc/latex/adigraph/adigraph-large.png b/Master/texmf-dist/doc/latex/adigraph/adigraph-large.png
new file mode 100644
index 00000000000..552c74c4ca2
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/adigraph/adigraph-large.png
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/adigraph/adigraph_documentation.pdf b/Master/texmf-dist/doc/latex/adigraph/adigraph_documentation.pdf
index abd60150a15..f97e049df7d 100644
--- a/Master/texmf-dist/doc/latex/adigraph/adigraph_documentation.pdf
+++ b/Master/texmf-dist/doc/latex/adigraph/adigraph_documentation.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/adigraph/adigraph_documentation.tex b/Master/texmf-dist/doc/latex/adigraph/adigraph_documentation.tex
index 8818b12ff6b..d0c25207d73 100644
--- a/Master/texmf-dist/doc/latex/adigraph/adigraph_documentation.tex
+++ b/Master/texmf-dist/doc/latex/adigraph/adigraph_documentation.tex
@@ -136,7 +136,7 @@ You can renovate an older graph by calling \textbackslash RenewAdigraph
\end{minted}
\section{Adding nodes}
-We set its nodes with the following syntax: \textit{<node name, color, border width: \(x\) coordinate, \(y\) coordinate: label>}.
+We set its nodes with the following syntax: \textit{<node name[, textual color, border width]: \(x\) coordinate[, \(y\) coordinate][: label]>}.
\begin{figure}
\begin{subfigure}{0.49\textwidth}
@@ -158,7 +158,7 @@ We set its nodes with the following syntax: \textit{<node name, color, border wi
\end{figure}
\subsection{Custom node colors}
-To color a node you can use the following syntax: \textit{<node name, textual color: \(x\) coordinate, \(y\) coordinate>}. For example, to draw s in red and t in blue we would write:
+To color a node you can use the following syntax: \textit{<node name[, textual color]: \(x\) coordinate[, \(y\) coordinate]>}. For example, to draw s in red and t in blue we would write:
\begin{figure}
\begin{subfigure}{0.49\textwidth}
@@ -182,7 +182,7 @@ To color a node you can use the following syntax: \textit{<node name, textual co
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:
+To color a node you can use the following syntax: \textit{<node name[, textual color[, border width]]: \(x\) coordinate[, \(y\) coordinate]>}. For example:
\begin{figure}
\begin{subfigure}{0.49\textwidth}
@@ -204,7 +204,7 @@ To color a node you can use the following syntax: \textit{<node name, textual co
\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:
+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:
\begin{figure}
\begin{subfigure}{0.49\textwidth}
@@ -294,7 +294,7 @@ When no coordinates are given or you just don't have time to think about where t
\section{Adding edges}
-We set its nodes with the following syntax: \textit{<node name: \(x\) coordinate, \(y\) coordinate, color, edge width: label>}.
+We set its edges with the following syntax: \textit{<first node, second node,[color,[edge width]][:weight[:label:[label position]]]>}.
\subsection{A simple edge}
\begin{figure}
@@ -1036,9 +1036,9 @@ If you'd like to color the cuts you just have to add the color as follows: \text
\end{subfigure}
\end{figure}
-\section{Non oriented edges and custom edge stiles}
+\section{Non oriented (undirected) edges and custom edge stiles}
If you need non oriented edges or in general to ad a custom style to your edges you can proceed as follows:
-\subsection{Non oriented}
+\subsection{Non oriented (undirected)}
\begin{figure}
\begin{subfigure}{0.49\textwidth}
\begin{minted}{latex}
@@ -1138,6 +1138,94 @@ If you need non oriented edges or in general to ad a custom style to your edges
\end{subfigure}
\end{figure}
+\chapter{PyAdigraph}
+\href{https://github.com/LucaCappelletti94/pyadigraph}{Pyadigraph} turns your networkx into Adigraph latex package. It requires Adigraph (1.7.0+) to work.
+
+\section{Installation}
+The package can be installed by simply running:
+\begin{minted}{bash}
+pip installed pyadigraph
+\end{minted}
+\clearpage
+\section{Example}
+\subsection{Python code}
+For example by running the following python code:
+\begin{minted}{python}
+from pyadigraph import Adigraph
+import networkx as nx
+
+A = Adigraph(
+ vertices_color_fallback="gray!90",
+ edges_color_fallback="gray!90",
+ sub_caption="My adigraph number {i} of {n}",
+ sub_label="adigraph_{i}_{n}",
+ row_size=1,
+ caption="A graph generated with python and latex.",
+ label="pyadigraph_example"
+)
+
+A.add_graph(
+ nx.bipartite.random_graph(4, 4, 1),
+ vertices_color={
+ 0: 'red!90',
+ 1: 'red!90',
+ 4: 'cyan!90',
+ 7: 'cyan!90'
+ })
+
+A.save("test/result.tex", document=True)
+\end{minted}
+\clearpage
+\subsection{Latex result}
+You automatically obtain the following latex:
+
+\begin{minted}{latex}
+\documentclass{report}
+\usepackage{adigraph}
+\usepackage{subcaption}
+
+\begin{document}
+\begin{figure}
+ \begin{subfigure}{1.0\textwidth}
+ \NewAdigraph{myAdigraph}{
+ 0,red!90,:-0.4386601404141742\textwidth,0.2091077552922947\textwidth:;
+ 1,red!90,:-0.15708496776680972\textwidth,0.09630690244229406\textwidth:;
+ 2,gray!90,:0.43887677279554366\textwidth,-0.2079924280020609\textwidth:;
+ 3,gray!90,:0.15678823839504888\textwidth,-0.09746320565948384\textwidth:;
+ 4,cyan!90,:-0.3736460590634439\textwidth,-0.327631363498189\textwidth:;
+ 5,gray!90,:0.3735687548614322\textwidth,0.3275275669374224\textwidth:;
+ 6,gray!90,:-0.042735184609099336\textwidth,-0.4998552275122768\textwidth:;
+ 7,cyan!90,:0.0428925858015027\textwidth,0.5\textwidth:;
+ }{
+ 0,4,gray!90,::;
+ 0,5,gray!90,::;
+ 0,6,gray!90,::;
+ 0,7,gray!90,::;
+ 1,4,gray!90,::;
+ 1,5,gray!90,::;
+ 1,6,gray!90,::;
+ 1,7,gray!90,::;
+ 2,4,gray!90,::;
+ 2,5,gray!90,::;
+ 2,6,gray!90,::;
+ 2,7,gray!90,::;
+ 3,4,gray!90,::;
+ 3,5,gray!90,::;
+ 3,6,gray!90,::;
+ 3,7,gray!90,::;
+ }[]
+ \myAdigraph{}
+ \caption{My adigraph number 1 of 1}\label{adigraph_1_1}
+ \end{subfigure}
+ \caption{A graph generated with python and latex.}\label{pyadigraph_example}
+\end{figure}
+\end{document}
+\end{minted}
+
+And once you compile that you receive a graph like the following:
+\begin{figure}
+ \includegraphics[width=0.5\textwidth]{img_examples/pyadigraph.png}
+\end{figure}
\chapter{Warnings}
\section{Reserved words}
diff --git a/Master/texmf-dist/doc/latex/adigraph/adigraph_working_test.pdf b/Master/texmf-dist/doc/latex/adigraph/adigraph_working_test.pdf
index b498908af4a..749a1dff1c1 100644
--- a/Master/texmf-dist/doc/latex/adigraph/adigraph_working_test.pdf
+++ b/Master/texmf-dist/doc/latex/adigraph/adigraph_working_test.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/adigraph/adigraph_working_test.tex b/Master/texmf-dist/doc/latex/adigraph/adigraph_working_test.tex
index f663aa418eb..b0a5376e06e 100644
--- a/Master/texmf-dist/doc/latex/adigraph/adigraph_working_test.tex
+++ b/Master/texmf-dist/doc/latex/adigraph/adigraph_working_test.tex
@@ -1,5 +1,6 @@
\documentclass{report}
+\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{adigraph}
\title{Adigraph, \AdigraphVersionNumber, small working test}
@@ -10,15 +11,15 @@
\maketitle
\begin{center}
\NewAdigraph{myAdigraph}{
- s:0,0;
+ 0:0,0;
1:2,2;
3:2,-2;
2:6,2;
4:6,-2;
t:8,0;
}{
- s,1:25;
- s,3:25;
+ 0,1:25;
+ 0,3:25;
3,4:25;
1,2:35;
2,t:20;
@@ -36,7 +37,7 @@
\begin{figure}
\myAdigraph{
- s,3,4,2,t:5;
+ 0,3,4,2,t:5;
}
\end{figure}
@@ -103,7 +104,7 @@
\NewAdigraph{myForthAdigraph}{
1:4;
- 2,red,1:4;
+ 2,Melon,1:4;
3:4;
4:4;
5:4;
@@ -112,8 +113,8 @@
8:4;
}{
1,2:5;
- 2,3:5;
- 3,4,blue:10;
+ 2,3:5.0;
+ 3,4:10;
4,5:5;
5,6,purple,5:5;
}
@@ -133,7 +134,7 @@
7:4;
8:4;
}{
- 1,*,red;
+ 1,*,red!80;
*,4,blue;
2,3;
3,4;
diff --git a/Master/texmf-dist/doc/latex/adigraph/img_examples/pyadigraph.png b/Master/texmf-dist/doc/latex/adigraph/img_examples/pyadigraph.png
new file mode 100644
index 00000000000..69c61f16fad
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/adigraph/img_examples/pyadigraph.png
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/adigraph/test.tex b/Master/texmf-dist/doc/latex/adigraph/test.tex
new file mode 100644
index 00000000000..5695e13b566
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/adigraph/test.tex
@@ -0,0 +1,57 @@
+\documentclass{report}
+\usepackage{adigraph}
+\usepackage{subcaption}
+
+\begin{document}
+\begin{figure}
+ \begin{subfigure}{0.5\textwidth}
+ \NewAdigraph{myAdigraph}{
+ 0,red!90,:-0.3809786411983217,-1.060040755194991:;
+ 1,red!90,:2.064011612238266,0.1152269298455566:;
+ 2,gray!90,:-1.5184462984334735,1.4027622819243912:;
+ 3,gray!90,:1.0781998579762053,2.9999996538001836:;
+ 4,cyan!90,:1.5184463673043251,-1.4027619074610054:;
+ 5,gray!90,:-2.064011426978595,-0.11522659721231196:;
+ 6,gray!90,:-1.0781999824004174,-3.0:;
+ 7,cyan!90,:0.3809785114920088,1.0600403942981784:;
+ }{
+ 0,4,gray!90,::;
+ 0,5,gray!90,::;
+ 0,6,gray!90,::;
+ 0,7,gray!90,::;
+ 1,4,gray!90,::;
+ 1,7,gray!90,::;
+ 2,5,gray!90,::;
+ 2,7,gray!90,::;
+ 3,7,gray!90,::;
+ }[]
+ \myAdigraph{}
+ \caption{My little adigraph}
+ \end{subfigure}
+ \begin{subfigure}{0.5\textwidth}
+ \NewAdigraph{myAdigraph}{
+ 0,red!90,:-1.0600955397170124,-0.909092429879124:;
+ 1,red!90,:-0.7769016878576507,2.441830442018683:;
+ 2,gray!90,:2.294827403537843,-1.1401225057579754:;
+ 3,gray!90,:2.9999983208930674,2.572669783991166:;
+ 4,cyan!90,:-2.2948254523229066,1.1401236892970583:;
+ 5,gray!90,:0.7769031550591187,-2.441828694069911:;
+ 6,gray!90,:-3.0,-2.5726712239220655:;
+ 7,cyan!90,:1.0600938004075402,0.909090938322168:;
+ }{
+ 0,4,gray!90,::;
+ 0,5,gray!90,::;
+ 0,6,gray!90,::;
+ 0,7,gray!90,::;
+ 1,4,gray!90,::;
+ 1,7,gray!90,::;
+ 2,5,gray!90,::;
+ 2,7,gray!90,::;
+ 3,7,gray!90,::;
+ }[]
+ \myAdigraph{}
+ \caption{Another adigraph}
+ \end{subfigure}
+ \caption{A graph generated with python and latex.}
+\end{figure}
+\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/adigraph/adigraph.sty b/Master/texmf-dist/tex/latex/adigraph/adigraph.sty
index 5d203a68dcf..52f9e8de77d 100644
--- a/Master/texmf-dist/tex/latex/adigraph/adigraph.sty
+++ b/Master/texmf-dist/tex/latex/adigraph/adigraph.sty
@@ -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.1}
+\def\AdigraphVersionNumber{v1.7.0}
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{adigraph}
@@ -20,8 +20,15 @@
\RequirePackage{tikz}
\usetikzlibrary{calc}
+\def\AdigraphZero{0}
+\def\AdigraphTextualZero{zero}
+\def\AdigraphDefaultColor{black}
+\def\AdigraphDefaultWidth{0.4}
+\def\AdigraphRed{red!90}
+\def\AdigraphCyan{cyan!90}
+
\makeatletter
-\newcommand*{\AdigraphRom}[1]{\expandafter\@slowromancap\romannumeral #1@}
+\newcommand{\AdigraphRom}[1]{\expandafter\@slowromancap\romannumeral #1@}
\makeatother
\newcounter{AdigraphTotalNodeCounter}
@@ -30,8 +37,6 @@
\newcounter{AdigraphCurrentPathNumber}
\newcounter{AdigraphAdjacentNodes}
-\def\AdigraphZero{0}
-
\NewDocumentCommand{\AdigraphDrawNode}{m}{%
%
% #1 is node normalized id
@@ -42,7 +47,7 @@
\letcs{\nodeColor}{adigraphNode#1Color}
\letcs{\nodeWidth}{adigraphNode#1Width}
%
- \node[vertex,\nodeColor,line width=\nodeWidth pt] (#1) at (\nodeX,\nodeY) {\nodeLabel};
+ \node[vertex,color=\nodeColor,line width=\nodeWidth pt] (#1) at (\nodeX,\nodeY) {\nodeLabel};
}
\NewDocumentCommand{\sumOfOrientations}{m}{}
@@ -91,9 +96,9 @@
% The twin edge won't be drawn
% This edge will be a straight line
\ifbool{adigraphEdge#1v#2HasEmptyLabel}{
- \draw[edge,\edgeColor,line width=\edgeWidth pt] (#1) to (#2);
+ \draw[edge,color=\edgeColor,line width=\edgeWidth pt] (#1) to (#2);
}{
- \draw[edge,\edgeColor,line width=\edgeWidth pt] (#1) to node[\edgeLabelPosition, fill=white] {\edgeLabel}(#2);
+ \draw[edge,color=\edgeColor,line width=\edgeWidth pt] (#1) to node[\edgeLabelPosition, fill=white] {\edgeLabel}(#2);
}
}{%
\IfEq{#1}{#2}{
@@ -142,16 +147,16 @@
\pgfmathsetmacro{\leftAngle}{\centralAngle-35}
\pgfmathsetmacro{\rightAngle}{\centralAngle+35}
\ifbool{adigraphEdge#1v#2HasEmptyLabel}{
- \draw[edge,\edgeColor,line width=\edgeWidth pt] (#1) to [out=\leftAngle,in=\rightAngle,looseness=8](#1);
+ \draw[edge,color=\edgeColor,line width=\edgeWidth pt] (#1) to [out=\leftAngle,in=\rightAngle,looseness=8](#1);
}{
- \draw[edge,\edgeColor,line width=\edgeWidth pt] (#1) to [out=\leftAngle,in=\rightAngle,looseness=8] node[\edgeLabelPosition, fill=white] {\edgeLabel}(#1);
+ \draw[edge,color=\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,line width=\edgeWidth pt] (#1) to [bend right=20] (#2);
+ \draw[edge,color=\edgeColor,line width=\edgeWidth pt] (#1) to [bend right=20] (#2);
}{
- \draw[edge,\edgeColor,line width=\edgeWidth pt] (#1) to [bend right=20] node[\edgeLabelPosition, fill=white] {\edgeLabel}(#2);
+ \draw[edge,color=\edgeColor,line width=\edgeWidth pt] (#1) to [bend right=20] node[\edgeLabelPosition, fill=white] {\edgeLabel}(#2);
}
}
}%
@@ -159,7 +164,7 @@
}
}
-\NewDocumentCommand{\AdigraphGenerateNodeName}{m G{black} G{0.4}}{}
+\NewDocumentCommand{\AdigraphGenerateNodeName}{m G{\AdigraphDefaultColor} G{\AdigraphDefaultWidth}}{}
\NewDocumentCommand{\AdigraphMemorizeNode}{m G{}}{}
\NewDocumentCommand{\AdigraphBuildNode}{> { \SplitArgument{ 2 } {,} } m > { \SplitArgument{ 1 } {,} } m m}{%
@@ -168,16 +173,33 @@
% #2 -> list of coordinates
% #3 -> optional label
%
- \RenewDocumentCommand{\AdigraphGenerateNodeName}{m G{black} G{0.4}}{%
+ \RenewDocumentCommand{\AdigraphGenerateNodeName}{m G{\AdigraphDefaultColor} G{\AdigraphDefaultWidth}}{%
+ %
+ % ##1 -> node name, not normalized
+ % ##2 -> color
+ % ##3 -> width
+ %
\IfInteger{##1}{%
- \def\AdigraphNodeName{\AdigraphRom{##1}}%
- \listxadd{\AdigraphNodeList}{\AdigraphRom{##1}}
+ \IfEq{##1}{\AdigraphZero}{
+ \def\AdigraphNodeName{\AdigraphTextualZero}%
+ }{
+ \def\AdigraphNodeName{\AdigraphRom{##1}}%
+ }
}{%
\def\AdigraphNodeName{##1}%
- \listxadd{\AdigraphNodeList}{##1}
}%
- \csdef{adigraphNode\AdigraphNodeName Color}{##2}%
- \csdef{adigraphNode\AdigraphNodeName Width}{##3}%
+ \listxadd{\AdigraphNodeList}{\AdigraphNodeName}
+ \ifblank{##2}{
+ \csdef{adigraphNode\AdigraphNodeName Color}{\AdigraphDefaultColor}%
+ }{
+ \csdef{adigraphNode\AdigraphNodeName Color}{##2}%
+ }
+ \ifblank{##3}{
+ \csdef{adigraphNode\AdigraphNodeName Width}{\AdigraphDefaultWidth}%
+ }{
+ \csdef{adigraphNode\AdigraphNodeName Width}{##3}%
+ }
+
\ifblank{#3}{
\csdef{adigraphNode\AdigraphNodeName Label}{##1}%
}{
@@ -212,7 +234,7 @@
\AdigraphMemorizeNode#2
}
-\NewDocumentCommand{\AdigraphMemorizeEdge}{m m G{black} G{0.4}}{}
+\NewDocumentCommand{\AdigraphMemorizeEdge}{m m G{\AdigraphDefaultColor} G{\AdigraphDefaultWidth}}{}
\NewDocumentCommand{\AdigraphBuildEdge}{> {\SplitArgument{3}{,}} m m m m}{%
%
@@ -221,14 +243,28 @@
% #3 -> Label, defaults to weight
% #4 -> Label position, defaults to midway
%
- \RenewDocumentCommand{\AdigraphMemorizeEdge}{m m G{black} G{0.4}}{%
+ \RenewDocumentCommand{\AdigraphMemorizeEdge}{m m G{\AdigraphDefaultColor} G{\AdigraphDefaultWidth}}{%
+ %
+ % ##1 -> first edge
+ % ##2 -> second edge
+ % ##3 -> color
+ % ##4 -> width
+ %
\IfInteger{##1}{%
- \csedef{AdigraphFirstNode}{\AdigraphRom{##1}}%
+ \IfEq{##1}{\AdigraphZero}{
+ \csedef{AdigraphFirstNode}{\AdigraphTextualZero}%
+ }{
+ \csedef{AdigraphFirstNode}{\AdigraphRom{##1}}%
+ }
}{%
\csedef{AdigraphFirstNode}{##1}%
}%
\IfInteger{##2}{%
- \csedef{AdigraphSecondNode}{\AdigraphRom{##2}}%
+ \IfEq{##2}{\AdigraphZero}{
+ \csedef{AdigraphSecondNode}{\AdigraphTextualZero}%
+ }{
+ \csedef{AdigraphSecondNode}{\AdigraphRom{##2}}%
+ }
}{%
\csedef{AdigraphSecondNode}{##2}%
}%
@@ -258,8 +294,16 @@
\csdef{adigraphEdge\AdigraphEdgeName Weight}{#2}%
}%
\csdef{adigraphEdge\AdigraphEdgeName Label}{#3}%
- \csdef{adigraphEdge\AdigraphEdgeName Color}{##3}%
- \csdef{adigraphEdge\AdigraphEdgeName Width}{##4}%
+ \ifblank{##3}{
+ \csdef{adigraphEdge\AdigraphEdgeName Color}{\AdigraphDefaultColor}%
+ }{
+ \csdef{adigraphEdge\AdigraphEdgeName Color}{##3}%
+ }
+ \ifblank{##4}{
+ \csdef{adigraphEdge\AdigraphEdgeName Width}{\AdigraphDefaultWidth}%
+ }{
+ \csdef{adigraphEdge\AdigraphEdgeName Width}{##4}%
+ }
\csdef{adigraphEdge\AdigraphEdgeName LabelPosition}{#4}%
}{
\PackageError{adigraph}{%
@@ -294,7 +338,7 @@
}
}
-\NewDocumentCommand{\AdigraphElaboratePath}{m m G{black}}{}
+\NewDocumentCommand{\AdigraphElaboratePath}{m m G{\AdigraphDefaultColor}}{}
\NewDocumentCommand{\AdigraphSimpleSum}{m m m}{%
%
@@ -352,11 +396,26 @@
\listgadd{\AdigraphEdgeList}{#2,#1}
}
- \cslet{adigraphEdge#1v#2Color}{#4}%
- \cslet{adigraphEdge#2v#1Color}{#5}%
-
- \cslet{adigraphEdge#1v#2Width}{#6}%
- \cslet{adigraphEdge#2v#1Width}{#7}%
+ \ifblank{#4}{
+ \cslet{adigraphEdge#1v#2Color}{\AdigraphDefaultColor}%
+ }{
+ \cslet{adigraphEdge#1v#2Color}{#4}%
+ }
+ \ifblank{#5}{
+ \cslet{adigraphEdge#2v#1Color}{\AdigraphDefaultColor}%
+ }{
+ \cslet{adigraphEdge#2v#1Color}{#5}%
+ }
+ \ifblank{#6}{
+ \cslet{adigraphEdge#1v#2Width}{\AdigraphDefaultWidth}%
+ }{
+ \cslet{adigraphEdge#1v#2Width}{#6}%
+ }
+ \ifblank{#7}{
+ \cslet{adigraphEdge#2v#1Width}{\AdigraphDefaultWidth}%
+ }{
+ \cslet{adigraphEdge#2v#1Width}{#7}%
+ }
\expandafter\AdigraphSimpleSum\expandafter{\AdigraphWeightA}{-#3}{\resultA}
\expandafter\AdigraphSimpleSum\expandafter{\AdigraphWeightB}{#3}{\resultB}
@@ -364,8 +423,8 @@
\cslet{adigraphEdge#2v#1Weight}{\resultB}%
}
-\NewDocumentCommand{\AdigraphElaboratePathColors}{G{} G{black}}{}
-\NewDocumentCommand{\AdigraphElaboratePathWidth}{G{0.4} G{}}{}
+\NewDocumentCommand{\AdigraphElaboratePathColors}{G{} G{\AdigraphDefaultColor}}{}
+\NewDocumentCommand{\AdigraphElaboratePathWidth}{G{\AdigraphDefaultWidth} G{}}{}
\NewDocumentCommand{\AdigraphBuildPath}{> { \SplitList{,} } m G{} > { \SplitArgument{ 1 } {,} } G{} G{}}{%
%
@@ -380,33 +439,49 @@
\FPset{\units}{#2}
}
- \RenewDocumentCommand{\AdigraphElaboratePathColors}{G{} G{black}}{%
+ \RenewDocumentCommand{\AdigraphElaboratePathColors}{G{} G{\AdigraphDefaultColor}}{%
\ifblank{##1}{
\ifnum\value{AdigraphNumberOfPaths}=\value{AdigraphCurrentPathNumber}
- \def\AdigraphForwardPathColor{red}
- \def\AdigraphBackwardPathColor{blue}
+ \def\AdigraphForwardPathColor{\AdigraphRed}
+ \def\AdigraphBackwardPathColor{\AdigraphCyan}
\else
- \def\AdigraphForwardPathColor{black}
- \def\AdigraphBackwardPathColor{black}
+ \def\AdigraphForwardPathColor{\AdigraphDefaultColor}
+ \def\AdigraphBackwardPathColor{\AdigraphDefaultColor}
\fi
}{
\def\AdigraphForwardPathColor{##1}
- \def\AdigraphBackwardPathColor{##2}
+ \ifblank{##2}{
+ \def\AdigraphBackwardPathColor{\AdigraphDefaultColor}
+ }{
+ \def\AdigraphBackwardPathColor{##2}
+ }
}
}
\AdigraphElaboratePathColors#3
- \RenewDocumentCommand{\AdigraphElaboratePathWidth}{G{0.4} G{##1}}{%
- \def\AdigraphForwardPathWidth{##1}
- \def\AdigraphBackwardPathWidth{##2}
+ \RenewDocumentCommand{\AdigraphElaboratePathWidth}{G{\AdigraphDefaultWidth} G{##1}}{%
+ \ifblank{##1}{
+ \def\AdigraphForwardPathWidth{\AdigraphDefaultWidth}
+ }{
+ \def\AdigraphForwardPathWidth{##1}
+ }
+ \ifblank{##2}{
+ \def\AdigraphBackwardPathWidth{\AdigraphDefaultWidth}
+ }{
+ \def\AdigraphBackwardPathWidth{##2}
+ }
}
\AdigraphElaboratePathWidth#4
\RenewDocumentCommand{\AdigraphElaboratePath}{m}{%
\IfInteger{##1}{%
- \def\AdigraphCurrentNode{\AdigraphRom{##1}}%
+ \IfEq{##1}{\AdigraphZero}{
+ \def\AdigraphCurrentNode{\AdigraphTextualZero}%
+ }{
+ \def\AdigraphCurrentNode{\AdigraphRom{##1}}%
+ }
}{%
\def\AdigraphCurrentNode{##1}%
}%
@@ -416,7 +491,11 @@
% This is the first iteration
}
\IfInteger{##1}{%
- \def\AdigraphLastParsedNode{\AdigraphRom{##1}}%
+ \IfEq{##1}{\AdigraphZero}{
+ \def\AdigraphLastParsedNode{\AdigraphTextualZero}%
+ }{
+ \def\AdigraphLastParsedNode{\AdigraphRom{##1}}%
+ }
}{%
\def\AdigraphLastParsedNode{##1}%
}%
@@ -589,17 +668,25 @@
}
}
-\NewDocumentCommand{\AdigraphExecuteCutBuilder}{m m G{black}}{%
+\NewDocumentCommand{\AdigraphExecuteCutBuilder}{m m G{\AdigraphDefaultColor}}{%
\ifblank{#1}{%
% Reached end of list
}{%
\IfInteger{#1}{%
- \def\AdigraphFirstNode{\AdigraphRom{#1}}%
+ \IfEq{#1}{\AdigraphZero}{
+ \def\AdigraphFirstNode{\AdigraphTextualZero}%
+ }{
+ \def\AdigraphFirstNode{\AdigraphRom{#1}}%
+ }
}{%
\def\AdigraphFirstNode{#1}%
}%
\IfInteger{#2}{%
- \def\AdigraphSecondNode{\AdigraphRom{#2}}%
+ \IfEq{#2}{\AdigraphZero}{
+ \def\AdigraphSecondNode{\AdigraphTextualZero}%
+ }{
+ \def\AdigraphSecondNode{\AdigraphRom{#2}}%
+ }
}{%
\def\AdigraphSecondNode{#2}%
}%