summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/dynkin-diagrams/dynkin-diagrams.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-09-13 22:04:42 +0000
committerKarl Berry <karl@freefriends.org>2017-09-13 22:04:42 +0000
commite8c20bb0877f0c49076ba2768b4cc359d973ed58 (patch)
tree126468f9f8be7c3b95774ad08f9612fca1eb47e5 /Master/texmf-dist/tex/latex/dynkin-diagrams/dynkin-diagrams.sty
parente93b2d183454ff002d8526083f8706347afd28cc (diff)
dynkin-diagrams (14sep17)
git-svn-id: svn://tug.org/texlive/trunk@45287 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/dynkin-diagrams/dynkin-diagrams.sty')
-rw-r--r--Master/texmf-dist/tex/latex/dynkin-diagrams/dynkin-diagrams.sty347
1 files changed, 347 insertions, 0 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
new file mode 100644
index 00000000000..5626893c931
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/dynkin-diagrams/dynkin-diagrams.sty
@@ -0,0 +1,347 @@
+\NeedsTeXFormat{LaTeX2e}[1994/06/01]
+\ProvidesPackage{dynkin-diagrams}[2016/06/28 Dynkin diagrams]
+
+\RequirePackage{tikz}
+\RequirePackage{xstring}
+\RequirePackage{etoolbox}
+\RequirePackage{pgfkeys}
+\usetikzlibrary{decorations.markings}
+
+\ProcessOptions\relax
+
+
+%%
+%% Application programming interface:
+%%
+
+\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}{}
+}
+
+
+
+%%%
+%%% 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},
+}
+
+
+\newcommand{\dynkinprintlabels}
+{
+\newcount\rmo
+\rmo=\dynkinrank
+\advance\rmo by -1
+\foreach \i in {0,...,\the\rmo}
+{
+\node at (root label \i) {\scalebox{0.5}{\(\i\)}};
+}
+}
+
+
+\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});
+}
+
+\newcommand{\dynkindot}[2]{%
+\fill[\dynkincolor] (\dykinedgelength*#1,\dykinedgelength*#2) circle (\dynkinradius);%
+}
+
+% Line between nodes.
+\newcommand{\dynkinline}[4]{\draw[thin,\dynkincolor] (\dykinedgelength*#1,\dykinedgelength*#2) -- (\dykinedgelength*#3,\dykinedgelength*#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);}
+
+% 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);
+}
+\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) {};
+ }%%%
+}
+}%%
+
+
+\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) {};
+}%%%
+}%%
+}%
+
+\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) {};
+}%%%
+}%%
+}%
+
+
+\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*{\Edynkin}[2][0]%
+%\Edynkin[p]{n} gives the Dynkin diagram of En, n=6,7,8, with parabolic subgroup p.
+{
+\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) {};
+}%%%
+}
+
+
+\newcommand*{\Ffourdynkin}[1][0]%
+%\Fdynkin[p]{n} gives the Dynkin diagram of F4 with parabolic subgroup p.
+{
+\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) {};
+}%%%
+}
+
+\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) {};
+}%%%
+}%%
+
+
+
+\endinput