From ba2ad222a172400f15825d72cb6ddfb485657237 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Thu, 30 Apr 2020 21:27:15 +0000
Subject: dynkin-diagrams (30apr20)

git-svn-id: svn://tug.org/texlive/trunk@54948 c570f23f-e606-0410-a88d-b1316a301751
---
 .../tex/latex/dynkin-diagrams/dynkin-diagrams.sty  | 402 +++++++++++----------
 1 file changed, 206 insertions(+), 196 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/dynkin-diagrams/dynkin-diagrams.sty')

diff --git a/Master/texmf-dist/tex/latex/dynkin-diagrams/dynkin-diagrams.sty b/Master/texmf-dist/tex/latex/dynkin-diagrams/dynkin-diagrams.sty
index 7cb271cf539..0a6191599fa 100644
--- a/Master/texmf-dist/tex/latex/dynkin-diagrams/dynkin-diagrams.sty
+++ b/Master/texmf-dist/tex/latex/dynkin-diagrams/dynkin-diagrams.sty
@@ -1,6 +1,6 @@
 % The Dynkin Diagrams package.
 %
-% Version 3.1415926535897
+% Version 3.14159265358979
 %
 % This package draws Dynkin diagrams in LaTeX 
 % documents, using the TikZ package.
@@ -13,8 +13,7 @@
 % Released under the LaTeX Project Public License v1.3c or later, see 
 % http://www.latex-project.org/lppl.txt
 \NeedsTeXFormat{LaTeX2e}[1994/06/01]
-\ProvidesPackage{dynkin-diagrams}[2020/03/19 Dynkin diagrams]
-\RequirePackage{etex}
+\ProvidesPackage{dynkin-diagrams}[2020/04/30 Dynkin diagrams]
 \RequirePackage{tikz}
 \RequirePackage{xstring}
 \RequirePackage{xparse}
@@ -40,7 +39,7 @@
 %%% Application programming interface: 
 %%% See dynkin-diagrams.tex file for examples of use.
 %%%
-\ifx\draw@lie@hasse@root\undefined
+\ifx\draw@lie@hasse@root\undefined\relax
 \pgfdeclarelayer{background}
 \pgfdeclarelayer{Dynkin behind}
 \pgfsetlayers{background,Dynkin behind,main}
@@ -94,10 +93,13 @@
 \dynkin@restore{}%
 }%
 
+\NewDocumentCommand\dynkin@check@if@in@tikZ{}%
+{\ifdefined\filldraw\relax\else\dynkin@error@not@in@tikz\fi}
+
 \NewDocumentCommand\dynkin{O{}mO{0}m}%
 {%
 \dynkin@save{}%
-\ifdefined\filldraw%
+\ifdefined\filldraw\relax%
 \@dynkin[vertical shift=0,#1]{#2}[#3]{#4}%
 \else%
 \tikz[baseline=(origin.base)]{\@dynkin[#1]{#2}[#3]{#4}}%
@@ -208,7 +210,7 @@
 
 \NewDocumentCommand\dynkinRefreshRoots{}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+???
 	\dynkin@override@label@directions{}%
 	\dynkin@draw@all@roots{}%
 	\ifdynkin@label@the@roots%
@@ -285,8 +287,8 @@
 %% Starred form uses the alternate label location.
 \NewDocumentCommand\dynkinLabelRoot{smm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
-	\ifnum\dynkin@nodes<#2%
+	\dynkin@check@if@in@tikZ%
+	\ifnum\dynkin@nodes<#2\relax%
 		\ClassError{Dynkin diagrams}%
 		{Unrecognized root: 
 		``#2'' found when labelling Dynkin diagram
@@ -345,41 +347,41 @@
 
 \NewDocumentCommand\dynkinBrace{somm}%[text]{start}{end}
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
+	\IfBooleanTF{#1}%
+	{%
+		\xdef\braceYshift{1mm}%
+	}%
+	{%
+		\xdef\braceYshift{-1mm}%
+	}%
+	\draw[%
+		decoration=%
+			{%
+				brace,
+				\IfBooleanF{#1}{mirror},
+				raise=0.05cm,
+			},%
+		decorate]%
+		($(root #3)-({\dynkin@root@radius},
 		\IfBooleanTF{#1}%
-		{%
-			\xdef\braceYshift{1mm}%
-		}%
-		{%
-			\xdef\braceYshift{-1mm}%
-		}%
-		\draw[%
-			decoration=%
-				{%
-					brace,
-					\IfBooleanF{#1}{mirror},
-					raise=0.05cm,
-				},%
-			decorate]%
-			($(root #3)-({\dynkin@root@radius},
-			\IfBooleanTF{#1}%
-				{{-\dynkin@root@radius}}%
-				{{\dynkin@root@radius}}%
-			)$) 
-		    	-- 
-			($(root #4)+({\dynkin@root@radius},
-			\IfBooleanTF{#1}%
-				{{\dynkin@root@radius}}%
-				{{-\dynkin@root@radius}}%
-			)$) 
- 			node%
-			[%
-				pos=0.5,%
-			   	anchor=\IfBooleanTF{#1}{south}{north},%
-		  		yshift=\braceYshift,%
-				/Dynkin diagram/text style%
-			]% 
-			{\IfValueT{#2}{\(#2\)}};%
+			{{-\dynkin@root@radius}}%
+			{{\dynkin@root@radius}}%
+		)$) 
+		   	-- 
+		($(root #4)+({\dynkin@root@radius},
+		\IfBooleanTF{#1}%
+			{{\dynkin@root@radius}}%
+			{{-\dynkin@root@radius}}%
+		)$) 
+ 		node%
+		[%
+			pos=0.5,%
+		   	anchor=\IfBooleanTF{#1}{south}{north},%
+	  		yshift=\braceYshift,%
+			/Dynkin diagram/text style%
+		]% 
+		{\IfValueT{#2}{\(#2\)}};%
 }%
 
 \NewDocumentCommand\dynkin@involution{somD<>{}om}%
@@ -458,7 +460,7 @@
 %% Prints the labels on the Dynkin diagram,in the given ordering. Uses the default labels if ``label'' is set without a list of ``labels'' being set.
 \newcommand{\dynkinPrintLabels}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfStrEq{\dynkin@label@list}{}{%
 		\foreach \i in {1,...,\the\dynkin@nodes}{\dynkinLabelRoot{\i}{\i}}%
 		\ifdynkin@is@extended%
@@ -499,7 +501,7 @@
 % Print alternate location labels.
 \newcommand{\dynkinPrintLabelsStar}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfStrEq{\dynkin@label@list@star}{}{%
 		\foreach \i in {1,...,\the\dynkin@nodes}{\dynkinLabelRoot*{\i}{\i}}%
 		\ifdynkin@is@extended%
@@ -571,7 +573,7 @@
 %% The starred form accepts <n> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinCrossRootMark{sO{}m}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%	
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootNumber{#3}%
@@ -587,7 +589,7 @@
 %% The starred form accepts <n> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinHeavyCrossRootMark{sO{}m}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootNumber{#3}%
@@ -611,7 +613,7 @@
 %% The starred form accepts <n> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinHollowRootMark{sO{}m}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootNumber{#3}%
@@ -627,7 +629,7 @@
 %% The starred form accepts <n> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinDoubleHollowRootMark{sO{}m}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%	
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootNumber{#3}%
@@ -641,7 +643,7 @@
 
 \NewDocumentCommand\dynkinDrawSolidRootMark{O{}m}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%	
 	\fill[/Dynkin diagram,*,#1] (#2) circle (\dynkin@root@radius);%
 }%
 
@@ -650,7 +652,7 @@
 %% The starred form accepts <n> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinSolidRootMark{sO{}m}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootNumber{#3}%
@@ -667,7 +669,7 @@
 %% The starred form accepts <n> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinTensorRootMark{sO{}m}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootNumber{#3}%
@@ -692,7 +694,7 @@
 % The starred form accepts <n> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinRootMark{smm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\IfStrEqCase{#2}%
@@ -731,7 +733,7 @@
 %% The starred form accepts <p> and <q> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinDefiniteSingleEdge{sO{}mm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootPair{#3}{#4}%
@@ -754,7 +756,7 @@
 %% The starred form accepts <p> and <q> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinIndefiniteSingleEdge{sO{}mm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootPair{#3}{#4}%
@@ -784,7 +786,7 @@
 %%% The starred form accepts <p> and <q> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinRightFold{sO{}mm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\dynkinFold*[/Dynkin diagram,fold right style,#2]{#3}{#4}%
@@ -799,7 +801,7 @@
 %%% The starred form accepts <p> and <q> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinLeftFold{sO{}mm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\dynkinFold*[/Dynkin diagram,fold left style,#2]{#3}{#4}%
@@ -814,7 +816,7 @@
 %% The starred form accepts <p> and <q> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinFold{sO{}mm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootPair{#3}{#4}%
@@ -838,7 +840,7 @@
 %% The starred form accepts <p> and <q> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinDefiniteRightDownArc{sO{}mm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootPair{#3}{#4}%
@@ -859,7 +861,7 @@
 %% The starred form accepts <p> and <q> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinIndefiniteRightDownArc{sO{}mm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootPair{#3}{#4}%
@@ -890,7 +892,7 @@
 %% The starred form accepts <p> and <q> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinDefiniteRightUpArc{sO{}mm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootPair{#3}{#4}%
@@ -911,7 +913,7 @@
 %% The starred form accepts <p> and <q> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinIndefiniteRightUpArc{sO{}mm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootPair{#3}{#4}%
@@ -943,7 +945,7 @@
 %% The starred form accepts <p> and <q> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinDefiniteLeftDownArc{sO{}mm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootPair{#3}{#4}%
@@ -964,7 +966,7 @@
 %% The starred form accepts <p> and <q> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinIndefiniteLeftDownArc{sO{}mm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootPair{#3}{#4}%
@@ -995,7 +997,7 @@
 %% The starred form accepts <p> and <q> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinDefiniteLeftUpArc{sO{}mm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootPair{#3}{#4}%
@@ -1016,7 +1018,7 @@
 %% The starred form accepts <p> and <q> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinIndefiniteLeftUpArc{sO{}mm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootPair{#3}{#4}%
@@ -1048,7 +1050,7 @@
 %% The starred form accepts <p> and <q> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinDefiniteSemiCircle{sO{}mm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootPair{#3}{#4}%
@@ -1069,7 +1071,7 @@
 %% The starred form accepts <p> and <q> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinIndefiniteSemiCircle{sO{}mm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootPair{#3}{#4}%
@@ -1101,7 +1103,7 @@
 %% The starred form accepts <p> and <q> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinDefiniteDoubleRightDownArc{sO{}mm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootPair{#3}{#4}%
@@ -1139,7 +1141,7 @@
 %% The starred form accepts <p> and <q> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinDefiniteDoubleUpRightArc{sO{}mm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootPair{#3}{#4}%
@@ -1177,7 +1179,7 @@
 %% The starred form accepts <p> and <q> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinDefiniteDoubleUpLeftArc{sO{}mm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootPair{#3}{#4}%
@@ -1217,7 +1219,7 @@
 %% The starred form accepts <p> and <q> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinDefiniteDoubleDownRightArc{sO{}mm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootPair{#3}{#4}%
@@ -1257,7 +1259,7 @@
 %% The starred form accepts <p> and <q> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinDefiniteDoubleRightUpArc{sO{}mm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootPair{#3}{#4}%
@@ -1294,7 +1296,7 @@
 %% The starred form accepts <p> and <q> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinDefiniteDoubleLeftDownArc{sO{}mm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootPair{#3}{#4}%
@@ -1332,7 +1334,7 @@
 %% The starred form accepts <p> and <q> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinDefiniteDoubleDownLeftArc{sO{}mm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootPair{#3}{#4}%
@@ -1371,7 +1373,7 @@
 %% The starred form accepts <p> and <q> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinDefiniteDoubleLeftUpArc{sO{}mm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootPair{#3}{#4}%
@@ -1409,7 +1411,7 @@
 %% The starred form accepts <p> and <q> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinDefiniteDoubleDownRightSemiCircle{sO{}mm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootPair{#3}{#4}%
@@ -1449,7 +1451,7 @@
 %%% The starred form accepts <p> and <q> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinDefiniteTripleDownRightSemiCircle{sO{}mm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootPair{#3}{#4}%
@@ -1498,7 +1500,7 @@
 %% The starred form accepts <p> and <q> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinDefiniteDoubleUpRightSemiCircle{sO{}mm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootPair{#3}{#4}%
@@ -1536,7 +1538,7 @@
 %% The starred form accepts <p> and <q> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinEdge{sO{}mmm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootPair{#4}{#5}%
@@ -1564,7 +1566,7 @@
 %% The starred form accepts <p> and <q> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinEdgeArrow{sO{}mm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\ifdynkin@arrows%
 		\IfBooleanTF{#1}%
 		{%
@@ -1576,24 +1578,32 @@
 		}%
 		\begin{pgfonlayer}{Dynkin behind}%%
 			\ifdynkin@reverse@arrows%
-				\path[
-				/Dynkin diagram/arrow shape,
-				tips] 
-					($(\dynkin@root@name \the\@dynkin@to@root)$) 
-					-- 
-					($.5*(\dynkin@root@name \the\@dynkin@to@root)%
-					+.5*(\dynkin@root@name \the\@dynkin@from@root)
-					-(.5*\dynkin@arrow@width,0)$);%
+				\node (from-arrow-node) 
+					at
+					($(\dynkin@root@name \the\@dynkin@to@root)$){};%
+				\node (to-arrow-node) 
+					at
+					($(\dynkin@root@name \the\@dynkin@from@root)$){};%
 			\else%
-				\path[
+				\node (from-arrow-node) 
+					at
+					($(\dynkin@root@name \the\@dynkin@from@root)$){};%
+				\node (to-arrow-node) 
+					at
+					($(\dynkin@root@name \the\@dynkin@to@root)$){};%
+			\fi%
+			\node (middle-node)
+				at
+				($.5*(from-arrow-node)+.5*(to-arrow-node)$){};%
+			\node (arrow-node)
+				at
+				($(middle-node)!.5*\dynkin@arrow@width!(to-arrow-node)$) {};%
+			\path[
 				/Dynkin diagram/arrow shape,
 				tips] 
-					($(\dynkin@root@name \the\@dynkin@from@root)$) 
-					-- 
-					($.5*(\dynkin@root@name \the\@dynkin@from@root)+%
-					.5*(\dynkin@root@name \the\@dynkin@to@root)
-					+(.5*\dynkin@arrow@width,0)$);%
-			\fi%
+				($(from-arrow-node)$) 
+				-- 
+				($(arrow-node)$);%
 		\end{pgfonlayer}%%
 	\fi%
 }%
@@ -1678,7 +1688,7 @@
 %% The starred form accepts <p> and <q> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinDefiniteDoubleEdge{sO{}mm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootPair{#3}{#4}%
@@ -1764,7 +1774,7 @@
 %% The starred form accepts <p> and <q> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinTripleEdge{sO{}mm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootPair{#3}{#4}%
@@ -1859,7 +1869,7 @@
 %% The starred form accepts <p> and <q> in the Bourbaki ordering.
 \NewDocumentCommand\dynkinQuadrupleEdge{sO{}mm}%
 {%
-	\ifdefined\filldraw\else\dynkin@error@not@in@tikz\fi%
+	\dynkin@check@if@in@tikZ%	
 	\IfBooleanTF{#1}%
 	{%
 		\convertRootPair{#3}{#4}%
@@ -2616,7 +2626,7 @@
 {%
 	\dynkin@first@root@no=#1\relax%
 	\dynkin@second@root@no=#2\relax%
-	\ifnum\the\dynkin@first@root@no<\the\dynkin@second@root@no%
+	\ifnum\the\dynkin@first@root@no<\the\dynkin@second@root@no\relax%
 		\listxadd\dynkin@indefinite@edge@list{\the\dynkin@first@root@no,\the\dynkin@second@root@no}%
 	\else%
 		\listxadd\dynkin@indefinite@edge@list{\the\dynkin@second@root@no,\the\dynkin@first@root@no}%
@@ -2652,7 +2662,7 @@
 	% Next we sort the order, since edges are stored as undirected edges.
 	\global\dynkin@first@root@no=\@dynkin@from@root\relax%
 	\global\dynkin@second@root@no=\@dynkin@to@root\relax%
-	\ifnum\the\dynkin@second@root@no<\the\dynkin@first@root@no%
+	\ifnum\the\dynkin@second@root@no<\the\dynkin@first@root@no\relax%
 		\global\dynkin@first@root@no=\@dynkin@to@root\relax%
 		\global\dynkin@second@root@no=\@dynkin@from@root\relax%
 	\fi%
@@ -2680,7 +2690,7 @@
 		{%
 			\dynkin@Root@Numbrpo=\dynkin@Root@Numbr\relax%
 			\advance\dynkin@Root@Numbrpo by 1\relax%
-			\ifnum\the\dynkin@Root@Numbr<\the\dynkin@nodes%
+			\ifnum\the\dynkin@Root@Numbr<\the\dynkin@nodes\relax%
 				\dynkin@set@edge@indefinite{\dynkin@Root@Numbr}{\dynkin@Root@Numbrpo}%
 			\fi%
 		}%
@@ -2848,7 +2858,7 @@
 \NewDocumentCommand\dynkin@grok@series{}%
 {%
 	\StrLen{\dynkin@series}[\dynkin@lenny]
-	\ifnum\dynkin@lenny>1%
+	\ifnum\dynkin@lenny>1\relax%
 		\dynkin@error@series%
 	\fi%
 	\edef\series{\dynkin@series}%
@@ -2982,7 +2992,7 @@
 				{}{%
 					\global\dynkin@Satake@diagramfalse%
 					\ifdynkin@is@extended%
-							\ifnum\dynkin@ply=4%
+							\ifnum\dynkin@ply=4\relax%
 								\gdef\dynkin@string{dddd.d.ddddd}
 							\else%
 								\gdef\dynkin@string{ddd.dddd}%
@@ -3171,8 +3181,8 @@
 		{D}{}%
 		{E}%
 		{%
-			\ifnum\dynkin@nodes=5%
-				\ifnum\dynkin@rank=6%
+			\ifnum\dynkin@nodes=5\relax%
+				\ifnum\dynkin@rank=6\relax%
 					\IfStrEq{\dynkin@twisted@series}{2}%
 					{%
 					}%
@@ -3183,11 +3193,11 @@
 					\dynkin@error@rank%
 				\fi%
 			\else
-				\ifnum\dynkin@rank=6%
+				\ifnum\dynkin@rank=6\relax%
 				\else%
-					\ifnum\dynkin@rank=7%
+					\ifnum\dynkin@rank=7\relax%
 					\else%
-						\ifnum\dynkin@rank=8%
+						\ifnum\dynkin@rank=8\relax%
 						\else%
 							\IfStrEq{\dynkin@ordering}{Kac}{}{\dynkin@error@rank}%
 						\fi%
@@ -3197,14 +3207,14 @@
 		}%
 		{F}%
 		{%
-			\ifnum\dynkin@rank=4%
+			\ifnum\dynkin@rank=4\relax%
 			\else%
 				\dynkin@error@rank%
 			\fi%
 		}%
 		{G}%
 		{%
-			\ifnum\dynkin@rank=2%
+			\ifnum\dynkin@rank=2\relax%
 			\else%
 				\dynkin@error@rank%
 			\fi%
@@ -3228,11 +3238,11 @@
 %% let \dynkin@Root@Number be <r>.
 \NewDocumentCommand\swapRootIfInLastTwoRoots{m}%
 {%
-	\ifnum\dynkin@rank>1%
-		\ifnum\dynkin@rank=#1%
+	\ifnum\dynkin@rank>1\relax%
+		\ifnum\dynkin@rank=#1\relax%
 			\global\dynkin@Root@Number=\the\dynkin@rank@minus@one\relax%
 		\else%
-			\ifnum\dynkin@rank@minus@one=#1%
+			\ifnum\dynkin@rank@minus@one=#1\relax%
 				\global\dynkin@Root@Number=\the\dynkin@rank\relax%
 			\else%
 				\global\dynkin@Root@Number=#1\relax%
@@ -3246,11 +3256,11 @@
 \NewDocumentCommand\swap@if@in@last@two{mm}%
 {%
 	\global\dynkin@r=#2\relax%
-	\ifnum\dynkin@r=#1%
+	\ifnum\dynkin@r=#1\relax%
 		\global\advance \dynkin@r by -1\relax%
 	\else%
 		\global\advance \dynkin@r by 1\relax%
-		\ifnum\dynkin@r=#1%
+		\ifnum\dynkin@r=#1\relax%
 		\else%
 			\global\advance \dynkin@r by -1\relax%
 		\fi%
@@ -3304,7 +3314,7 @@
 			}%
 			{E}%
 			{%
-					\ifnum#2=6%
+					\ifnum#2=6\relax%
 							\IfStrEqCase{#3}%
 							{%
 								{Adams}%
@@ -3337,7 +3347,7 @@
 							}%
 							[\global#5=#4\relax]%
 					\else%
-						\ifnum#2=7%
+						\ifnum#2=7\relax%
 							\IfStrEqCase{#3}%
 							{%
 								{Adams}%
@@ -3371,7 +3381,7 @@
 							}%
 							[\global#5=#4\relax]%
 						\else%
-							\ifnum#2=8%
+							\ifnum#2=8\relax%
 								\IfStrEqCase{#3}%
 								{%
 									{Adams}%
@@ -3483,7 +3493,7 @@
 		}%
 		{E}%
 		{%
-				\ifnum#2=6%
+				\ifnum#2=6\relax%
 						\IfStrEqCase{#4}%
 						{%
 							{Adams}%
@@ -3517,7 +3527,7 @@
 						}%
 						[\global#5=#3\relax]%
 				\else%
-					\ifnum#2=7%
+					\ifnum#2=7\relax%
 						\IfStrEqCase{#4}%
 						{%
 							{Adams}%
@@ -3547,7 +3557,7 @@
 						}%
 						[\global#5=#3\relax]%
 					\else%
-						\ifnum#2=8%
+						\ifnum#2=8\relax%
 							\IfStrEqCase{#4}%
 							{%
 								{Adams}%
@@ -3661,7 +3671,7 @@
 				{%
 					\global\dynkin@Root@Number=#1\relax%
 					\global\advance\dynkin@Root@Number by 1\relax%
-					\ifnum\dynkin@Root@Number>\the\dynkin@rank%
+					\ifnum\dynkin@Root@Number>\the\dynkin@rank\relax%
 						\global\dynkin@Root@Number=1\relax%
 					\fi%
 				}%
@@ -3692,7 +3702,7 @@
 			\ifdynkin@is@twisted%
 				\global\dynkin@Root@Number=#1\relax%
 			\else%
-				\ifnum\dynkin@rank=6%
+				\ifnum\dynkin@rank=6\relax%
 						\IfStrEqCase{\dynkin@ordering}%
 						{%
 							{Adams}{\global\dynkin@Root@Number=\stringCharacterInPosition{152436}{#1}\relax}%
@@ -3702,7 +3712,7 @@
 						}%
 						[\global\dynkin@Root@Number=#1\relax]%
 				\else%
-					\ifnum\dynkin@rank=7%
+					\ifnum\dynkin@rank=7\relax%
 						\IfStrEqCase{\dynkin@ordering}%
 						{%
 							{Adams}{\global\dynkin@Root@Number=\stringCharacterInPosition{6354217}{#1}\relax}%
@@ -3712,7 +3722,7 @@
 						}%
 						[\global\dynkin@Root@Number=#1\relax]%			
 					\else%
-						\ifnum\dynkin@rank=8%
+						\ifnum\dynkin@rank=8\relax%
 							\IfStrEqCase{\dynkin@ordering}%
 							{%
 								{Adams}{\global\dynkin@Root@Number=\stringCharacterInPosition{13245678}{#1}\relax}%
@@ -3769,7 +3779,7 @@
 {%
 	\test@bit@a#1\relax%
 	\test@bit@b#2\relax%
-	\ifnum\test@bit@a=0%
+	\ifnum\test@bit@a=0\relax%
 		\global\bitfalse%
 	\else%
 		\global\test@bit@moretrue%
@@ -3797,11 +3807,11 @@
 \xdef\replacementRightString{}
 \NewDocumentCommand\replaceNthChar{mmm}%
 {%
-	\ifnum#2<1
+	\ifnum#2<1\relax%
 	\else%
 		\StrLen{#1}[\thatreplaceNthCounter]%
 		\replaceNthCounter\thatreplaceNthCounter\relax%
-		\ifnum\replaceNthCounter<#2
+		\ifnum\replaceNthCounter<#2\relax%
 		\else%
 			\replacementN#2\relax%
 			\advance\replacementN by -1\relax%
@@ -4265,19 +4275,19 @@
 %% Draws an A series Dynkin diagram.
 \NewDocumentCommand\Adynkin{}%
 {%
-	\ifnum\dynkin@rank=1%
+	\ifnum\dynkin@rank=1\relax%
 		\global\dynkin@ply=1\relax%
 	\fi%
 %	% Create the roots.
-	\ifnum\dynkin@ply>1%
-		\ifnum\dynkin@ply=2%
+	\ifnum\dynkin@ply>1\relax%
+		\ifnum\dynkin@ply=2\relax%
 			\dynkin@jump{1}%
 		\fi%
 		\dynkinPlaceRootHere*{1}{above}{below right}%
 		\dynkin@fold{1}{\the\dynkin@rank}%
 	\else%
 		\dynkinPlaceRootHere*{1}{below}{above}%
-		\ifnum\dynkin@rank>1%
+		\ifnum\dynkin@rank>1\relax%
 			\dynkin@pipe{1}%
 				{\the\dynkin@rank}%
 				{east}{below}{above}%
@@ -4288,9 +4298,9 @@
 %% Draw a B series Dynkin diagram.
 \NewDocumentCommand\Bdynkin{}%
 {%
-	\ifnum\dynkin@rank<2
-		\Adynkin
-	\else
+	\ifnum\dynkin@rank<2\relax%
+		\Adynkin%
+	\else%
 		\ifdynkin@Coxeter%
 			\Adynkin%
 			\dynkinEdgeLabel%
@@ -4298,8 +4308,8 @@
 				{\the\dynkin@rank}{4}%
 		\else
 			% Create the roots.
-			\ifnum\dynkin@ply>1%
-				\ifnum\dynkin@rank>3%
+			\ifnum\dynkin@ply>1\relax%
+				\ifnum\dynkin@rank>3\relax%
 					\dynkin@jump{1}%
 					\dynkinPlaceRootHere*{1}{above}{below right}%
 					\dynkinPlaceRootRelativeTo*%
@@ -4313,7 +4323,7 @@
 						{\the\dynkin@rank@minus@one}{\the\dynkin@rank}%
 					\dynkinEdge*{SingleEdge}{1}{2}%
 				\else%
-					\ifnum\dynkin@rank=2%
+					\ifnum\dynkin@rank=2\relax%
 						\dynkin@jump{1}%
 						\dynkinPlaceRootHere*{1}{above}{below right}%
 						\dynkinPlaceRootRelativeTo*{2}{1}%
@@ -4342,7 +4352,7 @@
 					{\the\dynkin@rank}%
 			\fi%
 			\ifdynkin@arrows%
-				\ifnum\dynkin@ply>1%
+				\ifnum\dynkin@ply>1\relax%
 					\dynkinLeftFold*{1}{\the\dynkin@rank}%
 				\fi%
 			\fi%
@@ -4371,8 +4381,8 @@
 {
 	% Create the roots.
 	\ifdynkin@is@extended%
-		\ifnum\dynkin@ply>1%
-			\ifnum\dynkin@rank=4%
+		\ifnum\dynkin@ply>1\relax%
+			\ifnum\dynkin@rank=4\relax%
 				\dynkinPlaceRootRelativeTo*%
 					{2}{0}%
 					{southeastfold}%
@@ -4389,7 +4399,7 @@
 				{left}{above left}%
 		\else%	
 			\ifdynkin@left@fold%	
-				\ifnum\dynkin@rank=4%
+				\ifnum\dynkin@rank=4\relax%
 					\dynkinPlaceRootRelativeTo*%
 						{2}{0}%
 						{southeastfold}%
@@ -4405,7 +4415,7 @@
 					{southwestfold}%
 					{left}{above left}%
 			\else%
-				\ifnum\dynkin@rank=4%
+				\ifnum\dynkin@rank=4\relax%
 					\ifdynkin@right@fold%
 						\dynkinPlaceRootRelativeTo*%
 							{2}{0}%
@@ -4432,13 +4442,13 @@
 		\dynkinMoveToRoot*{2}%
 	\else
 		\dynkinPlaceRootHere*{1}{below}{above}
-		\ifnum\dynkin@rank=4%
+		\ifnum\dynkin@rank=4\relax%
 			\ifdynkin@right@fold%
 				\dynkinPlaceRootRelativeTo*%
 					{2}{1}%
 					{east}{below}{above}%
 			\else%			
-				\ifnum\dynkin@ply>1%
+				\ifnum\dynkin@ply>1\relax%
 					\dynkinPlaceRootRelativeTo*%
 						{2}{1}%
 						{east}%
@@ -4457,17 +4467,17 @@
 				{below}{above}%
 		\fi%
 	\fi
-	\ifnum\dynkin@rank>2%
-		\ifnum\dynkin@rank>5%
+	\ifnum\dynkin@rank>2\relax%
+		\ifnum\dynkin@rank>5\relax%
 			\dynkinPlaceRootRelativeTo*{3}{2}{east}{below}{above}%
 		\else%
-			\ifnum\dynkin@ply>1%
+			\ifnum\dynkin@ply>1\relax%
 				\dynkinPlaceRootRelativeTo*%
 					{3}{2}%
 					{east}%
 					{below left}{above left}%
 			\else%
-					\ifnum\dynkin@rank=5%
+					\ifnum\dynkin@rank=5\relax%
 						\ifdynkin@right@fold%	
 							\dynkinPlaceRootRelativeTo*%
 								{3}{2}%
@@ -4487,14 +4497,14 @@
 					\fi%
 			\fi%
 		\fi%
-		\ifnum\dynkin@rank@minus@three>3%
+		\ifnum\dynkin@rank@minus@three>3\relax%
 			\dynkin@pipe%
 				{3}{\the\dynkin@rank@minus@three}%
 				{east}%
 				{below}{above}%
 		\fi%
-		\ifnum\dynkin@rank@minus@two>3%
-			\ifnum\dynkin@ply>1%
+		\ifnum\dynkin@rank@minus@two>3\relax%
+			\ifnum\dynkin@ply>1\relax%
 				\dynkinPlaceRootRelativeTo*%
 					{\dynkin@rank@minus@two}%
 					{\dynkin@rank@minus@three}%
@@ -4519,7 +4529,7 @@
 				{\dynkin@rank@minus@two}%
 				{\dynkin@rank@minus@three}%
 		\fi%
-		\ifnum\dynkin@ply=1%
+		\ifnum\dynkin@ply=1\relax%
 			\ifdynkin@right@fold%
 				\dynkinPlaceRootRelativeTo*%
 					{\the\dynkin@rank@minus@one}%
@@ -4557,13 +4567,13 @@
 \NewDocumentCommand\Ddynkin@edges{}%
 {%
 	% Draw the edges.
-	\ifnum\dynkin@ply>1%
+	\ifnum\dynkin@ply>1\relax%
 		\ifdynkin@is@extended%
 			\dynkinEdge*{RightUpArc}{1}{2}%
 		\else%
 			\dynkinEdge*{SingleEdge}{1}{2}%
 		\fi%
-		\ifnum\dynkin@rank>4%
+		\ifnum\dynkin@rank>4\relax%
 			\dynkinEdge*{SingleEdge}{2}{3}%
 		\fi%
 		\dynkinEdge*{LeftDownArc}%
@@ -4581,7 +4591,7 @@
 			\fi%
 		\fi%
 	\else%
-		\ifnum\dynkin@rank=4%
+		\ifnum\dynkin@rank=4\relax%
 		\else%
 			\dynkinEdge*{SingleEdge}{2}{3}%
 		\fi%
@@ -4685,9 +4695,9 @@
 %% Draws a D series Dynkin diagram.
 \NewDocumentCommand\Ddynkin{}%
 {%
-	\ifnum\dynkin@rank>3%
-		\ifnum\dynkin@rank=4%
-			\ifnum\dynkin@ply=3%
+	\ifnum\dynkin@rank>3\relax%
+		\ifnum\dynkin@rank=4\relax%
+			\ifnum\dynkin@ply=3\relax%
 				\DthreePly%
 			\else%
 				\Ddynkin@roots%
@@ -4700,9 +4710,9 @@
 	\else%
 		\gdef\dynkin@series{A}%
 		\Adynkin%
-		\ifnum\dynkin@ply>1%	
+		\ifnum\dynkin@ply>1\relax%
 			\ifdynkin@arrows%
-				\ifnum\dynkin@rank=1%
+				\ifnum\dynkin@rank=1\relax%
 				\else%
 					\dynkinLeftFold*{1}{\the\dynkin@rank}%
 				\fi%
@@ -4725,7 +4735,7 @@
 		{east}%
 		{below}{above right}%
 	\ifdynkin@is@extended%
-		\ifnum\dynkin@rank=6%
+		\ifnum\dynkin@rank=6\relax%
 			\dynkinPlaceRootRelativeTo*%
 				{2}{4}%
 				{north}%
@@ -4756,11 +4766,11 @@
 	\dynkinEdge*{SingleEdge}{3}{4}
 	\dynkinEdge*{SingleEdge}{4}{2}
 	\ifdynkin@is@extended%
-		\ifnum\dynkin@rank=6%
+		\ifnum\dynkin@rank=6\relax%
 			\dynkinPlaceRootRelativeTo*{0}{2}{north}{right}{above}%
 			\dynkinEdge*{SingleEdge}{0}{2}%
 		\else%
-			\ifnum\dynkin@rank=7%
+			\ifnum\dynkin@rank=7\relax%
 				\dynkinPlaceRootRelativeTo*%
 					{0}{1}%
 					{west}%
@@ -4780,10 +4790,10 @@
 %% Draws an E series Dynkin diagram not folded.
 \newcommand*{\Edynkin@unfolded}%
 {
-	\ifnum\dynkin@rank>8%
+	\ifnum\dynkin@rank>8\relax%
 		% We have to work in Kac ordering directly.
 		\dynkinPlaceRootHere*{1}{below}{above}%
-		\ifnum\dynkin@rank>1%
+		\ifnum\dynkin@rank>1\relax%
 			\dynkin@pipe%
 				{1}{\the\dynkin@rank@minus@one}%
 				{east}{below}%
@@ -4802,8 +4812,8 @@
 %% Draws a folded E6, affine E6 or affine E7 Dynkin diagram.
 \NewDocumentCommand\Edynkin@folded{}%
 {%
-	\ifnum\dynkin@rank=6%
-		\ifnum\dynkin@ply=2\ESixTwoPly\else\ESixThreePly\fi%
+	\ifnum\dynkin@rank=6\relax%
+		\ifnum\dynkin@ply=2\relax\ESixTwoPly\else\ESixThreePly\fi%
 	\else%
 		\extendedESevenFolded%
 	\fi%
@@ -4905,7 +4915,7 @@
 		\ifnum\dynkin@rank=6\relax%
 			\Edynkin@folded%
 		\else%
-			\ifnum\dynkin@rank=7
+			\ifnum\dynkin@rank=7\relax
 				\ifdynkin@is@extended
 					\Edynkin@folded%
 				\else%
@@ -4994,7 +5004,7 @@
 			($(\dynkin@root@name \the\dynkin@Root@Number)-(\dynkin@root@radius,0)$);%
 		\end{pgfonlayer}%%
 	\else%
-		\ifnum\dynkin@ply=4%
+		\ifnum\dynkin@ply=4\relax%
 			\node (Dynkin current) at ($(Dynkin current)+(0,\dynkin@edge@length)$){};%
 			\dynkinPlaceRootHere*{0}{left}{above}%
 			\dynkinPlaceRootRelativeTo*{1}{0}{east}{right}{above}%
@@ -5008,7 +5018,7 @@
 			\dynkinFold*{1}{3}%
 		\else%
 			\Adynkin{}%
-			\ifnum\dynkin@ply>1%
+			\ifnum\dynkin@ply>1\relax%
 				\dynkinPlaceRootRelativeTo*{0}{1}{southwestfold}{left}{right}%
 				\dynkinEdge*{LeftDownArc}{1}{0}%
 				\dynkinEdge*{LeftUpArc}{\the\dynkin@rank}{0}%
@@ -5019,7 +5029,7 @@
 					+.5*(\dynkin@root@name \the\dynkin@rank)$)%
 					{};%
 				\dynkinNorth%
-				\dynkinPlaceRootHere*{0}{below}{above}%
+				\dynkinPlaceRootHere*{0}{above}{below}%
 				\dynkinEdge*{SingleEdge}{0}{1}%
 				\dynkinEdge*{SingleEdge}{\the\dynkin@rank}{0}%
 			\fi%
@@ -5030,7 +5040,7 @@
 
 \NewDocumentCommand\extendedBthreePly{}%
 {%
-	\ifnum\dynkin@rank=3%
+	\ifnum\dynkin@rank=3\relax%
 	\else%
 		\ClassError%
 			{Dynkin diagrams}%
@@ -5096,7 +5106,7 @@
 					\dynkinEdge*{SingleEdge}{1}{2}%
 				\fi%
 				\dynkin@bmo=2\relax%
-				\ifnum\dynkin@rank>3%
+				\ifnum\dynkin@rank>3\relax%
 					\foreach \dynkin@b in {3,...,\the\dynkin@rank@minus@one}%
 					{%
 						\dynkinPlaceRootRelativeTo*%
@@ -5107,7 +5117,7 @@
 						\global\advance\dynkin@bmo by 1\relax%
 					}%
 				\fi%
-				\ifnum\dynkin@ply<3%
+				\ifnum\dynkin@ply<3\relax%
 					\dynkinPlaceRootRelativeTo*%
 						{\the\dynkin@rank}%
 						{\the\dynkin@rank@minus@one}%
@@ -5121,7 +5131,7 @@
 						{\the\dynkin@rank@minus@one}%
 						{\the\dynkin@rank}{4}%
 				\else%
-					\ifnum\dynkin@ply<3%
+					\ifnum\dynkin@ply<3\relax%
 						\dynkinEdge*{DoubleEdge}%
 							{\the\dynkin@rank@minus@one}%
 							{\the\dynkin@rank}%
@@ -5249,26 +5259,26 @@
 %% Draws an D series affine Dynkin/Coxeter diagram.
 \NewDocumentCommand\extendedDdynkin{}%
 {%
-	\ifnum\dynkin@ply=4%
-		\ifnum\dynkin@rank=4%
+	\ifnum\dynkin@ply=4\relax%
+		\ifnum\dynkin@rank=4\relax%
 			\DOneFourFourPly%
 		\else%
 			\DfourPly%
 		\fi%
 	\else%
-		\ifnum\dynkin@ply=3%
+		\ifnum\dynkin@ply=3\relax%
 			\extendedDthreePly%
 		\else%
-			\ifnum\the\dynkin@rank=1%
+			\ifnum\the\dynkin@rank=1\relax%
 				\extendedAdynkin%
 			\else%
-				\ifnum\the\dynkin@rank=4%
+				\ifnum\the\dynkin@rank=4\relax%
 					\global\dynkin@hex@gridfalse
 				\fi
 				\dynkin@hop{1}%
 				\dynkinPlaceRootHere*{0}{left}{above left}%
 				\Ddynkin%
-				\ifnum\dynkin@ply=2%
+				\ifnum\dynkin@ply=2\relax%
 					\dynkinEdge*{RightDownArc}{0}{2}%
 				\else%
 					\ifdynkin@left@fold%
@@ -5277,7 +5287,7 @@
 						\dynkinEdge*{SingleEdge}{0}{2}%
 					\fi%
 				\fi%
-				\ifnum\the\dynkin@rank=4%
+				\ifnum\the\dynkin@rank=4\relax%
 					\global\dynkin@hex@gridtrue
 				\fi
 			\fi%
@@ -5294,7 +5304,7 @@
 %% Draws an F series affine Dynkin/Coxeter diagram.
 \newcommand*{\extendedFdynkin}%
 {%
-	\ifnum\dynkin@ply=1%
+	\ifnum\dynkin@ply=1\relax%
 		\dynkinPlaceRootHere*{0}{below}{above}%
 		\dynkinEast%
 		\Fdynkin%
@@ -5408,13 +5418,13 @@
 			\dynkinEdge*{DoubleEdge}%
 				{\the\dynkin@nodes}%
 				{\the\dynkin@height@minus@one}%
-			\ifnum\dynkin@ply>1%	
+			\ifnum\dynkin@ply>1\relax%
 				\dynkinLeftFold*{0}{1}%
 			\fi%			
 		\else%
-			\ifnum\dynkin@nodes>1%
-				\ifnum\dynkin@ply>1%	
-					\ifnum\dynkin@height@minus@one>1%
+			\ifnum\dynkin@nodes>1\relax%
+				\ifnum\dynkin@ply>1\relax%
+					\ifnum\dynkin@height@minus@one>1\relax%
 						\dynkin@jump{1}%
 					\fi%
 					\dynkinPlaceRootHere*{0}{below}{above}%
@@ -5423,7 +5433,7 @@
 						{east}%
 						{below left}{above}%
 					\dynkinEdge*{DoubleEdge}{1}{0}%
-					\ifnum\dynkin@height@minus@one>1%
+					\ifnum\dynkin@height@minus@one>1\relax%
 						\dynkin@fold{1}{\the\dynkin@height@minus@one}%
 					\fi%
 					\dynkinPlaceRootRelativeTo*%
@@ -5439,7 +5449,7 @@
 						{east}%
 						{below right}{above}%
 					\dynkinEdge*{DoubleEdge}{1}{0}%
-					\ifnum\dynkin@height@minus@one>1%
+					\ifnum\dynkin@height@minus@one>1\relax%
 						\dynkin@pipe{1}{\the\dynkin@height@minus@one}%
 						{east}{below}{above}%
 					\fi%
@@ -5474,7 +5484,7 @@
 		{2}{\twistedDTwo}%
 		{3}%
 		{%
-			\ifnum\dynkin@rank=4%
+			\ifnum\dynkin@rank=4\relax%
 				\dynkinPlaceRootHere*{0}{below}{above}%
 				\dynkinPlaceRootRelativeTo*{1}{0}{east}{below}{above}%
 				\dynkinPlaceRootRelativeTo*{2}{1}{east}{below}{above}%
@@ -5494,14 +5504,14 @@
 {%
 	\dynkin@nodes@minus@one\dynkin@nodes\relax%
 	\advance\dynkin@nodes@minus@one by -1\relax%
-	\ifnum\dynkin@rank<3%
+	\ifnum\dynkin@rank<3\relax%
 		\ClassError{Dynkin diagrams}{D2 series twisted diagrams cannot have rank \the\dynkin@rank}{}%
 	\fi%
-	\ifnum\dynkin@ply=1%
+	\ifnum\dynkin@ply=1\relax%
 		\dynkinPlaceRootHere*{0}{below}{above}%
 		\dynkinPlaceRootRelativeTo*{1}{0}{east}{below}{above}%
 	\else%
-		\ifnum\dynkin@rank=3%
+		\ifnum\dynkin@rank=3\relax%
 			\dynkin@jump{1}%
 			\dynkinPlaceRootHere*{0}{above}{right}%
 			\dynkinPlaceRootRelativeTo*{1}{0}{southwestfold}{left}{right}%
@@ -5511,7 +5521,7 @@
 			\dynkinPlaceRootRelativeTo*{1}{0}{east}{above}{below}%
 		\fi%
 	\fi%
-	\ifnum\dynkin@ply=2%
+	\ifnum\dynkin@ply=2\relax%
 		\dynkinEdge*{DoubleUpRightArc}{1}{0}%
 	\else
 		\dynkinEdge*{DoubleEdge}{1}{0}%
@@ -5528,7 +5538,7 @@
 			\dynkinFold*{0}{2}%
 		\fi%
 	\else%
-		\ifnum\dynkin@rank>2%
+		\ifnum\dynkin@rank>2\relax%
 			\dynkin@pipe{1}{\the\dynkin@nodes@minus@one}{east}{below}{above}%
 		\fi%
 		\dynkinPlaceRootRelativeTo*%
-- 
cgit v1.2.3

