summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-11-18 21:46:02 +0000
committerKarl Berry <karl@freefriends.org>2017-11-18 21:46:02 +0000
commitba6f6ac5705667b8a0d7d3ddcb50a275d06278a1 (patch)
tree3aa4f40ac2adb0053b3e32e9b14958cef33b6c0a /Master/texmf-dist/tex
parent9746eec6f52784c17ea0fdd0c1d47e8deb9ca0f8 (diff)
dynkin-diagrams (18nov17)
git-svn-id: svn://tug.org/texlive/trunk@45846 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/dynkin-diagrams/dynkin-diagrams.sty1728
1 files changed, 1433 insertions, 295 deletions
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 5626893c931..8ed53464f8f 100644
--- a/Master/texmf-dist/tex/latex/dynkin-diagrams/dynkin-diagrams.sty
+++ b/Master/texmf-dist/tex/latex/dynkin-diagrams/dynkin-diagrams.sty
@@ -1,347 +1,1485 @@
+%
+%
+% The Dynkin Diagrams package.
+%
+% Version 2
+%
+%
+% This package draws Dynkin diagrams in LaTeX documents, using the TikZ package.
+% Please see the file dynkin-diagrams.tex for examples of use of this package.
+%
+% Benjamin McKay
+% b.mckay@ucc.ie
+%
+% 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}[2016/06/28 Dynkin diagrams]
-
+\ProvidesPackage{dynkin-diagrams}[2017/11/14 Dynkin diagrams]
\RequirePackage{tikz}
\RequirePackage{xstring}
+\RequirePackage{xparse}
\RequirePackage{etoolbox}
+\RequirePackage{expl3}
\RequirePackage{pgfkeys}
+\RequirePackage{pgfopts}
\usetikzlibrary{decorations.markings}
-
-\ProcessOptions\relax
-
+\usetikzlibrary{arrows,arrows.meta}
+\usetikzlibrary{calc}
%%
-%% Application programming interface:
+%% Application programming interface:
+%% See dynkin-diagrams.tex file for examples of use.
%%
-\newcommand*{\dynk}[3][]{%%
-\tikz[baseline=-\the\dimexpr\fontdimen22\textfont2\relax ] \dynkin[#1]{#2}{#3};%
-}%%
-
-% See test1.tex file for examples of use.
-
-\newcommand*{\dynkin}[3][]{
-\pgfkeys{/dynkin, default, #1}%
-\IfStrEq{#3}{*}{}{\dynkinrank=#3}
-\IfStrEq{#2}{A}{\Adynkin[\dynkinparabolic]{#3}}{}
-\IfStrEq{#2}{B}{\Bdynkin[\dynkinparabolic]{#3}}{}
-\IfStrEq{#2}{C}{\Cdynkin[\dynkinparabolic]{#3}}{}
-\IfStrEq{#2}{D}{\Ddynkin[\dynkinparabolic]{#3}}{}
-\IfStrEq{#2}{E}{\Edynkin[\dynkinparabolic]{#3}}{}
-\IfStrEq{#2}{F}{\Ffourdynkin[\dynkinparabolic]{#3}}{}
-\IfStrEq{#2}{G}{\Gtwodynkin[\dynkinparabolic]}{}
-\IfStrEq{\dynkinlabeltheroots}{true}{\dynkinprintlabels}{}
-}
+\NewDocumentCommand\dynkin{O{}mm}%
+{%
+ \ifdefined\filldraw%
+ \@dynkin[#1]{#2}{#3}%
+ \else%
+ \tikz[baseline=-\the\dimexpr\fontdimen22\textfont2\relax ]{\@dynkin[#1]{#2}{#3}}%
+ \fi%
+}%
+
+%% \convertRootNumber{<n>}
+%% ->
+%% Converts <n> from Bourbaki ordering to the current ordering, storing the result in a count called \RootNumber.
+\NewDocumentCommand\convertRootNumber{m}%
+{%
+ \IfStrEq{#1}{0}
+ {
+ \global\RootNumber=0
+ }
+ {
+ \IfStrEqCase{\dynkinseries}%
+ {%
+ {E}%
+ {%
+ \ifnum\dynkinrank=6%
+ \IfStrEqCase{\dynkinordering}%
+ {%
+ {Adams}{\RootNumber=\stringcharacterinposition{152436}{#1}}%
+ {Carter}{\RootNumber=\stringcharacterinposition{142356}{#1}}%
+ {Dynkin}{\RootNumber=\stringcharacterinposition{162345}{#1}}%
+ {Kac}{\RootNumber=\stringcharacterinposition{162345}{#1}}%
+ }%
+ [\RootNumber=#1]%
+ \else%
+ \ifnum\dynkinrank=7%
+ \IfStrEqCase{\dynkinordering}%
+ {%
+ {Adams}{\RootNumber=\stringcharacterinposition{6354217}{#1}}%
+ {Carter}{\RootNumber=\stringcharacterinposition{7564321}{#1}}%
+ {Dynkin}{\RootNumber=\stringcharacterinposition{1723456}{#1}}%
+ {Kac}{\RootNumber=\stringcharacterinposition{1723456}{#1}}%
+ }%
+ [\RootNumber=#1]%
+ \else%
+ \ifnum\dynkinrank=8%
+ \IfStrEqCase{\dynkinordering}%
+ {%
+ {Adams}{\RootNumber=\stringcharacterinposition{13245678}{#1}}%
+ {Carter}{\RootNumber=\stringcharacterinposition{86754321}{#1}}%
+ {Dynkin}{\RootNumber=\stringcharacterinposition{18234567}{#1}}%
+ {Kac}{\RootNumber=\stringcharacterinposition{78654321}{#1}}%
+ }%
+ [\RootNumber=#1]%
+ \else%
+ \fi%
+ \fi%
+ \fi%
+ }%
+ {F}%
+ {%
+ \IfStrEqCase{\dynkinordering}%
+ {%
+ {Adams}{\RootNumber=\stringcharacterinposition{4321}{#1}}%
+ }%
+ [\RootNumber=#1]%
+ }%
+ {G}%
+ {%
+ \IfStrEqCase{\dynkinordering}%
+ {%
+ {Carter}{\RootNumber=\stringcharacterinposition{21}{#1}}%
+ {Dynkin}{\RootNumber=\stringcharacterinposition{21}{#1}}%
+ {Kac}{\RootNumber=\stringcharacterinposition{21}{#1}}%
+ }%
+ [\RootNumber=#1]%
+ }%
+ }%
+ [\RootNumber=#1]%
+ }
+}%
+
+\NewDocumentCommand\dynkinprint{m}%
+{%
+ \scalebox{\dynkintextscale}{\(#1\)}%
+}%
+
+%% \rootlabel{<n>}{<s>} or \rootlabel*{<n>}{<s>}
+%% ->
+%% Prints the label string <s> on the Dynkin diagram at root number <n>, in the current ordering convention.
+\NewDocumentCommand\rootlabel{smm}%
+{%
+ \IfBooleanTF{#1}%
+ {\node at (root label swap #2) {\dynkinprint{#3}};}%
+ {\node at (root label #2) {\dynkinprint{#3}};}%
+}%
+
+%% \dynkinprintlabels
+%% ->
+%% Prints the default labels on the Dynkin diagram, in the given ordering.
+\newcommand{\dynkinprintlabels}%
+{%
+ \foreach \i in {1,...,\the\dynkinrank}%
+ {\rootlabel{\i}{\i}}%
+ \ifisaffine\rootlabel{0}{0}\fi%
+}%
+
+%% \dynkincross{<n>}
+%% ->
+%% Prints a cross at root <n> on the current Dynkin diagram.
+%% The starred form accepts <n> in the Bourbaki ordering.
+\NewDocumentCommand\dynkincross{sO{}m}%
+{%
+ \IfBooleanTF{#1}%
+ {%
+ \convertRootNumber{#3}%
+ }%
+ {%
+ \RootNumber=#3%
+ }%
+ \draw[\dynkincrossstyle,\dynkincolor,#2]%
+ ($(root \the\RootNumber)+(\dynkinradius,\dynkinradius)$)%
+ --%
+ ($(root \the\RootNumber)-(\dynkinradius,\dynkinradius)$);%
+ \draw[\dynkincrossstyle,\dynkincolor]%
+ ($(root \the\RootNumber)+(-\dynkinradius,\dynkinradius)$)%
+ --%
+ ($(root \the\RootNumber)+(\dynkinradius,-\dynkinradius)$);%
+}%
+
+%% \dynkinopendot{<n>}
+%% ->
+%% Prints an open dot at root <n> on the current Dynkin diagram.
+%% The starred form accepts <n> in the Bourbaki ordering.
+\NewDocumentCommand\dynkinopendot{sO{}m}%
+{%
+ \IfBooleanTF{#1}%
+ {%
+ \convertRootNumber{#3}%
+ }%
+ {%
+ \RootNumber=#3%
+ }%
+ \fill[\dynkinbackcolor,draw=\dynkincolor,#2] (root \the\RootNumber) circle (\dynkinradius);%
+}%
+%% \dynkincloseddot{<n>}
+%% ->
+%% Prints a closed dot at root <n> on the current Dynkin diagram.
+%% The starred form accepts <n> in the Bourbaki ordering.
+\NewDocumentCommand\dynkincloseddot{sO{}m}%
+{%
+ \IfBooleanTF{#1}%
+ {%
+ \convertRootNumber{#3}%
+ }%
+ {%
+ \RootNumber=#3%
+ }%
+ \fill[\dynkincolor,draw=\dynkincolor,#2] (root \the\RootNumber) circle (\dynkinradius);%
+}%
+
+%% \dynkindot{<n>}
+%% ->
+%% Prints a dot at root <n> on the current Dynkin diagram in the default style.
+%% The starred form accepts <n> in the Bourbaki ordering.
+\NewDocumentCommand\dynkindot{sO{}m}%
+{%
+ \IfBooleanTF{#1}%
+ {%
+ \ifnum#3=0%
+ \ifdynkinopendots%
+ \dynkincloseddot*[#2]{0}%
+ \else%
+ \dynkinopendot*[#2]{0}%
+ \fi%
+ \else%
+ \ifdynkinopendots%
+ \dynkinopendot*[#2]{#3}%
+ \else%
+ \dynkincloseddot*[#2]{#3}%
+ \fi%
+ \fi%
+ }%
+ {%
+ \ifnum#3=0%
+ \ifdynkinopendots%
+ \dynkincloseddot[#2]{0}%
+ \else%
+ \dynkinopendot[#2]{0}%
+ \fi%
+ \else%
+ \ifdynkinopendots%
+ \dynkinopendot[#2]{#3}%
+ \else%
+ \dynkincloseddot[#2]{#3}%
+ \fi%
+ \fi%
+ }%
+}%
+
+%% \dynkinline{<p>}{<q>}
+%% ->
+%% Draws a single line from root <p> to root <q> on the current Dynkin diagram in the current label ordering.
+%% The starred form accepts <p> and <q> in the Bourbaki ordering.
+\NewDocumentCommand\dynkinline{sO{}mm}%
+{%
+ \IfBooleanTF{#1}%
+ {%
+ \convertRootPair{#3}{#4}%
+ }%
+ {%
+ \@fromRoot=#3%
+ \@toRoot=#4%
+ }%
+ \draw[\dynkincolor,\dynkinedgestyle,#2] ($(root \the\@fromRoot)$) -- ($(root \the\@toRoot)$);%
+}%
+
+%% \dynkinfoldarrow{<p>}{<q>}
+%% ->
+%% Draws an arrow to represent folding from root <p> to root <q> on the current Dynkin diagram in the current label ordering.
+%% The starred form accepts <p> and <q> in the Bourbaki ordering.
+\NewDocumentCommand\dynkinfoldarrow{sO{}mm}%
+{%
+ \IfBooleanTF{#1}%
+ {%
+ \convertRootPair{#3}{#4}%
+ }%
+ {%
+ \@fromRoot=#3%
+ \@toRoot=#4%
+ }%
+ \draw[\dynkinfoldarrowstyle,\dynkinfoldarrowcolor,#2] (root \the\@fromRoot) -- (root \the\@toRoot);%
+}%
+
+%% \dynkindownarc{<p>}{<q>}
+%% ->
+%% Draws a quarter circle from root <p> to root <q> on the current Dynkin diagram in the current label ordering.
+%% The starred form accepts <p> and <q> in the Bourbaki ordering.
+\NewDocumentCommand\dynkindownarc{sO{}mm}%
+{%
+ \IfBooleanTF{#1}%
+ {%
+ \convertRootPair{#3}{#4}%
+ }%
+ {%
+ \@fromRoot=#3%
+ \@toRoot=#4%
+ }%
+ \draw[\dynkincolor,\dynkinedgestyle,#2] ($(root \the\@fromRoot)$) arc (90:0:\dynkinedgelength);%
+}%
+
+%% \dynkinuparc{<p>}{<q>}
+%% ->
+%% Draws a quarter circle from root <p> to root <q> on the current Dynkin diagram in the current label ordering.
+%% The starred form accepts <p> and <q> in the Bourbaki ordering.
+\NewDocumentCommand\dynkinuparc{sO{}mm}%
+{%
+ \IfBooleanTF{#1}%
+ {%
+ \convertRootPair{#3}{#4}%
+ }%
+ {%
+ \@fromRoot=#3%
+ \@toRoot=#4%
+ }%
+ \draw[\dynkincolor,\dynkinedgestyle,#2] ($(root \the\@fromRoot)$) arc (0:-90:\dynkinedgelength);%
+}%
+
+%% \dynkinsemicircle{<p>}{<q>}
+%% ->
+%% Draws a half circle from root <p> to root <q> on the current Dynkin diagram in the current label ordering.
+%% The starred form accepts <p> and <q> in the Bourbaki ordering.
+\NewDocumentCommand\dynkinsemicircle{sO{}mm}%
+{%
+ \IfBooleanTF{#1}%
+ {%
+ \convertRootPair{#3}{#4}%
+ }%
+ {%
+ \@fromRoot=#3%
+ \@toRoot=#4%
+ }%
+ \draw[\dynkincolor,\dynkinedgestyle,#2] ($(root \the\@fromRoot)$) arc (90:-90:\dynkinedgelength);%
+}%
+
+%% \dynkindots{<p>}{s<q>}
+%% ->
+%% Draws a dotted line from root <p> to root <q> on the current Dynkin diagram.
+%% The starred form accepts <p> and <q> in the Bourbaki ordering.
+\NewDocumentCommand\dynkindots{sO{}mm}%
+{%
+ \IfBooleanTF{#1}%
+ {%
+ \convertRootPair{#3}{#4}%
+ }%
+ {%
+ \@fromRoot=#3%
+ \@toRoot=#4%
+ }%
+ \draw[densely dotted,\dynkincolor,#2] ($(root \the\@fromRoot)$) -- ($(root \the\@toRoot)$);%
+}%
+
+%% \dynkindoubleline{<p>}{<q>}
+%% ->
+%% Draws an oriented double line from root <p> to root <q> on the current Dynkin diagram.
+%% The starred form accepts <p> and <q> in the Bourbaki ordering.
+\NewDocumentCommand\dynkindoubleline{sO{}mm}%
+{%
+ \IfBooleanTF{#1}%
+ {%
+ \convertRootPair{#3}{#4}%
+ }%
+ {%
+ \@fromRoot=#3%
+ \@toRoot=#4%
+ }%
+ \ifdynkinarrows%
+ \draw[double,postaction={decorate},\dynkincolor,\dynkinedgestyle,#2]%
+ ($(root \the\@fromRoot)$) -- ($(root \the\@toRoot)$);%
+ \else%
+ \draw[double,\dynkincolor,\dynkinedgestyle,#2]%
+ ($(root \the\@fromRoot)$) -- ($(root \the\@toRoot)$);%
+ \fi%
+}%
+
+%% \dynkintripleline{<p><q>}
+%% ->
+%% Draws an oriented triple line from root <p> to root <q> on the current Dynkin diagram.
+%% The starred form accepts <p> and <q> in the Bourbaki ordering.
+\NewDocumentCommand\dynkintripleline{sO{}mm}%
+{%
+ \IfBooleanTF{#1}%
+ {%
+ \convertRootPair{#3}{#4}%
+ }%
+ {%
+ \@fromRoot=#3%
+ \@toRoot=#4%
+ }%
+ \pgfmathparse{mod(div(\dynkinparabolic,2),2)}%
+ \let\onesbit\pgfmathresult%
+ \pgfmathparse{mod(div(\dynkinparabolic,4),2)}%
+ \let\twosbit\pgfmathresult%
+ \draw[\dynkincolor,fill=\dynkinbackcolor,\dynkinedgestyle,#2] %
+ ($(root \the\@fromRoot)$)%
+ --%
+ +(\onesbit*\dynkinradius,\dynkinradius)%
+ --%
+ ($(root \the\@toRoot)+(-\twosbit*\dynkinradius,\dynkinradius)$)%
+ --%
+ ($(root \the\@toRoot)$)%
+ --%
+ ($(root \the\@toRoot)-(\twosbit*\dynkinradius,\dynkinradius)$)%
+ --%
+ ($(root \the\@fromRoot)+(\onesbit*\dynkinradius,-\dynkinradius)$)%
+ --%
+ cycle;%
+ \ifdynkinarrows%
+ \draw[%
+ \dynkincolor,%
+ \dynkinedgestyle,%
+ -{Classical TikZ Rightarrow[length={3*\dynkinradius}]},%
+ #2%
+ ]%
+ ($(root \the\@toRoot)$) --%
+ ($.65*(root \the\@fromRoot)+.35*(root \the\@toRoot)$);%
+ \fi%
+ \draw[\dynkincolor,#2] ($(root \the\@fromRoot)$) -- ($(root \the\@toRoot)$);%
+}%
%%%
%%% Implementation:
%%%
-\newcount\dynkinrank
-
-\pgfkeys{
- /dynkin/.is family,
- /tikz/decoration={markings,mark=at position 0.7 with {\arrow{>}}},
- /dynkin,
- default/.style = {
- label = false,
- parabolic = 0,
- color = black,
- background color = white,
- dotradius=.04cm,
- edgelength=.35cm,
- crosssize=.07cm
- },
- label/.estore in = \dynkinlabeltheroots,
- parabolic/.estore in = \dynkinparabolic,
- color/.store in =\dynkincolor,
- background color/.store in =\dynkinbackcolor,
- dotradius/.estore in = \dynkinradius,
- edgelength/.estore in = \dykinedgelength,
- crosssize/.estore in = \dynkinXsize,
- .search also={/tikz},
-}
+\def\dynkinseries{A} % Which series of root system: A,B,C,D,E,F,G
+\newcount\dynkinrank % Which rank of root system: 1,2,...
+\newif\ifisaffine % Is this an affine extended root system?
+\newif\iflabeltheroots % Should we label the roots by the current root ordering convention?
+\newif\ifdynkinopendots % Should we draw the roots using open circles or closed dots?
+\newif\ifdynkinarrows % Should we draw arrows on Dynkin diagrams?
+\newif\ifdynkincoxeter % Should we draw Coxeter diagrams?
+\newif\ifdynkinfolded % Should we fold our Dynkin diagrams?
+
+\pgfkeys{%
+ /dynkin/.is family,%
+ /tikz/decoration={markings,mark=at position 0.7 with {\arrow{>}}},%
+ /dynkin,%
+ open/.is if = dynkinopendots,%
+ open=false,%
+ Coxeter/.is if = dynkincoxeter,%
+ Coxeter=false,%
+ arrows/.is if = dynkinarrows,%
+ arrows=true,%
+ dotradius/.estore in = \dynkinradius,%
+ dotradius=.05cm,%
+ color/.store in =\dynkincolor,%
+ backgroundcolor/.store in =\dynkinbackcolor,%
+ color = black,%
+ backgroundcolor = white,%
+ edge/.store in = \dynkinedgestyle,%
+ edge = thin,%
+ cross/.store in = \dynkincrossstyle,%
+ cross = thick,%
+ edgelength/.estore in = \dynkinedgelength,%
+ edgelength = .35cm,%
+ ordering/.store in = \dynkinordering,%
+ ordering = Bourbaki,%
+ textscale/.estore in = \dynkintextscale,%
+ textscale = 0.7,%
+ foldarrowstyle/.estore in = \dynkinfoldarrowstyle,%
+ foldarrowstyle = stealth-stealth,%
+ foldarrowcolor/.estore in = \dynkinfoldarrowcolor,%
+ foldarrowcolor = black!50,%
+ default/.style = {%
+ label/.is if = labeltheroots,%
+ label = false,%
+ parabolic = 0,%
+ affine/.is if = isaffine,%
+ affine = false,%
+ folded/.is if = dynkinfolded,%
+ folded=false,%
+ },%
+ parabolic/.estore in = \dynkinparabolic,%
+ .search also={/tikz},%
+}%
+\ProcessPgfPackageOptions{/dynkin}\relax
-\newcommand{\dynkinprintlabels}
+% *=not a Satake diagram
+% Anything else is the Roman numeral of the diagram, i.e. EVIII diagrams have numeral VIII.
+\gdef\dynkinSatake{*}
+
+\NewDocumentCommand\@dynkin{O{}mm}{%
+ \pgfkeys{/dynkin, default, #1}%
+ \xdef\dynkinseries{#2}%
+ \IfSubStr{ABCDEFGHI}{#2}{}{\errorSeries}%
+ \global\dynkinrank=0%
+ \xdef\dynkinSatake{#3}%
+ \newif\ifwerefolded
+ \ifdynkinfolded
+ \global\werefoldedtrue
+ \else
+ \global\werefoldedfalse
+ \fi
+ \IfInteger{#3}%
+ {%
+ \global\dynkinrank=#3%
+ \gdef\dynkinSatake{*}%
+ }%
+ {%
+ \IfStrEqCase{#2}%
+ {%
+ {A}%
+ {%
+ \IfStrEqCase{#3}%
+ {%
+ {*}{ }%
+ {I}{ }%
+ {II}{}%
+ {III}{}%
+ {IV} {}%
+ }%
+ [\errorRank]%
+ }%
+ {B}%
+ {%
+ \IfStrEqCase{#3}%
+ {%
+ {*}{ }%
+ {I}{}%
+ {II} {}%
+ }%
+ [\errorRank]%
+ }%
+ {C}%
+ {%
+ \IfStrEqCase{#3}%
+ {%
+ {*}{ }%
+ {I}{}%
+ {II} {}%
+ }%
+ [\errorRank]%
+ }%
+ {D}%
+ {%
+ \IfStrEqCase{#3}%
+ {%
+ {*}{ }%
+ {I}{ }%
+ {II} {}%
+ {III}{}%
+ }%
+ [\errorRank]%
+ }%
+ {E}%
+ {%
+ \IfStrEqCase{#3}%
+ {%
+ {I}{ \global\dynkinrank=6}%
+ {II}%
+ {%
+ \global\dynkinfoldedtrue%
+ \global\dynkinrank=6%
+ }%
+ {III}%
+ {%
+ \global\dynkinfoldedtrue%
+ \global\dynkinrank=6%
+ }%
+ {IV}%
+ {%
+ \global\dynkinrank=6%
+ }%
+ {V}%
+ {%
+ \global\dynkinrank=7%
+ }%
+ {VI}%
+ {%
+ \global\dynkinrank=7%
+ }%
+ {VII}%
+ {%
+ \global\dynkinrank=7%
+ }%
+ {VIII}%
+ {%
+ \global\dynkinrank=8%
+ }%
+ {XI}%
+ {%
+ \global\dynkinrank=8%
+ }%
+ }%
+ [\errorRank]%
+ }%
+ {F}%
+ {%
+ \global\dynkinrank=4%
+ \IfStrEqCase{#3}%
+ {%
+ {I}{ }%
+ {II} {}%
+ }%
+ [\errorRank]%
+ }%
+ {G}%
+ {%
+ \global\dynkinrank=2%
+ \IfStrEqCase{#3}%
+ {%
+ {I}{ }%
+ }%
+ [\errorRank]%
+ }%
+ {H}%
+ {%
+ \IfStrEqCase{#3}%
+ {%
+ {*}%
+ {%
+ }%
+ }%
+ [\errorRank]%
+ }%
+ {I}%
+ {%
+ \IfStrEqCase{#3}%
+ {%
+ {*}%
+ {%
+ }%
+ }%
+ [\errorRank]%
+ }%
+ }%
+ [\errorSeries]%
+ }%
+ \checkDynkinDiagram%
+ \ifisaffine%
+ \csname affine#2dynkin\endcsname%
+ \else%
+ \csname#2dynkin\endcsname%
+ \fi%
+ \iflabeltheroots\dynkinprintlabels\fi%
+ \ifwerefolded
+ \global\dynkinfoldedtrue
+ \else
+ \global\dynkinfoldedfalse
+ \fi
+}%
+
+%% \stringcharacterinposition{<s>}{<n>}
+%% -> the element of string <s> in position <n>.
+\ExplSyntaxOn
+\cs_new:Npn \stringcharacterinposition #1 #2
{
-\newcount\rmo
-\rmo=\dynkinrank
-\advance\rmo by -1
-\foreach \i in {0,...,\the\rmo}
+\str_item:fn { #1 } { #2 }
+}
+\cs_generate_variant:Nn \str_item:nn {f}
+\ExplSyntaxOff
+
+\NewDocumentCommand\errorRootOrdering{}
+{%
+ \ClassWarning{Unrecognized root ordering: ``\dynkinordering'' in Dynkin diagram}%
+}%
+
+\NewDocumentCommand\errorRank{}%
+{%
+ \ClassWarning{Unrecognized \dynkinseries{} series rank: ``\the\dynkinrank'' in Dynkin diagram}%
+}%
+
+\NewDocumentCommand\errorSeries{}%
+{%
+ \ClassWarning{Unrecognized series ``\dynkinseries{}'' in Dynkin diagram}%
+}%
+
+%% \checkDynkinDiagram
+%% ->
+%% Raises error messages for erroneous inputs.
+\NewDocumentCommand\checkDynkinDiagram{}%
+{%
+ \IfStrEqCase{\dynkinordering}%
+ {%
+ {Adams}{}%
+ {Bourbaki}{}%
+ {Carter}{}%
+ {Dynkin}{}%
+ {Kac}{}%
+ }%
+ [\ClassWarning{Unrecognized label ordering: ``\dynkinordering'' in Dynkin diagram}]%
+ \IfStrEqCase{\dynkinseries}%
+ {%
+ {A}{}%
+ {B}{}%
+ {C}{}%
+ {D}{}%
+ {E}%
+ {%
+ \ifnum\dynkinrank=6%
+ \else%
+ \ifnum\dynkinrank=7%
+ \else%
+ \ifnum\dynkinrank=8%
+ \else%
+ \errorRank%
+ \fi%
+ \fi%
+ \fi%
+ }%
+ {F}%
+ {%
+ \ifnum\dynkinrank=4%
+ \else%
+ \errorRank%
+ \fi%
+ }%
+ {G}%
+ {%
+ \ifnum\dynkinrank=2%
+ \else%
+ \errorRank%
+ \fi%
+ }%
+ {H}{}%
+ {I}{}%
+ }%
+ [\errorSeries]%
+}%
+
+% We store the number of a root, converted to the current root ordering convention, here.
+\newcount\RootNumber
+
+% A slight headache: all of the routines that draw Dynkin diagrams are written
+% in Bourbaki ordering. We store the roots in the current ordering.
+% So when we draw edges, we need to convert from the Bourbaki ordering each time.
+% We store the conversions here.
+\newcount\@fromRoot
+\newcount\@toRoot
+
+%% \convertRootPair{<p>}{<q>}
+%% ->
+%% Stores conversions in \@fromRoot and \@toRoot.
+\NewDocumentCommand\convertRootPair{mm}
+{%
+ \convertRootNumber{#1}%
+ \@fromRoot=\RootNumber%
+ \convertRootNumber{#2}%
+ \@toRoot=\RootNumber%
+}%
+
+%% \testbit{<n>}{<b>}{<f>}{<g>}
+%% If bit number <b> of <n> is 1 then expand <f> else expand <g>.
+\newcommand*{\testbit}[4]%
+{%
+ \pgfmathparse{int(mod(div(#1,2^(#2)),2))}%
+ \let\tf\pgfmathresult%
+ \IfStrEq{\tf}{1}{#3}{#4}%
+}%
+
+%% \placeRoot{<n>}{<x>}{<y>}
+%% ->
+%% Tell TikZ where to place node <n> (in Bourbaki ordering) for a root of a Dynkin diagram. Draws nothing.
+%% Starred form swaps label positions.
+\NewDocumentCommand\placeRoot{smmm}%
+{%
+ \convertRootNumber{#2}%
+ \node (root \the\RootNumber) at ({(#3)*\dynkinedgelength},{(#4)*\dynkinedgelength}) {};%
+ \IfBooleanTF{#1}%
+ {%
+ \node[above] (root label \the\RootNumber)%
+ at ({(#3)*\dynkinedgelength},{((#4)*\dynkinedgelength)+2*\dynkinradius}) {};%
+ \node[below] (root label swap \the\RootNumber)%
+ at ({(#3)*\dynkinedgelength},{((#4)*\dynkinedgelength)-2*\dynkinradius}) {};%
+ }%
+ {%
+ \node[above] (root label swap \the\RootNumber)%
+ at ({(#3)*\dynkinedgelength},{((#4)*\dynkinedgelength)+2*\dynkinradius}) {};%
+ \node[below] (root label \the\RootNumber)%
+ at ({(#3)*\dynkinedgelength},{((#4)*\dynkinedgelength)-2*\dynkinradius}) {};%
+ }%
+}%
+
+%% \placeRootHorizontalLabels{<n>}{<x>}{<y>}
+%% ->
+%% Tell TikZ where to place node <n> (in Bourbaki ordering) for a root of a Dynkin diagram. Draws nothing.
+%% Places labels to the left or right of the root.
+%% Starred form swaps label positions.
+\NewDocumentCommand\placeRootHorizontalLabels{smmm}%
+{%
+ \convertRootNumber{#2}%
+ \node (root \the\RootNumber) at ({(#3)*\dynkinedgelength},{(#4)*\dynkinedgelength}) {};%
+ \IfBooleanTF{#1}%
+ {%
+ \node[left] (root label \the\RootNumber)%
+ at ({((#3)*\dynkinedgelength)-\dynkinradius},{(#4)*\dynkinedgelength}) {};%
+ \node[right] (root label swap \the\RootNumber)%
+ at ({((#3)*\dynkinedgelength)+\dynkinradius},{(#4)*\dynkinedgelength}) {};%
+ }%
+ {%
+ \node[left] (root label swap \the\RootNumber)%
+ at ({((#3)*\dynkinedgelength)-\dynkinradius},{(#4)*\dynkinedgelength}) {};%
+ \node[right] (root label \the\RootNumber)%
+ at ({((#3)*\dynkinedgelength)+\dynkinradius},{(#4)*\dynkinedgelength}) {};%
+ }%
+}%
+
+%% \Adynkinnodes
+%% ->
+%% Tell TikZ where to place the nodes for an A series Dynkin diagram. Draws nothing.
+\newcommand*{\Adynkinnodes}%
+{%
+ \ifdynkinfolded%
+ \newcount\halfrank%
+ \halfrank=\dynkinrank%
+ \divide\halfrank by 2%
+ \newcount\countdown%
+ \countdown=\dynkinrank%
+ \ifodd\dynkinrank%
+ \foreach \b in {1,...,\the\halfrank}%
+ {%
+ \placeRoot*{\b}{\b}{1}%
+ \placeRoot{\the\countdown}{\b}{-1}%
+ \ifdynkinarrows%
+ \ifnum\dynkinrank>1%
+ \dynkinfoldarrow*{\b}{\the\countdown}%
+ \fi%
+ \fi%
+ \global\advance\countdown by -1%
+ }%
+ \advance\halfrank by 1%
+ \placeRootHorizontalLabels{\the\halfrank}{\the\halfrank}{0}%
+ \else%
+ \foreach \b in {1,...,\the\halfrank}%
+ {%
+ \placeRoot*{\b}{\b}{1}%
+ \placeRoot{\the\countdown}{\b}{-1}%
+ \ifdynkinarrows%
+ \dynkinfoldarrow*{\b}{\the\countdown} %
+ \fi%
+ \global\advance\countdown by -1%
+ }%
+ \fi%
+ \else%
+ \foreach \b in {1,...,\the\dynkinrank}%
+ {%
+ \placeRoot{\b}{\b}{0}%
+ }%
+ \fi%
+}%
+
+%% \Adynkin
+%% ->
+%% Draws an A series Dynkin diagram.
+\newcommand*{\Adynkin}
{
-\node at (root label \i) {\scalebox{0.5}{\(\i\)}};
+ \newif\ifwasfolded
+ \ifdynkinfolded
+ \global\wasfoldedtrue
+ \else
+ \global\wasfoldedfalse
+ \fi
+ \ifnum\dynkinrank=0%
+ \global\dynkinrank=7%
+ % Create the nodes.
+ \Adynkinnodes%
+ % Draw the edges.
+ \dynkinline*{1}{2}%
+ \dynkindots*{2}{3}%
+ \ifdynkinfolded%
+ \dynkindownarc*{3}{4}%
+ \dynkinuparc*{4}{5}%
+ \else%
+ \dynkinline*{3}{4}%
+ \dynkinline*{4}{5}%
+ \fi%
+ \dynkindots*{5}{6}%
+ \dynkinline*{6}{7}%
+ \else%
+ \ifnum\dynkinrank=1%
+ \global\dynkinfoldedfalse%
+ \fi%
+ % Create the nodes.
+ \Adynkinnodes%
+ % Draw the edges.
+ \ifnum\dynkinrank>1%
+ \ifnum\dynkinrank=2%
+ \ifdynkinfolded%
+ \dynkinsemicircle*{1}{2}%
+ \else%
+ \dynkinline*{1}{2}%
+ \fi%
+ \else%
+ \newcount\bpo%
+ \bpo=2%
+ \newcount\drmo%
+ \drmo=\dynkinrank%
+ \advance \drmo by -1%
+ \ifdynkinfolded%
+ \newcount\halfrank%
+ \halfrank=\dynkinrank%
+ \divide\halfrank by 2%
+ \newcount\hrmo%
+ \hrmo=\halfrank%
+ \advance\hrmo by -1%
+ \ifnum\halfrank>1%
+ \foreach \b in {1,...,\the\hrmo}%
+ {%
+ \dynkinline*{\b}{\bpo}%
+ \global\advance\bpo by 1%
+ }%
+ \fi%
+ \newcount\hrpo%
+ \hrpo=\halfrank%
+ \advance\hrpo by 1%
+ \ifodd\dynkinrank%
+ \newcount\hrpt%
+ \hrpt=\hrpo%
+ \advance\hrpt by 1%
+ \dynkindownarc*{\the\halfrank}{\the\hrpo}%
+ \dynkinuparc*{\the\hrpo}{\the\hrpt}%
+ \ifdynkinarrows%
+ \dynkinfoldarrow*{\the\halfrank}{\the\hrpt}%
+ \fi%
+ \global\advance\bpo by 2%
+ \ifnum\hrpt<\dynkinrank%
+ \foreach \b in {\the\hrpt,...,\the\drmo}%
+ {%
+ \dynkinline*{\b}{\bpo}%
+ \global\advance\bpo by 1%
+ }%
+ \fi%
+ \else%
+ \dynkinsemicircle*{\the\halfrank}{\the\hrpo}%
+ \global\advance\bpo by 1%
+ \ifnum\halfrank<\drmo%
+ \foreach \b in {\the\hrpo,...,\the\drmo}%
+ {%
+ \dynkinline*{\b}{\bpo}%
+ \global\advance\bpo by 1%
+ }%
+ \fi%
+ \fi%
+ \else%
+ \foreach \b in {1,...,\the\drmo}%
+ {%
+ \dynkinline*{\b}{\bpo}%
+ \global\advance\bpo by 1%
+ }%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \ifisaffine%
+ \dynkinline*{0}{1}%
+ \dynkinline*{0}{\the\dynkinrank}%
+ \dynkindot*{0}%
+ \fi%
+ % Draw the nodes.
+ \IfStrEqCase{\dynkinSatake}%
+ {%
+ {*}%
+ {%
+ \foreach \b in {1,...,\the\dynkinrank}%
+ {%
+ \testbit{\dynkinparabolic}{\b}{\dynkincross{\b}}{\dynkindot{\b}}%
+ }%
+ }%
+ {I}%
+ {%
+ \ifisaffine%
+ \dynkinline*{0}{1}%
+ \dynkinline*{0}{\the\dynkinrank}%
+ \dynkindot*{0}%
+ \fi%
+ \foreach \b in {1,...,\the\dynkinrank}%
+ {%
+ \testbit{\dynkinparabolic}{\b}{\dynkincross{\b}}{\dynkinopendot{\b}}%
+ }%
+ }%
+ {II}%
+ {%
+ \newcount\bb%
+ \bb=1%
+ \foreach \b in {1,...,\the\dynkinrank}%
+ {%
+ \ifodd\bb%
+ \testbit{\dynkinparabolic}{\b}{\dynkincross{\b}}{\dynkincloseddot{\b}}%
+ \else%
+ \testbit{\dynkinparabolic}{\b}{\dynkincross{\b}}{\dynkinopendot{\b}}%
+ \fi%
+ \global\advance \bb by 1%
+ }%
+ }%
+ }%
+ \ifwasfolded
+ \global\dynkinfoldedtrue
+ \else
+ \global\dynkinfoldedfalse
+ \fi
}
+
+%% \Bdynkin
+%% ->
+%% Draw a B series Dynkin diagram.
+\newcommand*{\Bdynkin}
+{
+ \ifdynkincoxeter
+ \Adynkin
+ \convertRootPair{1}{2}
+ \node[above] at ($.5*(root \the\@fromRoot)+.5*(root \the\@toRoot)$) {\dynkinprint{4}};
+ \else
+ \ifnum\dynkinrank=0
+ \dynkinrank=5
+ % Create the nodes.
+ \Adynkinnodes
+ % Draw the edges.
+ \dynkinline*{1}{2}
+ \dynkindots*{2}{3}
+ \dynkinline*{3}{4}
+ \dynkindoubleline*{4}{5}
+ \else
+ % Create the nodes.
+ \Adynkinnodes
+ % Draw the edges.
+ \dynkinline*{1}{\the\dynkinrank}%
+ \newcount\rmo
+ \rmo=\dynkinrank
+ \advance \rmo by -1
+ \dynkindoubleline*{\the\rmo}{\the\dynkinrank}
+ \fi
+ % Draw the nodes.
+ \ifisaffine
+ \dynkinline*{0}{2}
+ \dynkindot*{0}
+ \fi
+ \foreach \b in {1,...,\the\dynkinrank}
+ {
+ \testbit{\dynkinparabolic}{\b}{\dynkincross{\b}}{\dynkindot{\b}}
+ }
+ \fi
}
+%% \Cdynkin
+%% ->
+%% Draws a C series Dynkin diagram.
+\newcommand*{\Cdynkin}
+{
+ \ifdynkincoxeter
+ \Bdynkin
+ \else
+ \ifnum\dynkinrank=0
+ \dynkinrank=5
+ % Create the nodes.
+ \Adynkinnodes
+ % Draw the edges.
+ \dynkinline*{1}{2}
+ \dynkindots*{2}{3}
+ \dynkinline*{3}{4}
+ \dynkindoubleline*{5}{4}
+ \else
+ % Create the nodes.
+ \Adynkinnodes
+ % Draw the edges.
+ \newcount\rmo
+ \rmo=\dynkinrank
+ \advance\rmo by -1
+ \dynkinline*{1}{\the\rmo}%
+ \dynkindoubleline*{\the\dynkinrank}{\the\rmo}
+ \fi
+ % Draw the nodes.
+ \ifisaffine
+ \dynkindoubleline*{0}{1}
+ \dynkindot*{0}
+ \fi
+ \foreach \b in {1,...,\the\dynkinrank}
+ {
+ \testbit{\dynkinparabolic}{\b}{\dynkincross{\b}}{\dynkindot{\b}}
+ }
+ \fi
+}
-\newcommand{\dynkincross}[2]{
-\dynkindot{#1}{#2}
-\draw[thick,\dynkincolor] ({#1*\dykinedgelength},{#2*\dykinedgelength}) -- ++ ({(1/sqrt(2))*\dynkinXsize},{(1/sqrt(2))*\dynkinXsize});
-\draw[thick,\dynkincolor] ({#1*\dykinedgelength},{#2*\dykinedgelength}) -- ++ ({-(1/sqrt(2))*\dynkinXsize},{(1/sqrt(2))*\dynkinXsize});
-\draw[thick,\dynkincolor] ({#1*\dykinedgelength},{#2*\dykinedgelength}) -- ++ ({(1/sqrt(2))*\dynkinXsize},{-(1/sqrt(2))*\dynkinXsize});
-\draw[thick,\dynkincolor] ({#1*\dykinedgelength},{#2*\dykinedgelength}) -- ++ ({-(1/sqrt(2))*\dynkinXsize},{-(1/sqrt(2))*\dynkinXsize});
+%% \Ddynkinnodes
+%% ->
+%% Tell TikZ where to place the nodes for a D series Dynkin diagram. Draws nothing.
+\newcommand*{\Ddynkinnodes}
+{
+ \newcount\rmo
+ \rmo=\dynkinrank
+ \advance \rmo by -1
+ \newcount\rmt
+ \rmt=\rmo
+ \advance\rmt by -1
+ % Create the nodes.
+ \foreach \b in {1,...,\the\rmt}
+ {
+ \placeRoot{\b}{\b}{0}
+ }
+ \pgfmathparse{subtract(\the\rmo,.5)}
+ \let\rmh\pgfmathresult
+ \ifdynkinfolded
+ \placeRoot{\the\rmo}{\rmh}{-.9}
+ \placeRoot*{\the\dynkinrank}{\rmh}{.9}
+ \else
+ \placeRootHorizontalLabels{\the\rmo}{\rmh}{-.9}
+ \placeRootHorizontalLabels{\the\dynkinrank}{\rmh}{.9}
+ \fi
}
-\newcommand{\dynkindot}[2]{%
-\fill[\dynkincolor] (\dykinedgelength*#1,\dykinedgelength*#2) circle (\dynkinradius);%
+%% \Ddynkin
+%% ->
+%% Draws a D series Dynkin diagram.
+\newcommand*{\Ddynkin}%
+{
+ \ifnum\dynkinrank=1
+ \gdef\dynkinseries{A}
+ \Adynkin
+ \else
+ \ifnum\dynkinrank=0
+ \dynkinrank=6
+ \Ddynkinnodes
+ % Draw the edges.
+ \dynkinline*{1}{2}
+ \dynkindots*{2}{3}
+ \dynkinline*{3}{4}
+ \dynkinline*{4}{5}
+ \dynkinline*{4}{6}
+ \else
+ \Ddynkinnodes
+ % Draw the edges.
+ \dynkinline*{1}{\the\rmt}
+ \dynkinline*{\the\rmt}{\the\rmo}
+ \dynkinline*{\the\rmt}{\the\dynkinrank}
+ \fi
+ \ifdynkinfolded
+ \ifdynkinarrows
+ \draw[\dynkinfoldarrowstyle,\dynkinfoldarrowcolor]
+ (root \the\rmo.east)
+ to [out=45, in=-45]
+ (root \the\dynkinrank.east);
+ \fi
+ \fi
+ % Draw the nodes.
+ \ifisaffine
+ \dynkinline*{0}{2}
+ \dynkindot*{0}
+ \fi
+ \foreach \b in {1,...,\the\dynkinrank}
+ {
+ \testbit{\dynkinparabolic}{\b}{\dynkincross{\b}}{\dynkindot{\b}}
+ }
+ \fi
}
-% Line between nodes.
-\newcommand{\dynkinline}[4]{\draw[thin,\dynkincolor] (\dykinedgelength*#1,\dykinedgelength*#2) -- (\dykinedgelength*#3,\dykinedgelength*#4);}
+%% \Edynkinunfolded
+%% ->
+%% Draws an E series Dynkin diagram not folded.
+\newcommand*{\Edynkinunfolded}%
+{
+ % Create the nodes.
+ \placeRoot{1}{1}{0}
+ \ifisaffine
+ \ifnum\dynkinrank=6
+ \placeRootHorizontalLabels{2}{3}{1}
+ \else
+ \placeRoot*{2}{3}{1}
+ \fi
+ \else
+ \placeRoot*{2}{3}{1}
+ \fi
+ \foreach \b in {3,...,\dynkinrank}
+ {
+ \newcount\bmo
+ \bmo=\b
+ \advance\bmo by -1
+ \placeRoot{\b}{\the\bmo}{0}
+ }
+% % Draw the edges.
+ \dynkinline*{1}{\the\dynkinrank}
+ \dynkinline*{2}{4}
+}
-% Dotted line between nodes.
-\newcommand{\dynkindots}[4]{\draw[densely dotted,\dynkincolor] (\dykinedgelength*#1,\dykinedgelength*#2) -- (\dykinedgelength*#3,\dykinedgelength*#4);}
-% Double line between nodes.
-\newcommand{\dynkindoubleline}[4]{\draw[double,postaction={decorate},\dynkincolor] (\dykinedgelength*#1,\dykinedgelength*#2) -- (\dykinedgelength*#3,\dykinedgelength*#4);}
+%% \Edynkinfolded
+%% ->
+%% Draws a folded E6 Dynkin diagram.
+\newcommand*{\Edynkinfolded}%
+{
+ \placeRoot*{1}{0}{1}
+ \placeRoot*{3}{1}{1}
+ \placeRootHorizontalLabels*{4}{2}{0}
+ \placeRootHorizontalLabels{2}{3}{0}
+ \placeRoot{5}{1}{-1}
+ \placeRoot{6}{0}{-1}
+ \dynkinline*{1}{3}
+ \dynkinline*{2}{4}
+ \dynkinline*{5}{6}
+ \dynkindownarc*{3}{4}
+ \dynkinuparc*{4}{5}
+}
-% Triple line between nodes.
-\newcommand{\dynkintripleline}[4]{
-\draw[triple={[line width=.1mm,\dynkincolor] in
- [line width=.6mm,\dynkinbackcolor] in
- [line width=.8mm,\dynkincolor]}] (\dykinedgelength*#3,\dykinedgelength*#4) -- (\dykinedgelength*#1,\dykinedgelength*#2);
-\draw[postaction={decorate},double,\dynkincolor] ({0.401*\dykinedgelength*#3+0.599*\dykinedgelength*#1},\dykinedgelength*#4) -- ({0.399*\dykinedgelength*#3+0.601*\dykinedgelength*#1},\dykinedgelength*#2);
+%% \Edynkin
+%% ->
+%% Draws an E6 Dynkin diagram.
+\newcommand*{\Edynkin}%
+{
+ \ifdynkinfolded
+ \ifnum\dynkinrank=6
+ \Edynkinfolded
+ \else
+ \ClassWarning{Can not fold a diagram of type \dynkinseries\the\dynkinrank.}
+ \fi
+ \else
+ \Edynkinunfolded
+ \fi
+ % Draw the nodes.
+ \ifisaffine
+ \ifnum\dynkinrank=6
+ \dynkinline*{0}{2}
+ \else
+ \dynkinline*{0}{1}
+ \fi
+ \dynkindot{0}
+ \fi
+ \IfStrEqCase{\dynkinSatake}%
+ {%
+ {*}%
+ {%
+ \foreach \b in {1,...,\the\dynkinrank}%
+ {%
+ \testbit{\dynkinparabolic}{\b}{\dynkincross{\b}}{\dynkindot{\b}}%
+ }%
+ \ifdynkinfolded
+ \ifdynkinarrows
+ \dynkinfoldarrow*{1}{6}
+ \dynkinfoldarrow*{3}{5}
+ \fi
+ \fi
+ }%
+ {I}%
+ {%
+ \foreach \b in {1,...,6}%
+ {%
+ \testbit{\dynkinparabolic}{\b}{\dynkincross{\b}}{\dynkinopendot{\b}}%
+ }%
+ }%
+ {II}%
+ {%
+ \ifdynkinarrows
+ \dynkinfoldarrow*{1}{6}%
+ \dynkinfoldarrow*{3}{5}%
+ \fi
+ \foreach \b in {1,...,6}%
+ {%
+ \testbit{\dynkinparabolic}{\b}{\dynkincross{\b}}{\dynkinopendot{\b}}%
+ }%
+ }%
+ {III}%
+ {%
+ \dynkinfoldarrow*{1}{6}%
+ \foreach \b in {1,2,6}%
+ {%
+ \dynkinopendot*{\b}%
+ }%
+ \foreach \b in {3,4,5}%
+ {%
+ \dynkincloseddot*{\b}%
+ }%
+ }%
+ {IV}%
+ {%
+ \foreach \b in {1,6}%
+ {%
+ \dynkinopendot*{\b}%
+ }%
+ \foreach \b in {2,3,4,5}%
+ {%
+ \dynkincloseddot*{\b}%
+ }%
+ }%
+ {V}%
+ {%
+ \foreach \b in {1,...,7}%
+ {%
+ \testbit{\dynkinparabolic}{\b}{\dynkincross{\b}}{\dynkinopendot{\b}}%
+ }%
+ }%
+ {VI}%
+ {%
+ \foreach \b in {1,3,4,6}%
+ {%
+ \dynkinopendot*{\b}%
+ }%
+ \foreach \b in {2,5,7}%
+ {%
+ \dynkincloseddot*{\b}%
+ }%
+ }%
+ {VII}%
+ {%
+ \foreach \b in {1,6,7}%
+ {%
+ \dynkinopendot*{\b}%
+ }%
+ \foreach \b in {2,3,4,5}%
+ {%
+ \dynkincloseddot*{\b}%
+ }%
+ }%
+ {VIII}%
+ {%
+ \foreach \b in {1,...,8}%
+ {%
+ \testbit{\dynkinparabolic}{\b}{\dynkincross{\b}}{\dynkinopendot{\b}}%
+ }%
+ }%
+ {XI}%
+ {%
+ \foreach \b in {1,6,7,8}%
+ {%
+ \dynkinopendot*{\b}%
+ }%
+ \foreach \b in {2,3,4,5}%
+ {%
+ \dynkincloseddot*{\b}%
+ }%
+ }%
+ }%
}
-\tikzset{
- triple/.style args={[#1] in [#2] in [#3]}{
- #1,preaction={preaction={draw,#3},draw,#2}
- }
-}
-\newcommand*{\testbit}[4]%
-% if bit number #2 of #1 is 1 then expand #3 else expand #4.
-{%
-\pgfmathparse{mod(div(#1,2^(#2)),2)}%
-\let\tf\pgfmathresult%
-\IfStrEq{\tf}{1.0}{#3}{#4}%
-}%%
-
-
-\newcommand*{\Adynkin}[2][0]%
-%\Adynkin[p]{n} gives the Dynkin diagram of An with parabolic subgroup p.
-%\Adynkin[p]{*} allows for an indefinite choice of n, but then the possible parabolics are only from 0 to 2^7.
-{%%
-\IfStrEq{#2}{*}%
-{%%
- \dynkinrank=7
- \dynkinline{0}{0}{1}{0};
- \dynkindots{1}{0}{2}{0};
- \dynkinline{2}{0}{4}{0};
- \dynkindots{4}{0}{5}{0};
- \dynkinline{5}{0}{6}{0};
- \foreach \b in {0,...,6}%%%
- {%%%
- \testbit{#1}{\b}{\dynkincross{\b}{0}}{\dynkindot{\b}{0}}
- \node (root \b) at ({\b*\dykinedgelength},0) {};
- \node[below] (root label \b) at ({\b*\dykinedgelength},0) {};
- \node[above] (root label swap \b) at ({\b*\dykinedgelength},0) {};
- }%%%
-}%%
-{%%
-% \draw[\dykinbackcolor] (0,{-\dykinedgelength}) rectangle ({#2*\dykinedgelength},{\dykinedgelength});
- \newcount\rmo
- \rmo=#2
- \advance\rmo by -1
- \dynkinline{0}{0}{\the\rmo}{0};%
- \foreach \b in {0,...,\the\rmo}%%%
- {%%%
- \testbit{#1}{\b}{\dynkincross{\b}{0}}{\dynkindot{\b}{0}}
- \node (root \b) at ({\b*\dykinedgelength},0) {};
- \node[below] (root label \b) at ({\b*\dykinedgelength},0) {};
- \node[above] (root label swap \b) at ({\b*\dykinedgelength},0) {};
- }%%%
+%% \Fdynkin
+%% ->
+%% Draws an F series Dynkin diagram.
+\newcommand*{\Fdynkin}%
+{
+ \Adynkinnodes
+ \ifdynkincoxeter
+ \dynkinline*{1}{4}
+ \convertRootPair{2}{3}
+ \node[above] at ($.5*(root \the\@fromRoot)+.5*(root \the\@toRoot)$) {\dynkinprint{4}};
+ \foreach \b in {1,...,4}%
+ {%
+ \testbit{\dynkinparabolic}{\b}{\dynkincross{\b}}{\dynkindot{\b}}%
+ }%
+ \else
+ \dynkinline*{1}{2}
+ \dynkinline*{3}{4}
+ \dynkindoubleline*{2}{3}
+ \ifisaffine
+ \dynkinline*{0}{1}
+ \dynkindot{0}
+ \fi
+ \IfStrEqCase{\dynkinSatake}
+ {%
+ {*}%
+ {%
+ \foreach \b in {1,...,4}%
+ {%
+ \testbit{\dynkinparabolic}{\b}{\dynkincross{\b}}{\dynkindot{\b}}%
+ }%
+ }%
+ {I}%
+ {%
+ \foreach \b in {1,...,4}%
+ {%
+ \testbit{\dynkinparabolic}{\b}{\dynkincross{\b}}{\dynkinopendot{\b}}%
+ }%
+ }%
+ {II}%
+ {%
+ \dynkincloseddot*{1}%
+ \dynkincloseddot*{2}%
+ \dynkincloseddot*{3}%
+ \dynkinopendot*{4}%
+ }%
+ }%
+ \fi
}
-}%%
+%% \Gdynkin
+%% ->
+%% Draws a G series Dynkin diagram.
+\newcommand*{\Gdynkin}%
+{
+ \newif\ifwasopen
+ \ifdynkinopendots
+ \global\wasopentrue
+ \else
+ \global\wasopenfalse
+ \fi
+ \Adynkinnodes
+ \ifisaffine
+ \dynkinline*{0}{2}
+ \fi
+ \ifdynkincoxeter
+ \convertRootPair{1}{2}
+ \node[above] at ($.5*(root \the\@fromRoot)+.5*(root \the\@toRoot)$) {\dynkinprint{6}};
+ \dynkinline*{1}{2}
+ \else
+ \dynkintripleline*{1}{2}
+ \IfStrEq{\dynkinSatake}{I}{\global\dynkinopendotstrue}{}
+ \ifisaffine
+ \dynkindot{0}
+ \fi
+ \fi
+ \foreach \b in {1,...,2}
+ {
+ \testbit{\dynkinparabolic}{\b}{\dynkincross{\b}}{\dynkindot{\b}}
+ }
+ \ifwasopen
+ \global\dynkinopendotstrue
+ \else
+ \global\dynkinopendotsfalse
+ \fi
+}
-\newcommand*{\Bdynkin}[2][0]%
-%\Bdynkin[p]{n} gives the Dynkin diagram of Bn with parabolic subgroup p.
-%\Bdynkin[p]{*} allows for an indefinite choice of n, but then the possible parabolics are only from 0 to 2^5.
-{%
-\IfStrEq{#2}{*}%
-{%%
- \dynkinrank=5
- \dynkinline{0}{0}{1}{0};
- \dynkindots{1}{0}{2}{0};
- \dynkinline{2}{0}{3}{0};
- \dynkindoubleline{3}{0}{4}{0};
- \foreach \b in {0,...,4}%%%
- {%%%
- \testbit{#1}{\b}{\dynkincross{\b}{0}}{\dynkindot{\b}{0}}
- \node (root \b) at ({\b*\dykinedgelength},0) {};
- \node[below] (root label \b) at ({\b*\dykinedgelength},0) {};
- \node[above] (root label swap \b) at ({\b*\dykinedgelength},0) {};
- }%%%
-}%%
-{%%
-\pgfmathparse{subtract(#2,1)}%
-\let\rmo\pgfmathresult%
-\pgfmathparse{subtract(\rmo,1)}%
-\let\rmt\pgfmathresult%
-\dynkinline{0}{0}{\rmo}{0};%
-\dynkindoubleline{\rmt}{0}{\rmo}{0};
-\foreach \b in {0,...,\rmo}%%%
-{%%%
-\testbit{#1}{\b}{\dynkincross{\b}{0}}{\dynkindot{\b}{0}}
-\node (root \b) at ({\b*\dykinedgelength},0) {};
-\node[below] (root label \b) at ({\b*\dykinedgelength},0) {};
-\node[above] (root label swap \b) at ({\b*\dykinedgelength},0) {};
-}%%%
-}%%
-}%
+%% \Hdynkin
+%% ->
+%% Draws an H series Coxeter diagram.
+\newcommand*{\Hdynkin}%
+{
+ \newcount\Hn
+ \Hn=\dynkinrank
+ \dynkinrank=2
+ \Adynkin
+ \convertRootPair{1}{2}
+ \node[above] at ($.5*(root \the\@fromRoot)+.5*(root \the\@toRoot)$) {\dynkinprint{\the\Hn}};
+}
-\newcommand*{\Cdynkin}[2][0]%
-%\Cdynkin[p]{n} gives the Dynkin diagram of Cn with parabolic subgroup p.
-%\Cdynkin[p]{*} allows for an indefinite choice of n, but then the possible parabolics are only from 0 to 2^5.
-{%%
-\IfStrEq{#2}{*}%
-{%%
- \dynkinrank=5
- \dynkinline{0}{0}{1}{0};
- \dynkindots{1}{0}{2}{0};
- \dynkinline{2}{0}{3}{0};
- \dynkindoubleline{4}{0}{3}{0};
- \foreach \b in {0,...,4}%%%
- {%%%
- \testbit{#1}{\b}{\dynkincross{\b}{0}}{\dynkindot{\b}{0}}
- \node (root \b) at ({\b*\dykinedgelength},0) {};
- \node[below] (root label \b) at ({\b*\dykinedgelength},0) {};
- \node[above] (root label swap \b) at ({\b*\dykinedgelength},0) {};
- }%%%
-}%%
-{%%
-\pgfmathparse{subtract(#2,1)}%
-\let\rmo\pgfmathresult%
-\pgfmathparse{subtract(\rmo,1)}%
-\let\rmt\pgfmathresult%
-\dynkinline{0}{0}{\rmo}{0};%
-\dynkindoubleline{\rmo}{0}{\rmt}{0};
-\foreach \b in {0,...,\rmo}%%%
-{%%%
-\testbit{#1}{\b}{\dynkincross{\b}{0}}{\dynkindot{\b}{0}}
-\node (root \b) at ({\b*\dykinedgelength},0) {};
-\node[below] (root label \b) at ({\b*\dykinedgelength},0) {};
-\node[above] (root label swap \b) at ({\b*\dykinedgelength},0) {};
-}%%%
-}%%
-}%
+%% \Idynkin
+%% ->
+%% Draws an I series Coxeter diagram.
+\newcommand*{\Idynkin}%
+{
+ \Adynkin
+ \convertRootPair{1}{2}
+ \node[above] at ($.5*(root \the\@fromRoot)+.5*(root \the\@toRoot)$) {\dynkinprint{5}};
+}
+\newcommand*{\affineAdynkin}%
+{
+\ifnum\dynkinrank=0
+ \placeRoot*{0}{4}{1}
+ \Adynkin
+\else
+ \ifnum\dynkinrank=1
+ \placeRoot{0}{0}{0}
+ \placeRoot{1}{2}{0}
+ \convertRootNumber{1}
+ \draw[
+ double,
+ \dynkincolor,
+ {Classical TikZ Rightarrow[length={3*\dynkinradius}]}-{Classical TikZ Rightarrow[length={3*\dynkinradius}]}
+ ]
+ ($(root 0)+(\dynkinradius,0)$) -- ($(root \the\RootNumber)-(\dynkinradius,0)$);
+ \else
+ \pgfmathparse{(.5+.5*\the\dynkinrank)}%
+ \let\halfway\pgfmathresult%
+ \placeRoot*{0}{\halfway}{1}
+ \Adynkin
+ \fi
+\fi
+}
-\newcommand*{\Ddynkin}[2][0]%
-%\Ddynkin[p]{n} gives the Dynkin diagram of Dn with parabolic subgroup p.
-%\Ddynkin[p]{*} allows for an indefinite choice of n, but then the possible parabolics are only from 0 to 2^6.
-{%%
-\IfStrEq{#2}{*}%
-{%%
- \dynkinrank=6
- \foreach \x in {0,...,3}
- {
- \dynkindot{\x}{0}
- }
- \dynkinline{0}{0}{1}{0}
- \dynkindots{1}{0}{2}{0}
- \dynkinline{2}{0}{3}{0}
- \dynkinline{3}{0}{3.5}{.9}
- \dynkinline{3}{0}{3.5}{-.9}
-\foreach \b in {0,...,3}%%%
-{%%%
-\testbit{#1}{\b}{\dynkincross{\b}{0}}{\dynkindot{\b}{0}}
-\node (root \b) at ({\b*\dykinedgelength},0) {};
-\node[below] (root label \b) at ({\b*\dykinedgelength},0) {};
-}%%%
-\testbit{#1}{4}{\dynkincross{3.5}{-.9}}{\dynkindot{3.5}{-.9}}
-\node (root 4) at ({3.5*\dykinedgelength},{-.9*\dykinedgelength}) {};
-\node[below] (root label 4) at ({3.5*\dykinedgelength},{-.9*\dykinedgelength}) {};
-\testbit{#1}{5}{\dynkincross{3.5}{.9}}{\dynkindot{3.5}{.9}}
-\node (root 5) at ({3.5*\dykinedgelength},{.9*\dykinedgelength}) {};
-\node[above] (root label 5) at ({3.5*\dykinedgelength},{.9*\dykinedgelength}) {};
-}%%
-{%%
-\newcount\rmo
-\rmo=#2
-\advance\rmo by -1
-\newcount\rmt
-\rmt=\rmo
-\advance\rmt by -1
-\newcount\rmtt
-\rmtt=\rmt
-\advance\rmtt by -1
-\dynkinline{0}{0}{\the\rmtt}{0};%
-\pgfmathparse{subtract(\the\rmt,.5)}
-\let\rmh\pgfmathresult%
-\dynkinline{\the\rmtt}{0}{\rmh}{.9}
-\dynkinline{\the\rmtt}{0}{\rmh}{-.9}
-\foreach \b in {0,...,\the\rmtt}%%%
-{%%%
-\testbit{#1}{\b}{\dynkincross{\b}{0}}{\dynkindot{\b}{0}}
-\node (root \b) at ({\b*\dykinedgelength},0) {};
-\node[below] (root label \b) at ({\b*\dykinedgelength},0) {};
-}%%%
-\testbit{#1}{\the\rmt}{\dynkincross{\rmh}{-.9}}{\dynkindot{\rmh}{-.9}}
-\node (root \the\rmt) at ({\rmh*\dykinedgelength},{-.9*\dykinedgelength}) {};
-\node[below] (root label \the\rmt) at ({\rmh*\dykinedgelength},{-.9*\dykinedgelength}) {};
-\testbit{#1}{\the\rmo}{\dynkincross{\rmh}{.9}}{\dynkindot{\rmh}{.9}}
-\node (root \the\rmo) at ({\rmh*\dykinedgelength},{.9*\dykinedgelength}) {};
-\node[above] (root label \the\rmo) at ({\rmh*\dykinedgelength},{.9*\dykinedgelength}) {};
-}%%
-}%
+\newcommand*{\affineBdynkin}%
+{
+ \placeRoot*{0}{2}{1}
+ \Bdynkin
+}
-\newcommand*{\Edynkin}[2][0]%
-%\Edynkin[p]{n} gives the Dynkin diagram of En, n=6,7,8, with parabolic subgroup p.
+\newcommand*{\affineCdynkin}
{
-\pgfmathparse{subtract(#2,1)}%
-\let\rmo\pgfmathresult%
-\pgfmathparse{subtract(\rmo,1)}%
-\let\rmt\pgfmathresult%
-\dynkinline{0}{0}{\rmt}{0};%
-\dynkinline{2}{0}{2}{1}
-\testbit{#1}{0}{\dynkincross{0}{0}}{\dynkindot{0}{0}}
-\node (root 0) at (0,0) {};
-\node[below] (root label 0) at (0,0) {};
-\testbit{#1}{1}{\dynkincross{2}{1}}{\dynkindot{2}{1}}
-\node (root 1) at ({2*\dykinedgelength},{1*\dykinedgelength}) {};
-\node[above] (root label 1) at ({2*\dykinedgelength},{1*\dykinedgelength}) {};
-\foreach \b in {2,...,\rmo}%%%
-{%%%
-\pgfmathparse{subtract(\b,1)}%
-\let\bmo\pgfmathresult%
-\testbit{#1}{\b}{\dynkincross{\bmo}{0}}{\dynkindot{\bmo}{0}}
-\node (root \b) at ({\bmo*\dykinedgelength},0) {};
-\node[below] (root label \b) at ({\bmo*\dykinedgelength},0) {};
-}%%%
+ \placeRoot{0}{0}{0}
+ \Cdynkin
}
+\newcommand*{\affineDdynkin}
+{
+ \placeRoot*{0}{2}{1}
+ \Ddynkin
+}
-\newcommand*{\Ffourdynkin}[1][0]%
-%\Fdynkin[p]{n} gives the Dynkin diagram of F4 with parabolic subgroup p.
+\newcommand*{\affineEdynkin}
{
-\dynkinline{0}{0}{3}{0};%
-\dynkindoubleline{1}{0}{2}{0}
-\foreach \b in {0,...,3}%%%
-{%%%
-\testbit{#1}{\b}{\dynkincross{\b}{0}}{\dynkindot{\b}{0}}
-\node (root \b) at ({\b*\dykinedgelength},0) {};
-\node[below] (root label \b) at ({\b*\dykinedgelength},0) {};
-\node[above] (root label swap \b) at ({\b*\dykinedgelength},0) {};
-}%%%
+ \ifnum\dynkinrank=6
+ \placeRoot*{0}{3}{2}
+ \Edynkin
+ \else
+ \placeRoot{0}{0}{0}
+ \Edynkin
+ \fi
}
-\newcommand*{\Gtwodynkin}[1][0]%
-%\Gtwodynkin[p] gives the Dynkin diagram of G2 with parabolic subgroup p.
-{%%
-\dynkintripleline{0}{0}{1}{0};%
-\foreach \b in {0,...,1}%%%
-{%%%
-\testbit{#1}{\b}{\dynkincross{\b}{0}}{\dynkindot{\b}{0}}
-\node (root \b) at ({\b*\dykinedgelength},0) {};
-\node[below] (root label \b) at ({\b*\dykinedgelength},0) {};
-\node[above] (root label swap \b) at ({\b*\dykinedgelength},0) {};
-}%%%
-}%%
+\newcommand*{\affineFdynkin}
+{
+ \placeRoot{0}{0}{0}
+ \Fdynkin
+}
+\newcommand*{\affineGdynkin}
+{
+ \placeRoot{0}{3}{0}
+ \Gdynkin
+}
\endinput